modifier.test 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. Invalid modifier combination
  2. -----
  3. <?php class A { public public $a; }
  4. -----
  5. Multiple access type modifiers are not allowed from 1:24 to 1:29
  6. array(
  7. 0: Stmt_Class(
  8. flags: 0
  9. name: Identifier(
  10. name: A
  11. )
  12. extends: null
  13. implements: array(
  14. )
  15. stmts: array(
  16. 0: Stmt_Property(
  17. flags: MODIFIER_PUBLIC (1)
  18. type: null
  19. props: array(
  20. 0: Stmt_PropertyProperty(
  21. name: VarLikeIdentifier(
  22. name: a
  23. )
  24. default: null
  25. )
  26. )
  27. )
  28. )
  29. )
  30. )
  31. -----
  32. <?php class A { public protected $a; }
  33. -----
  34. Multiple access type modifiers are not allowed from 1:24 to 1:32
  35. array(
  36. 0: Stmt_Class(
  37. flags: 0
  38. name: Identifier(
  39. name: A
  40. )
  41. extends: null
  42. implements: array(
  43. )
  44. stmts: array(
  45. 0: Stmt_Property(
  46. flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
  47. type: null
  48. props: array(
  49. 0: Stmt_PropertyProperty(
  50. name: VarLikeIdentifier(
  51. name: a
  52. )
  53. default: null
  54. )
  55. )
  56. )
  57. )
  58. )
  59. )
  60. -----
  61. <?php class A { abstract abstract function a(); }
  62. -----
  63. Multiple abstract modifiers are not allowed from 1:26 to 1:33
  64. array(
  65. 0: Stmt_Class(
  66. flags: 0
  67. name: Identifier(
  68. name: A
  69. )
  70. extends: null
  71. implements: array(
  72. )
  73. stmts: array(
  74. 0: Stmt_ClassMethod(
  75. flags: MODIFIER_ABSTRACT (16)
  76. byRef: false
  77. name: Identifier(
  78. name: a
  79. )
  80. params: array(
  81. )
  82. returnType: null
  83. stmts: null
  84. )
  85. )
  86. )
  87. )
  88. -----
  89. <?php class A { static static $a; }
  90. -----
  91. Multiple static modifiers are not allowed from 1:24 to 1:29
  92. array(
  93. 0: Stmt_Class(
  94. flags: 0
  95. name: Identifier(
  96. name: A
  97. )
  98. extends: null
  99. implements: array(
  100. )
  101. stmts: array(
  102. 0: Stmt_Property(
  103. flags: MODIFIER_STATIC (8)
  104. type: null
  105. props: array(
  106. 0: Stmt_PropertyProperty(
  107. name: VarLikeIdentifier(
  108. name: a
  109. )
  110. default: null
  111. )
  112. )
  113. )
  114. )
  115. )
  116. )
  117. -----
  118. <?php class A { final final function a() {} }
  119. -----
  120. Multiple final modifiers are not allowed from 1:23 to 1:27
  121. array(
  122. 0: Stmt_Class(
  123. flags: 0
  124. name: Identifier(
  125. name: A
  126. )
  127. extends: null
  128. implements: array(
  129. )
  130. stmts: array(
  131. 0: Stmt_ClassMethod(
  132. flags: MODIFIER_FINAL (32)
  133. byRef: false
  134. name: Identifier(
  135. name: a
  136. )
  137. params: array(
  138. )
  139. returnType: null
  140. stmts: array(
  141. )
  142. )
  143. )
  144. )
  145. )
  146. -----
  147. <?php class A { abstract final function a(); }
  148. -----
  149. Cannot use the final modifier on an abstract class member from 1:26 to 1:30
  150. array(
  151. 0: Stmt_Class(
  152. flags: 0
  153. name: Identifier(
  154. name: A
  155. )
  156. extends: null
  157. implements: array(
  158. )
  159. stmts: array(
  160. 0: Stmt_ClassMethod(
  161. flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
  162. byRef: false
  163. name: Identifier(
  164. name: a
  165. )
  166. params: array(
  167. )
  168. returnType: null
  169. stmts: null
  170. )
  171. )
  172. )
  173. )
  174. -----
  175. <?php abstract final class A { }
  176. // Type in the partial parse could conceivably be any of 0, 16 or 32
  177. -----
  178. Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
  179. array(
  180. 0: Stmt_Class(
  181. flags: MODIFIER_FINAL (32)
  182. name: Identifier(
  183. name: A
  184. )
  185. extends: null
  186. implements: array(
  187. )
  188. stmts: array(
  189. )
  190. )
  191. 1: Stmt_Nop(
  192. comments: array(
  193. 0: // Type in the partial parse could conceivably be any of 0, 16 or 32
  194. )
  195. )
  196. )
  197. -----
  198. <?php class A { abstract $a; }
  199. -----
  200. Properties cannot be declared abstract from 1:17 to 1:24
  201. array(
  202. 0: Stmt_Class(
  203. flags: 0
  204. name: Identifier(
  205. name: A
  206. )
  207. extends: null
  208. implements: array(
  209. )
  210. stmts: array(
  211. 0: Stmt_Property(
  212. flags: MODIFIER_ABSTRACT (16)
  213. type: null
  214. props: array(
  215. 0: Stmt_PropertyProperty(
  216. name: VarLikeIdentifier(
  217. name: a
  218. )
  219. default: null
  220. )
  221. )
  222. )
  223. )
  224. )
  225. )
  226. -----
  227. <?php class A { final $a; }
  228. -----
  229. Properties cannot be declared final from 1:17 to 1:21
  230. array(
  231. 0: Stmt_Class(
  232. flags: 0
  233. name: Identifier(
  234. name: A
  235. )
  236. extends: null
  237. implements: array(
  238. )
  239. stmts: array(
  240. 0: Stmt_Property(
  241. flags: MODIFIER_FINAL (32)
  242. type: null
  243. props: array(
  244. 0: Stmt_PropertyProperty(
  245. name: VarLikeIdentifier(
  246. name: a
  247. )
  248. default: null
  249. )
  250. )
  251. )
  252. )
  253. )
  254. )