StripNoise.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace Foo;
  3. /**
  4. * class Fail { }
  5. */
  6. class StripNoise
  7. {
  8. public function test_heredoc()
  9. {
  10. return <<<HEREDOC
  11. class FailHeredocBasic
  12. {
  13. }
  14. HEREDOC . <<< WHITESPACE
  15. class FailHeredocWhitespace
  16. {
  17. }
  18. WHITESPACE . <<<"DOUBLEQUOTES"
  19. class FailHeredocDoubleQuotes
  20. {
  21. }
  22. DOUBLEQUOTES . <<< "DOUBLEQUOTESTABBED"
  23. class FailHeredocDoubleQuotesTabbed
  24. {
  25. }
  26. DOUBLEQUOTESTABBED . <<<HEREDOCPHP73
  27. class FailHeredocPHP73
  28. {
  29. }
  30. HEREDOCPHP73;
  31. }
  32. public function test_nowdoc()
  33. {
  34. return <<<'NOWDOC'
  35. class FailNowdocBasic
  36. {
  37. }
  38. NOWDOC . <<< 'WHITESPACE'
  39. class FailNowdocWhitespace
  40. {
  41. }
  42. WHITESPACE . <<< 'NOWDOCTABBED'
  43. class FailNowdocTabbed
  44. {
  45. }
  46. NOWDOCTABBED . <<<'NOWDOCPHP73'
  47. class FailNowdocPHP73
  48. {
  49. }
  50. NOWDOCPHP73;
  51. }
  52. public function test_followed_by_parentheses()
  53. {
  54. return array(<<<PARENTHESES
  55. class FailParentheses
  56. {
  57. }
  58. PARENTHESES);
  59. }
  60. public function test_followed_by_comma()
  61. {
  62. return array(1, 2, <<<COMMA
  63. class FailComma
  64. {
  65. }
  66. COMMA, 3, 4);
  67. }
  68. public function test_followed_by_period()
  69. {
  70. return <<<PERIOD
  71. class FailPeriod
  72. {
  73. }
  74. PERIOD.'?>';
  75. }
  76. public function test_simple_string()
  77. {
  78. return 'class FailSimpleString {}';
  79. }
  80. }