gh9447.phpt 934 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. GH-9447: Invalid class FQN emitted by AST dump for new and class constants in constant expressions
  3. --FILE--
  4. <?php
  5. namespace App;
  6. use SomewhereElse\Qux;
  7. class Foo
  8. {
  9. public function bar(
  10. $a = Bar::BAZ,
  11. $b = new Bar(),
  12. $c = new parent(),
  13. $d = new self(),
  14. $e = new namespace\Bar(),
  15. $f = new Qux(),
  16. $g = new namespace\Qux(),
  17. $i = new \Qux(),
  18. ) {}
  19. }
  20. $r = new \ReflectionMethod(Foo::class, 'bar');
  21. foreach ($r->getParameters() as $p) {
  22. echo $p, "\n";
  23. }
  24. ?>
  25. --EXPECT--
  26. Parameter #0 [ <optional> $a = \App\Bar::BAZ ]
  27. Parameter #1 [ <optional> $b = new \App\Bar() ]
  28. Parameter #2 [ <optional> $c = new parent() ]
  29. Parameter #3 [ <optional> $d = new self() ]
  30. Parameter #4 [ <optional> $e = new \App\Bar() ]
  31. Parameter #5 [ <optional> $f = new \SomewhereElse\Qux() ]
  32. Parameter #6 [ <optional> $g = new \App\Qux() ]
  33. Parameter #7 [ <optional> $i = new \Qux() ]