comments.test 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. Comments
  2. -----
  3. <?php
  4. /** doc 1 */
  5. /* foobar 1 */
  6. // foo 1
  7. // bar 1
  8. $var;
  9. if ($cond) {
  10. /** doc 2 */
  11. /* foobar 2 */
  12. // foo 2
  13. // bar 2
  14. }
  15. /** doc 3 */
  16. /* foobar 3 */
  17. // foo 3
  18. // bar 3
  19. -----
  20. array(
  21. 0: Stmt_Expression(
  22. expr: Expr_Variable(
  23. name: var
  24. )
  25. comments: array(
  26. 0: /** doc 1 */
  27. 1: /* foobar 1 */
  28. 2: // foo 1
  29. 3: // bar 1
  30. )
  31. )
  32. 1: Stmt_If(
  33. cond: Expr_Variable(
  34. name: cond
  35. )
  36. stmts: array(
  37. 0: Stmt_Nop(
  38. comments: array(
  39. 0: /** doc 2 */
  40. 1: /* foobar 2 */
  41. 2: // foo 2
  42. 3: // bar 2
  43. )
  44. )
  45. )
  46. elseifs: array(
  47. )
  48. else: null
  49. )
  50. 2: Stmt_Nop(
  51. comments: array(
  52. 0: /** doc 3 */
  53. 1: /* foobar 3 */
  54. 2: // foo 3
  55. 3: // bar 3
  56. )
  57. )
  58. )
  59. -----
  60. <?php
  61. /** doc */
  62. /* foobar */
  63. // foo
  64. // bar
  65. ?>
  66. -----
  67. array(
  68. 0: Stmt_Nop(
  69. comments: array(
  70. 0: /** doc */
  71. 1: /* foobar */
  72. 2: // foo
  73. 3: // bar
  74. )
  75. )
  76. )
  77. -----
  78. <?php
  79. // comment
  80. if (42) {}
  81. -----
  82. array(
  83. 0: Stmt_If(
  84. cond: Scalar_Int(
  85. value: 42
  86. )
  87. stmts: array(
  88. )
  89. elseifs: array(
  90. )
  91. else: null
  92. comments: array(
  93. 0: // comment
  94. )
  95. )
  96. )