bug79897.phpt 569 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. bug79897: Promoted constructor params with attribs cause crash
  3. --FILE--
  4. <?php
  5. #[Attribute]
  6. class B {
  7. public function __construct($value)
  8. {
  9. }
  10. }
  11. class A {
  12. public function __construct(
  13. #[B(12, X)] public $b
  14. )
  15. {
  16. }
  17. }
  18. const X = 42;
  19. var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments());
  20. var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments());
  21. ?>
  22. --EXPECT--
  23. array(2) {
  24. [0]=>
  25. int(12)
  26. [1]=>
  27. int(42)
  28. }
  29. array(2) {
  30. [0]=>
  31. int(12)
  32. [1]=>
  33. int(42)
  34. }