closure.test 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. attrGroups: array(
  16. )
  17. static: false
  18. byRef: false
  19. params: array(
  20. 0: Param(
  21. attrGroups: array(
  22. )
  23. flags: 0
  24. type: null
  25. byRef: false
  26. variadic: false
  27. var: Expr_Variable(
  28. name: a
  29. )
  30. default: null
  31. )
  32. )
  33. uses: array(
  34. )
  35. returnType: null
  36. stmts: array(
  37. 0: Stmt_Expression(
  38. expr: Expr_Variable(
  39. name: a
  40. )
  41. )
  42. )
  43. )
  44. )
  45. 1: Stmt_Expression(
  46. expr: Expr_Closure(
  47. attrGroups: array(
  48. )
  49. static: false
  50. byRef: false
  51. params: array(
  52. 0: Param(
  53. attrGroups: array(
  54. )
  55. flags: 0
  56. type: null
  57. byRef: false
  58. variadic: false
  59. var: Expr_Variable(
  60. name: a
  61. )
  62. default: null
  63. )
  64. )
  65. uses: array(
  66. 0: Expr_ClosureUse(
  67. var: Expr_Variable(
  68. name: b
  69. )
  70. byRef: false
  71. )
  72. )
  73. returnType: null
  74. stmts: array(
  75. )
  76. )
  77. )
  78. 2: Stmt_Expression(
  79. expr: Expr_Closure(
  80. attrGroups: array(
  81. )
  82. static: false
  83. byRef: false
  84. params: array(
  85. )
  86. uses: array(
  87. 0: Expr_ClosureUse(
  88. var: Expr_Variable(
  89. name: a
  90. )
  91. byRef: false
  92. )
  93. 1: Expr_ClosureUse(
  94. var: Expr_Variable(
  95. name: b
  96. )
  97. byRef: true
  98. )
  99. )
  100. returnType: null
  101. stmts: array(
  102. )
  103. )
  104. )
  105. 3: Stmt_Expression(
  106. expr: Expr_Closure(
  107. attrGroups: array(
  108. )
  109. static: false
  110. byRef: true
  111. params: array(
  112. 0: Param(
  113. attrGroups: array(
  114. )
  115. flags: 0
  116. type: null
  117. byRef: false
  118. variadic: false
  119. var: Expr_Variable(
  120. name: a
  121. )
  122. default: null
  123. )
  124. )
  125. uses: array(
  126. )
  127. returnType: null
  128. stmts: array(
  129. )
  130. )
  131. )
  132. 4: Stmt_Expression(
  133. expr: Expr_Closure(
  134. attrGroups: array(
  135. )
  136. static: true
  137. byRef: false
  138. params: array(
  139. )
  140. uses: array(
  141. )
  142. returnType: null
  143. stmts: array(
  144. )
  145. )
  146. )
  147. 5: Stmt_Expression(
  148. expr: Expr_Closure(
  149. attrGroups: array(
  150. )
  151. static: false
  152. byRef: false
  153. params: array(
  154. 0: Param(
  155. attrGroups: array(
  156. )
  157. flags: 0
  158. type: null
  159. byRef: false
  160. variadic: false
  161. var: Expr_Variable(
  162. name: a
  163. )
  164. default: null
  165. )
  166. )
  167. uses: array(
  168. )
  169. returnType: Identifier(
  170. name: array
  171. )
  172. stmts: array(
  173. )
  174. )
  175. )
  176. 6: Stmt_Expression(
  177. expr: Expr_Closure(
  178. attrGroups: array(
  179. )
  180. static: false
  181. byRef: false
  182. params: array(
  183. )
  184. uses: array(
  185. 0: Expr_ClosureUse(
  186. var: Expr_Variable(
  187. name: a
  188. )
  189. byRef: false
  190. )
  191. )
  192. returnType: Name_FullyQualified(
  193. parts: array(
  194. 0: Foo
  195. 1: Bar
  196. )
  197. )
  198. stmts: array(
  199. )
  200. )
  201. )
  202. )