flexibleDocStringErrors.test 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Error conditions for flexible doc strings
  2. -----
  3. <?php
  4. <<<A
  5. @@{ "\t" }@@A;
  6. <<<A
  7. FooBar
  8. @@{ "\t" }@@A;
  9. echo <<<END
  10. @@{ "\t" }@@ X
  11. @@{ "\t\t" }@@END;
  12. echo <<<END
  13. a
  14. b
  15. c
  16. END;
  17. <<<END
  18. \ta
  19. @@{ "\t" }@@END;
  20. <<<TEST
  21. Foo
  22. $var
  23. TEST;
  24. <<<TEST
  25. $var
  26. TEST;
  27. echo <<<END
  28. a
  29. $a
  30. END;
  31. -----
  32. Invalid indentation - tabs and spaces cannot be mixed from 4:1 to 4:3
  33. Invalid indentation - tabs and spaces cannot be mixed from 8:1 to 8:3
  34. Invalid indentation - tabs and spaces cannot be mixed from 10:6 to 12:5
  35. Invalid body indentation level (expecting an indentation level of at least 5) from 14:6 to 18:8
  36. Invalid body indentation level (expecting an indentation level of at least 1) from 20:1 to 22:4
  37. Invalid body indentation level (expecting an indentation level of at least 2) from 25:1 to 26:0
  38. Invalid body indentation level (expecting an indentation level of at least 1) from 30:1 to 30:4
  39. Invalid body indentation level (expecting an indentation level of at least 1) from 34:1 to 35:0
  40. array(
  41. 0: Stmt_Expression(
  42. expr: Scalar_String(
  43. value:
  44. )
  45. )
  46. 1: Stmt_Expression(
  47. expr: Scalar_String(
  48. value: FooBar
  49. )
  50. )
  51. 2: Stmt_Echo(
  52. exprs: array(
  53. 0: Scalar_String(
  54. value: X
  55. )
  56. )
  57. )
  58. 3: Stmt_Echo(
  59. exprs: array(
  60. 0: Scalar_String(
  61. value: a
  62. b
  63. c
  64. )
  65. )
  66. )
  67. 4: Stmt_Expression(
  68. expr: Scalar_String(
  69. value: a
  70. )
  71. )
  72. 5: Stmt_Expression(
  73. expr: Scalar_Encapsed(
  74. parts: array(
  75. 0: Scalar_EncapsedStringPart(
  76. value: Foo
  77. )
  78. 1: Expr_Variable(
  79. name: var
  80. )
  81. )
  82. )
  83. )
  84. 6: Stmt_Expression(
  85. expr: Scalar_Encapsed(
  86. parts: array(
  87. 0: Expr_Variable(
  88. name: var
  89. )
  90. )
  91. )
  92. )
  93. 7: Stmt_Echo(
  94. exprs: array(
  95. 0: Scalar_Encapsed(
  96. parts: array(
  97. 0: Scalar_EncapsedStringPart(
  98. value: a
  99. )
  100. 1: Expr_Variable(
  101. name: a
  102. )
  103. )
  104. )
  105. )
  106. )
  107. )