modifier.test 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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: MODIFIER_PUBLIC (1)
  22. type: null
  23. props: array(
  24. 0: Stmt_PropertyProperty(
  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: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
  55. type: null
  56. props: array(
  57. 0: Stmt_PropertyProperty(
  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. !!php7
  72. Multiple readonly modifiers are not allowed from 1:26 to 1:33
  73. array(
  74. 0: Stmt_Class(
  75. attrGroups: array(
  76. )
  77. flags: 0
  78. name: Identifier(
  79. name: C
  80. )
  81. extends: null
  82. implements: array(
  83. )
  84. stmts: array(
  85. 0: Stmt_Property(
  86. attrGroups: array(
  87. )
  88. flags: MODIFIER_READONLY (64)
  89. type: null
  90. props: array(
  91. 0: Stmt_PropertyProperty(
  92. name: VarLikeIdentifier(
  93. name: a
  94. )
  95. default: null
  96. )
  97. )
  98. )
  99. )
  100. )
  101. )
  102. -----
  103. <?php class A { abstract abstract function a(); }
  104. -----
  105. Multiple abstract modifiers are not allowed from 1:26 to 1:33
  106. array(
  107. 0: Stmt_Class(
  108. attrGroups: array(
  109. )
  110. flags: 0
  111. name: Identifier(
  112. name: A
  113. )
  114. extends: null
  115. implements: array(
  116. )
  117. stmts: array(
  118. 0: Stmt_ClassMethod(
  119. attrGroups: array(
  120. )
  121. flags: MODIFIER_ABSTRACT (16)
  122. byRef: false
  123. name: Identifier(
  124. name: a
  125. )
  126. params: array(
  127. )
  128. returnType: null
  129. stmts: null
  130. )
  131. )
  132. )
  133. )
  134. -----
  135. <?php class A { static static $a; }
  136. -----
  137. Multiple static modifiers are not allowed from 1:24 to 1:29
  138. array(
  139. 0: Stmt_Class(
  140. attrGroups: array(
  141. )
  142. flags: 0
  143. name: Identifier(
  144. name: A
  145. )
  146. extends: null
  147. implements: array(
  148. )
  149. stmts: array(
  150. 0: Stmt_Property(
  151. attrGroups: array(
  152. )
  153. flags: MODIFIER_STATIC (8)
  154. type: null
  155. props: array(
  156. 0: Stmt_PropertyProperty(
  157. name: VarLikeIdentifier(
  158. name: a
  159. )
  160. default: null
  161. )
  162. )
  163. )
  164. )
  165. )
  166. )
  167. -----
  168. <?php class A { final final function a() {} }
  169. -----
  170. Multiple final modifiers are not allowed from 1:23 to 1:27
  171. array(
  172. 0: Stmt_Class(
  173. attrGroups: array(
  174. )
  175. flags: 0
  176. name: Identifier(
  177. name: A
  178. )
  179. extends: null
  180. implements: array(
  181. )
  182. stmts: array(
  183. 0: Stmt_ClassMethod(
  184. attrGroups: array(
  185. )
  186. flags: MODIFIER_FINAL (32)
  187. byRef: false
  188. name: Identifier(
  189. name: a
  190. )
  191. params: array(
  192. )
  193. returnType: null
  194. stmts: array(
  195. )
  196. )
  197. )
  198. )
  199. )
  200. -----
  201. <?php class A { abstract final function a(); }
  202. -----
  203. Cannot use the final modifier on an abstract class member from 1:26 to 1:30
  204. array(
  205. 0: Stmt_Class(
  206. attrGroups: array(
  207. )
  208. flags: 0
  209. name: Identifier(
  210. name: A
  211. )
  212. extends: null
  213. implements: array(
  214. )
  215. stmts: array(
  216. 0: Stmt_ClassMethod(
  217. attrGroups: array(
  218. )
  219. flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
  220. byRef: false
  221. name: Identifier(
  222. name: a
  223. )
  224. params: array(
  225. )
  226. returnType: null
  227. stmts: null
  228. )
  229. )
  230. )
  231. )
  232. -----
  233. <?php abstract final class A { }
  234. -----
  235. !!php7
  236. Cannot use the final modifier on an abstract class from 1:16 to 1:20
  237. array(
  238. 0: Stmt_Class(
  239. attrGroups: array(
  240. )
  241. flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
  242. name: Identifier(
  243. name: A
  244. )
  245. extends: null
  246. implements: array(
  247. )
  248. stmts: array(
  249. )
  250. )
  251. )
  252. -----
  253. <?php abstract final class A { }
  254. // Type in the partial parse could conceivably be any of 0, 16 or 32
  255. -----
  256. !!php5
  257. Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
  258. array(
  259. 0: Stmt_Class(
  260. attrGroups: array(
  261. )
  262. flags: MODIFIER_FINAL (32)
  263. name: Identifier(
  264. name: A
  265. )
  266. extends: null
  267. implements: array(
  268. )
  269. stmts: array(
  270. )
  271. )
  272. 1: Stmt_Nop(
  273. comments: array(
  274. 0: // Type in the partial parse could conceivably be any of 0, 16 or 32
  275. )
  276. )
  277. )
  278. -----
  279. <?php readonly class A { }
  280. // Type in the partial parse could conceivably be any of 0, 16 or 32
  281. -----
  282. !!php5
  283. Syntax error, unexpected T_CLASS, expecting '(' from 1:16 to 1:20
  284. array(
  285. 0: Stmt_Class(
  286. attrGroups: array(
  287. )
  288. flags: 0
  289. name: Identifier(
  290. name: A
  291. )
  292. extends: null
  293. implements: array(
  294. )
  295. stmts: array(
  296. )
  297. )
  298. 1: Stmt_Nop(
  299. comments: array(
  300. 0: // Type in the partial parse could conceivably be any of 0, 16 or 32
  301. )
  302. )
  303. )
  304. -----
  305. <?php class B { abstract $b; }
  306. -----
  307. Properties cannot be declared abstract from 1:17 to 1:24
  308. array(
  309. 0: Stmt_Class(
  310. attrGroups: array(
  311. )
  312. flags: 0
  313. name: Identifier(
  314. name: B
  315. )
  316. extends: null
  317. implements: array(
  318. )
  319. stmts: array(
  320. 0: Stmt_Property(
  321. attrGroups: array(
  322. )
  323. flags: MODIFIER_ABSTRACT (16)
  324. type: null
  325. props: array(
  326. 0: Stmt_PropertyProperty(
  327. name: VarLikeIdentifier(
  328. name: b
  329. )
  330. default: null
  331. )
  332. )
  333. )
  334. )
  335. )
  336. )
  337. -----
  338. <?php class A { final $a; }
  339. -----
  340. Properties cannot be declared final from 1:17 to 1:21
  341. array(
  342. 0: Stmt_Class(
  343. attrGroups: array(
  344. )
  345. flags: 0
  346. name: Identifier(
  347. name: A
  348. )
  349. extends: null
  350. implements: array(
  351. )
  352. stmts: array(
  353. 0: Stmt_Property(
  354. attrGroups: array(
  355. )
  356. flags: MODIFIER_FINAL (32)
  357. type: null
  358. props: array(
  359. 0: Stmt_PropertyProperty(
  360. name: VarLikeIdentifier(
  361. name: a
  362. )
  363. default: null
  364. )
  365. )
  366. )
  367. )
  368. )
  369. )