semi_reserved_008.phpt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --TEST--
  2. Testing with comments around semi-reserved names (not intended to be legible)
  3. --FILE--
  4. <?php
  5. trait TraitA
  6. {
  7. public static function list(){ echo __METHOD__, PHP_EOL; }
  8. public static function /* comment */ catch(){ echo __METHOD__, PHP_EOL; }
  9. private static function // comment
  10. throw(){ echo __METHOD__, PHP_EOL; }
  11. private static function
  12. # comment
  13. self(){ echo __METHOD__, PHP_EOL; }
  14. }
  15. trait TraitB
  16. {
  17. public static function exit(){ echo __METHOD__, PHP_EOL; }
  18. protected static function try(){ echo __METHOD__, PHP_EOL; }
  19. }
  20. class Foo
  21. {
  22. use TraitA {
  23. TraitA::
  24. //
  25. /** doc comment */
  26. #
  27. catch /* comment */
  28. // comment
  29. # comment
  30. insteadof TraitB;
  31. TraitA::list as public /**/ foreach;
  32. }
  33. use TraitB {
  34. try /*comment*/ as public attempt;
  35. exit // comment
  36. as/*comment*/die; // non qualified
  37. \TraitB::exit as bye; // full qualified
  38. namespace\TraitB::exit #
  39. as byebye; // even more full qualified
  40. TraitB
  41. ::
  42. /** */
  43. exit as farewell; // full qualified with weird spacing
  44. }
  45. }
  46. Foo /**/
  47. #
  48. //
  49. /** */
  50. ::
  51. /**/
  52. #
  53. //
  54. /** */
  55. attempt();
  56. echo PHP_EOL, "Done", PHP_EOL;
  57. ?>
  58. --EXPECT--
  59. TraitB::try
  60. Done