regression_007.phpt 581 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test to ensure semi reserved words allow deference
  3. --FILE--
  4. <?php
  5. class Foo {
  6. const use = 'yay';
  7. public static function new() {
  8. echo __METHOD__, PHP_EOL;
  9. return new static();
  10. }
  11. public function self() {
  12. echo __METHOD__, PHP_EOL;
  13. return $this;
  14. }
  15. }
  16. Foo::new()::new()::new();
  17. var_dump(
  18. (new Foo)->self()::new()->self()->self()::use
  19. );
  20. Foo::{'new'}();
  21. var_dump(Foo::use);
  22. echo "\nDone\n";
  23. --EXPECT--
  24. Foo::new
  25. Foo::new
  26. Foo::new
  27. Foo::self
  28. Foo::new
  29. Foo::self
  30. Foo::self
  31. string(3) "yay"
  32. Foo::new
  33. string(3) "yay"
  34. Done