modifier.test 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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. attrGroups: array(
  9. )
  10. flags: 0
  11. name: Identifier(
  12. name: A
  13. )
  14. extends: null
  15. implements: array(
  16. )
  17. stmts: array(
  18. 0: Stmt_Property(
  19. attrGroups: array(
  20. )
  21. flags: PUBLIC (1)
  22. type: null
  23. props: array(
  24. 0: PropertyItem(
  25. name: VarLikeIdentifier(
  26. name: a
  27. )
  28. default: null
  29. )
  30. )
  31. )
  32. )
  33. )
  34. )
  35. -----
  36. <?php class A { public protected $a; }
  37. -----
  38. Multiple access type modifiers are not allowed from 1:24 to 1:32
  39. array(
  40. 0: Stmt_Class(
  41. attrGroups: array(
  42. )
  43. flags: 0
  44. name: Identifier(
  45. name: A
  46. )
  47. extends: null
  48. implements: array(
  49. )
  50. stmts: array(
  51. 0: Stmt_Property(
  52. attrGroups: array(
  53. )
  54. flags: PUBLIC | PROTECTED (3)
  55. type: null
  56. props: array(
  57. 0: PropertyItem(
  58. name: VarLikeIdentifier(
  59. name: a
  60. )
  61. default: null
  62. )
  63. )
  64. )
  65. )
  66. )
  67. )
  68. -----
  69. <?php class C { readonly readonly $a; }
  70. -----
  71. Multiple readonly modifiers are not allowed from 1:26 to 1:33
  72. array(
  73. 0: Stmt_Class(
  74. attrGroups: array(
  75. )
  76. flags: 0
  77. name: Identifier(
  78. name: C
  79. )
  80. extends: null
  81. implements: array(
  82. )
  83. stmts: array(
  84. 0: Stmt_Property(
  85. attrGroups: array(
  86. )
  87. flags: READONLY (64)
  88. type: null
  89. props: array(
  90. 0: PropertyItem(
  91. name: VarLikeIdentifier(
  92. name: a
  93. )
  94. default: null
  95. )
  96. )
  97. )
  98. )
  99. )
  100. )
  101. -----
  102. <?php class A { abstract abstract function a(); }
  103. -----
  104. Multiple abstract modifiers are not allowed from 1:26 to 1:33
  105. array(
  106. 0: Stmt_Class(
  107. attrGroups: array(
  108. )
  109. flags: 0
  110. name: Identifier(
  111. name: A
  112. )
  113. extends: null
  114. implements: array(
  115. )
  116. stmts: array(
  117. 0: Stmt_ClassMethod(
  118. attrGroups: array(
  119. )
  120. flags: ABSTRACT (16)
  121. byRef: false
  122. name: Identifier(
  123. name: a
  124. )
  125. params: array(
  126. )
  127. returnType: null
  128. stmts: null
  129. )
  130. )
  131. )
  132. )
  133. -----
  134. <?php class A { static static $a; }
  135. -----
  136. Multiple static modifiers are not allowed from 1:24 to 1:29
  137. array(
  138. 0: Stmt_Class(
  139. attrGroups: array(
  140. )
  141. flags: 0
  142. name: Identifier(
  143. name: A
  144. )
  145. extends: null
  146. implements: array(
  147. )
  148. stmts: array(
  149. 0: Stmt_Property(
  150. attrGroups: array(
  151. )
  152. flags: STATIC (8)
  153. type: null
  154. props: array(
  155. 0: PropertyItem(
  156. name: VarLikeIdentifier(
  157. name: a
  158. )
  159. default: null
  160. )
  161. )
  162. )
  163. )
  164. )
  165. )
  166. -----
  167. <?php class A { final final function a() {} }
  168. -----
  169. Multiple final modifiers are not allowed from 1:23 to 1:27
  170. array(
  171. 0: Stmt_Class(
  172. attrGroups: array(
  173. )
  174. flags: 0
  175. name: Identifier(
  176. name: A
  177. )
  178. extends: null
  179. implements: array(
  180. )
  181. stmts: array(
  182. 0: Stmt_ClassMethod(
  183. attrGroups: array(
  184. )
  185. flags: FINAL (32)
  186. byRef: false
  187. name: Identifier(
  188. name: a
  189. )
  190. params: array(
  191. )
  192. returnType: null
  193. stmts: array(
  194. )
  195. )
  196. )
  197. )
  198. )
  199. -----
  200. <?php class A { abstract final function a(); }
  201. -----
  202. Cannot use the final modifier on an abstract class member from 1:26 to 1:30
  203. array(
  204. 0: Stmt_Class(
  205. attrGroups: array(
  206. )
  207. flags: 0
  208. name: Identifier(
  209. name: A
  210. )
  211. extends: null
  212. implements: array(
  213. )
  214. stmts: array(
  215. 0: Stmt_ClassMethod(
  216. attrGroups: array(
  217. )
  218. flags: ABSTRACT | FINAL (48)
  219. byRef: false
  220. name: Identifier(
  221. name: a
  222. )
  223. params: array(
  224. )
  225. returnType: null
  226. stmts: null
  227. )
  228. )
  229. )
  230. )
  231. -----
  232. <?php abstract final class A { }
  233. -----
  234. Cannot use the final modifier on an abstract class from 1:16 to 1:20
  235. array(
  236. 0: Stmt_Class(
  237. attrGroups: array(
  238. )
  239. flags: ABSTRACT | FINAL (48)
  240. name: Identifier(
  241. name: A
  242. )
  243. extends: null
  244. implements: array(
  245. )
  246. stmts: array(
  247. )
  248. )
  249. )
  250. -----
  251. <?php class B { abstract $b; }
  252. -----
  253. Properties cannot be declared abstract from 1:17 to 1:24
  254. array(
  255. 0: Stmt_Class(
  256. attrGroups: array(
  257. )
  258. flags: 0
  259. name: Identifier(
  260. name: B
  261. )
  262. extends: null
  263. implements: array(
  264. )
  265. stmts: array(
  266. 0: Stmt_Property(
  267. attrGroups: array(
  268. )
  269. flags: ABSTRACT (16)
  270. type: null
  271. props: array(
  272. 0: PropertyItem(
  273. name: VarLikeIdentifier(
  274. name: b
  275. )
  276. default: null
  277. )
  278. )
  279. )
  280. )
  281. )
  282. )
  283. -----
  284. <?php class A { final $a; }
  285. -----
  286. Properties cannot be declared final from 1:17 to 1:21
  287. array(
  288. 0: Stmt_Class(
  289. attrGroups: array(
  290. )
  291. flags: 0
  292. name: Identifier(
  293. name: A
  294. )
  295. extends: null
  296. implements: array(
  297. )
  298. stmts: array(
  299. 0: Stmt_Property(
  300. attrGroups: array(
  301. )
  302. flags: FINAL (32)
  303. type: null
  304. props: array(
  305. 0: PropertyItem(
  306. name: VarLikeIdentifier(
  307. name: a
  308. )
  309. default: null
  310. )
  311. )
  312. )
  313. )
  314. )
  315. )