closure.test 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. Closures
  2. -----
  3. <?php
  4. function($a) { $a; };
  5. function($a) use($b) {};
  6. function() use($a, &$b) {};
  7. function &($a) {};
  8. static function() {};
  9. function($a) : array {};
  10. function() use($a) : \Foo\Bar {};
  11. -----
  12. array(
  13. 0: Stmt_Expression(
  14. expr: Expr_Closure(
  15. static: false
  16. byRef: false
  17. params: array(
  18. 0: Param(
  19. type: null
  20. byRef: false
  21. variadic: false
  22. var: Expr_Variable(
  23. name: a
  24. )
  25. default: null
  26. )
  27. )
  28. uses: array(
  29. )
  30. returnType: null
  31. stmts: array(
  32. 0: Stmt_Expression(
  33. expr: Expr_Variable(
  34. name: a
  35. )
  36. )
  37. )
  38. )
  39. )
  40. 1: Stmt_Expression(
  41. expr: Expr_Closure(
  42. static: false
  43. byRef: false
  44. params: array(
  45. 0: Param(
  46. type: null
  47. byRef: false
  48. variadic: false
  49. var: Expr_Variable(
  50. name: a
  51. )
  52. default: null
  53. )
  54. )
  55. uses: array(
  56. 0: Expr_ClosureUse(
  57. var: Expr_Variable(
  58. name: b
  59. )
  60. byRef: false
  61. )
  62. )
  63. returnType: null
  64. stmts: array(
  65. )
  66. )
  67. )
  68. 2: Stmt_Expression(
  69. expr: Expr_Closure(
  70. static: false
  71. byRef: false
  72. params: array(
  73. )
  74. uses: array(
  75. 0: Expr_ClosureUse(
  76. var: Expr_Variable(
  77. name: a
  78. )
  79. byRef: false
  80. )
  81. 1: Expr_ClosureUse(
  82. var: Expr_Variable(
  83. name: b
  84. )
  85. byRef: true
  86. )
  87. )
  88. returnType: null
  89. stmts: array(
  90. )
  91. )
  92. )
  93. 3: Stmt_Expression(
  94. expr: Expr_Closure(
  95. static: false
  96. byRef: true
  97. params: array(
  98. 0: Param(
  99. type: null
  100. byRef: false
  101. variadic: false
  102. var: Expr_Variable(
  103. name: a
  104. )
  105. default: null
  106. )
  107. )
  108. uses: array(
  109. )
  110. returnType: null
  111. stmts: array(
  112. )
  113. )
  114. )
  115. 4: Stmt_Expression(
  116. expr: Expr_Closure(
  117. static: true
  118. byRef: false
  119. params: array(
  120. )
  121. uses: array(
  122. )
  123. returnType: null
  124. stmts: array(
  125. )
  126. )
  127. )
  128. 5: Stmt_Expression(
  129. expr: Expr_Closure(
  130. static: false
  131. byRef: false
  132. params: array(
  133. 0: Param(
  134. type: null
  135. byRef: false
  136. variadic: false
  137. var: Expr_Variable(
  138. name: a
  139. )
  140. default: null
  141. )
  142. )
  143. uses: array(
  144. )
  145. returnType: Identifier(
  146. name: array
  147. )
  148. stmts: array(
  149. )
  150. )
  151. )
  152. 6: Stmt_Expression(
  153. expr: Expr_Closure(
  154. static: false
  155. byRef: false
  156. params: array(
  157. )
  158. uses: array(
  159. 0: Expr_ClosureUse(
  160. var: Expr_Variable(
  161. name: a
  162. )
  163. byRef: false
  164. )
  165. )
  166. returnType: Name_FullyQualified(
  167. parts: array(
  168. 0: Foo
  169. 1: Bar
  170. )
  171. )
  172. stmts: array(
  173. )
  174. )
  175. )
  176. )