菜谱项目

closure.test 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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: Expr_Closure(
  14. static: false
  15. byRef: false
  16. params: array(
  17. 0: Param(
  18. type: null
  19. byRef: false
  20. variadic: false
  21. name: a
  22. default: null
  23. )
  24. )
  25. uses: array(
  26. )
  27. returnType: null
  28. stmts: array(
  29. 0: Expr_Variable(
  30. name: a
  31. )
  32. )
  33. )
  34. 1: Expr_Closure(
  35. static: false
  36. byRef: false
  37. params: array(
  38. 0: Param(
  39. type: null
  40. byRef: false
  41. variadic: false
  42. name: a
  43. default: null
  44. )
  45. )
  46. uses: array(
  47. 0: Expr_ClosureUse(
  48. var: b
  49. byRef: false
  50. )
  51. )
  52. returnType: null
  53. stmts: array(
  54. )
  55. )
  56. 2: Expr_Closure(
  57. static: false
  58. byRef: false
  59. params: array(
  60. )
  61. uses: array(
  62. 0: Expr_ClosureUse(
  63. var: a
  64. byRef: false
  65. )
  66. 1: Expr_ClosureUse(
  67. var: b
  68. byRef: true
  69. )
  70. )
  71. returnType: null
  72. stmts: array(
  73. )
  74. )
  75. 3: Expr_Closure(
  76. static: false
  77. byRef: true
  78. params: array(
  79. 0: Param(
  80. type: null
  81. byRef: false
  82. variadic: false
  83. name: a
  84. default: null
  85. )
  86. )
  87. uses: array(
  88. )
  89. returnType: null
  90. stmts: array(
  91. )
  92. )
  93. 4: Expr_Closure(
  94. static: true
  95. byRef: false
  96. params: array(
  97. )
  98. uses: array(
  99. )
  100. returnType: null
  101. stmts: array(
  102. )
  103. )
  104. 5: Expr_Closure(
  105. static: false
  106. byRef: false
  107. params: array(
  108. 0: Param(
  109. type: null
  110. byRef: false
  111. variadic: false
  112. name: a
  113. default: null
  114. )
  115. )
  116. uses: array(
  117. )
  118. returnType: array
  119. stmts: array(
  120. )
  121. )
  122. 6: Expr_Closure(
  123. static: false
  124. byRef: false
  125. params: array(
  126. )
  127. uses: array(
  128. 0: Expr_ClosureUse(
  129. var: a
  130. byRef: false
  131. )
  132. )
  133. returnType: Name_FullyQualified(
  134. parts: array(
  135. 0: Foo
  136. 1: Bar
  137. )
  138. )
  139. stmts: array(
  140. )
  141. )
  142. )