alias.test 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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: UseItem(
  21. type: TYPE_UNKNOWN (0)
  22. name: Name(
  23. name: A\B
  24. )
  25. alias: null
  26. )
  27. )
  28. )
  29. 1: Stmt_Use(
  30. type: TYPE_NORMAL (1)
  31. uses: array(
  32. 0: UseItem(
  33. type: TYPE_UNKNOWN (0)
  34. name: Name(
  35. name: C\D
  36. )
  37. alias: Identifier(
  38. name: E
  39. )
  40. )
  41. )
  42. )
  43. 2: Stmt_Use(
  44. type: TYPE_NORMAL (1)
  45. uses: array(
  46. 0: UseItem(
  47. type: TYPE_UNKNOWN (0)
  48. name: Name(
  49. name: F\G
  50. )
  51. alias: Identifier(
  52. name: H
  53. )
  54. )
  55. 1: UseItem(
  56. type: TYPE_UNKNOWN (0)
  57. name: Name(
  58. name: J
  59. )
  60. alias: null
  61. )
  62. )
  63. )
  64. 3: Stmt_Use(
  65. type: TYPE_NORMAL (1)
  66. uses: array(
  67. 0: UseItem(
  68. type: TYPE_UNKNOWN (0)
  69. name: Name(
  70. name: A
  71. )
  72. alias: null
  73. )
  74. )
  75. comments: array(
  76. 0: // evil alias notation - Do Not Use!
  77. )
  78. )
  79. 4: Stmt_Use(
  80. type: TYPE_NORMAL (1)
  81. uses: array(
  82. 0: UseItem(
  83. type: TYPE_UNKNOWN (0)
  84. name: Name(
  85. name: A
  86. )
  87. alias: Identifier(
  88. name: B
  89. )
  90. )
  91. )
  92. )
  93. 5: Stmt_Use(
  94. type: TYPE_FUNCTION (2)
  95. uses: array(
  96. 0: UseItem(
  97. type: TYPE_UNKNOWN (0)
  98. name: Name(
  99. name: foo\bar
  100. )
  101. alias: null
  102. )
  103. )
  104. comments: array(
  105. 0: // function and constant aliases
  106. )
  107. )
  108. 6: Stmt_Use(
  109. type: TYPE_FUNCTION (2)
  110. uses: array(
  111. 0: UseItem(
  112. type: TYPE_UNKNOWN (0)
  113. name: Name(
  114. name: foo\bar
  115. )
  116. alias: Identifier(
  117. name: baz
  118. )
  119. )
  120. )
  121. )
  122. 7: Stmt_Use(
  123. type: TYPE_CONSTANT (3)
  124. uses: array(
  125. 0: UseItem(
  126. type: TYPE_UNKNOWN (0)
  127. name: Name(
  128. name: foo\BAR
  129. )
  130. alias: null
  131. )
  132. )
  133. )
  134. 8: Stmt_Use(
  135. type: TYPE_CONSTANT (3)
  136. uses: array(
  137. 0: UseItem(
  138. type: TYPE_UNKNOWN (0)
  139. name: Name(
  140. name: foo\BAR
  141. )
  142. alias: Identifier(
  143. name: BAZ
  144. )
  145. )
  146. )
  147. )
  148. )