regression_007.phpt 584 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. ?>
  24. --EXPECT--
  25. Foo::new
  26. Foo::new
  27. Foo::new
  28. Foo::self
  29. Foo::new
  30. Foo::self
  31. Foo::self
  32. string(3) "yay"
  33. Foo::new
  34. string(3) "yay"
  35. Done