alias.test 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. Aliases (use)
  2. -----
  3. <?php
  4. use A\B;
  5. use C\D as E;
  6. use F\G as H, J;
  7. // evil alias notation - Do Not Use!
  8. use \A;
  9. use \A as B;
  10. // function and constant aliases
  11. use function foo\bar;
  12. use function foo\bar as baz;
  13. use const foo\BAR;
  14. use const foo\BAR as BAZ;
  15. -----
  16. array(
  17. 0: Stmt_Use(
  18. type: TYPE_NORMAL (1)
  19. uses: array(
  20. 0: Stmt_UseUse(
  21. type: TYPE_UNKNOWN (0)
  22. name: Name(
  23. parts: array(
  24. 0: A
  25. 1: B
  26. )
  27. )
  28. alias: null
  29. )
  30. )
  31. )
  32. 1: Stmt_Use(
  33. type: TYPE_NORMAL (1)
  34. uses: array(
  35. 0: Stmt_UseUse(
  36. type: TYPE_UNKNOWN (0)
  37. name: Name(
  38. parts: array(
  39. 0: C
  40. 1: D
  41. )
  42. )
  43. alias: Identifier(
  44. name: E
  45. )
  46. )
  47. )
  48. )
  49. 2: Stmt_Use(
  50. type: TYPE_NORMAL (1)
  51. uses: array(
  52. 0: Stmt_UseUse(
  53. type: TYPE_UNKNOWN (0)
  54. name: Name(
  55. parts: array(
  56. 0: F
  57. 1: G
  58. )
  59. )
  60. alias: Identifier(
  61. name: H
  62. )
  63. )
  64. 1: Stmt_UseUse(
  65. type: TYPE_UNKNOWN (0)
  66. name: Name(
  67. parts: array(
  68. 0: J
  69. )
  70. )
  71. alias: null
  72. )
  73. )
  74. )
  75. 3: Stmt_Use(
  76. type: TYPE_NORMAL (1)
  77. uses: array(
  78. 0: Stmt_UseUse(
  79. type: TYPE_UNKNOWN (0)
  80. name: Name(
  81. parts: array(
  82. 0: A
  83. )
  84. )
  85. alias: null
  86. )
  87. )
  88. comments: array(
  89. 0: // evil alias notation - Do Not Use!
  90. )
  91. )
  92. 4: Stmt_Use(
  93. type: TYPE_NORMAL (1)
  94. uses: array(
  95. 0: Stmt_UseUse(
  96. type: TYPE_UNKNOWN (0)
  97. name: Name(
  98. parts: array(
  99. 0: A
  100. )
  101. )
  102. alias: Identifier(
  103. name: B
  104. )
  105. )
  106. )
  107. )
  108. 5: Stmt_Use(
  109. type: TYPE_FUNCTION (2)
  110. uses: array(
  111. 0: Stmt_UseUse(
  112. type: TYPE_UNKNOWN (0)
  113. name: Name(
  114. parts: array(
  115. 0: foo
  116. 1: bar
  117. )
  118. )
  119. alias: null
  120. )
  121. )
  122. comments: array(
  123. 0: // function and constant aliases
  124. )
  125. )
  126. 6: Stmt_Use(
  127. type: TYPE_FUNCTION (2)
  128. uses: array(
  129. 0: Stmt_UseUse(
  130. type: TYPE_UNKNOWN (0)
  131. name: Name(
  132. parts: array(
  133. 0: foo
  134. 1: bar
  135. )
  136. )
  137. alias: Identifier(
  138. name: baz
  139. )
  140. )
  141. )
  142. )
  143. 7: Stmt_Use(
  144. type: TYPE_CONSTANT (3)
  145. uses: array(
  146. 0: Stmt_UseUse(
  147. type: TYPE_UNKNOWN (0)
  148. name: Name(
  149. parts: array(
  150. 0: foo
  151. 1: BAR
  152. )
  153. )
  154. alias: null
  155. )
  156. )
  157. )
  158. 8: Stmt_Use(
  159. type: TYPE_CONSTANT (3)
  160. uses: array(
  161. 0: Stmt_UseUse(
  162. type: TYPE_UNKNOWN (0)
  163. name: Name(
  164. parts: array(
  165. 0: foo
  166. 1: BAR
  167. )
  168. )
  169. alias: Identifier(
  170. name: BAZ
  171. )
  172. )
  173. )
  174. )
  175. )