菜谱项目

trait.test 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. Traits
  2. -----
  3. <?php
  4. trait A {
  5. public function a() {}
  6. }
  7. class B {
  8. use C;
  9. use D {
  10. a as protected b;
  11. c as d;
  12. e as private;
  13. }
  14. use E, F, G {
  15. E::a insteadof F, G;
  16. E::b as protected c;
  17. E::d as e;
  18. E::f as private;
  19. }
  20. }
  21. -----
  22. array(
  23. 0: Stmt_Trait(
  24. name: A
  25. stmts: array(
  26. 0: Stmt_ClassMethod(
  27. flags: MODIFIER_PUBLIC (1)
  28. byRef: false
  29. name: a
  30. params: array(
  31. )
  32. returnType: null
  33. stmts: array(
  34. )
  35. )
  36. )
  37. )
  38. 1: Stmt_Class(
  39. flags: 0
  40. name: B
  41. extends: null
  42. implements: array(
  43. )
  44. stmts: array(
  45. 0: Stmt_TraitUse(
  46. traits: array(
  47. 0: Name(
  48. parts: array(
  49. 0: C
  50. )
  51. )
  52. )
  53. adaptations: array(
  54. )
  55. )
  56. 1: Stmt_TraitUse(
  57. traits: array(
  58. 0: Name(
  59. parts: array(
  60. 0: D
  61. )
  62. )
  63. )
  64. adaptations: array(
  65. 0: Stmt_TraitUseAdaptation_Alias(
  66. trait: null
  67. method: a
  68. newModifier: MODIFIER_PROTECTED (2)
  69. newName: b
  70. )
  71. 1: Stmt_TraitUseAdaptation_Alias(
  72. trait: null
  73. method: c
  74. newModifier: null
  75. newName: d
  76. )
  77. 2: Stmt_TraitUseAdaptation_Alias(
  78. trait: null
  79. method: e
  80. newModifier: MODIFIER_PRIVATE (4)
  81. newName: null
  82. )
  83. )
  84. )
  85. 2: Stmt_TraitUse(
  86. traits: array(
  87. 0: Name(
  88. parts: array(
  89. 0: E
  90. )
  91. )
  92. 1: Name(
  93. parts: array(
  94. 0: F
  95. )
  96. )
  97. 2: Name(
  98. parts: array(
  99. 0: G
  100. )
  101. )
  102. )
  103. adaptations: array(
  104. 0: Stmt_TraitUseAdaptation_Precedence(
  105. trait: Name(
  106. parts: array(
  107. 0: E
  108. )
  109. )
  110. method: a
  111. insteadof: array(
  112. 0: Name(
  113. parts: array(
  114. 0: F
  115. )
  116. )
  117. 1: Name(
  118. parts: array(
  119. 0: G
  120. )
  121. )
  122. )
  123. )
  124. 1: Stmt_TraitUseAdaptation_Alias(
  125. trait: Name(
  126. parts: array(
  127. 0: E
  128. )
  129. )
  130. method: b
  131. newModifier: MODIFIER_PROTECTED (2)
  132. newName: c
  133. )
  134. 2: Stmt_TraitUseAdaptation_Alias(
  135. trait: Name(
  136. parts: array(
  137. 0: E
  138. )
  139. )
  140. method: d
  141. newModifier: null
  142. newName: e
  143. )
  144. 3: Stmt_TraitUseAdaptation_Alias(
  145. trait: Name(
  146. parts: array(
  147. 0: E
  148. )
  149. )
  150. method: f
  151. newModifier: MODIFIER_PRIVATE (4)
  152. newName: null
  153. )
  154. )
  155. )
  156. )
  157. )
  158. )