@@ -43,117 +43,117 @@ public function testReadonly($testMarker, $testContent='readonly')
4343 *
4444 * @see testReadonly()
4545 *
46- * @return array
46+ * @return array<string, array<string, string>>
4747 */
4848 public static function dataReadonly ()
4949 {
5050 return [
51- [
52- '/* testReadonlyProperty */ ' ,
51+ ' property declaration, no visibility ' => [
52+ 'testMarker ' => ' /* testReadonlyProperty */ ' ,
5353 ],
54- [
55- '/* testVarReadonlyProperty */ ' ,
54+ ' property declaration, var keyword before ' => [
55+ 'testMarker ' => ' /* testVarReadonlyProperty */ ' ,
5656 ],
57- [
58- '/* testReadonlyVarProperty */ ' ,
57+ ' property declaration, var keyword after ' => [
58+ 'testMarker ' => ' /* testReadonlyVarProperty */ ' ,
5959 ],
60- [
61- '/* testStaticReadonlyProperty */ ' ,
60+ ' property declaration, static before ' => [
61+ 'testMarker ' => ' /* testStaticReadonlyProperty */ ' ,
6262 ],
63- [
64- '/* testReadonlyStaticProperty */ ' ,
63+ ' property declaration, static after ' => [
64+ 'testMarker ' => ' /* testReadonlyStaticProperty */ ' ,
6565 ],
66- [
67- '/* testConstReadonlyProperty */ ' ,
66+ ' constant declaration, with visibility ' => [
67+ 'testMarker ' => ' /* testConstReadonlyProperty */ ' ,
6868 ],
69- [
70- '/* testReadonlyPropertyWithoutType */ ' ,
69+ ' property declaration, missing type ' => [
70+ 'testMarker ' => ' /* testReadonlyPropertyWithoutType */ ' ,
7171 ],
72- [
73- '/* testPublicReadonlyProperty */ ' ,
72+ ' property declaration, public before ' => [
73+ 'testMarker ' => ' /* testPublicReadonlyProperty */ ' ,
7474 ],
75- [
76- '/* testProtectedReadonlyProperty */ ' ,
75+ ' property declaration, protected before ' => [
76+ 'testMarker ' => ' /* testProtectedReadonlyProperty */ ' ,
7777 ],
78- [
79- '/* testPrivateReadonlyProperty */ ' ,
78+ ' property declaration, private before ' => [
79+ 'testMarker ' => ' /* testPrivateReadonlyProperty */ ' ,
8080 ],
81- [
82- '/* testPublicReadonlyPropertyWithReadonlyFirst */ ' ,
81+ ' property declaration, public after ' => [
82+ 'testMarker ' => ' /* testPublicReadonlyPropertyWithReadonlyFirst */ ' ,
8383 ],
84- [
85- '/* testProtectedReadonlyPropertyWithReadonlyFirst */ ' ,
84+ ' property declaration, protected after ' => [
85+ 'testMarker ' => ' /* testProtectedReadonlyPropertyWithReadonlyFirst */ ' ,
8686 ],
87- [
88- '/* testPrivateReadonlyPropertyWithReadonlyFirst */ ' ,
87+ ' property declaration, private after ' => [
88+ 'testMarker ' => ' /* testPrivateReadonlyPropertyWithReadonlyFirst */ ' ,
8989 ],
90- [
91- '/* testReadonlyWithCommentsInDeclaration */ ' ,
90+ ' property declaration, private before, comments in declaration ' => [
91+ 'testMarker ' => ' /* testReadonlyWithCommentsInDeclaration */ ' ,
9292 ],
93- [
94- '/* testReadonlyWithNullableProperty */ ' ,
93+ ' property declaration, private before, nullable type ' => [
94+ 'testMarker ' => ' /* testReadonlyWithNullableProperty */ ' ,
9595 ],
96- [
97- '/* testReadonlyNullablePropertyWithUnionTypeHintAndNullFirst */ ' ,
96+ ' property declaration, private before, union type, null first ' => [
97+ 'testMarker ' => ' /* testReadonlyNullablePropertyWithUnionTypeHintAndNullFirst */ ' ,
9898 ],
99- [
100- '/* testReadonlyNullablePropertyWithUnionTypeHintAndNullLast */ ' ,
99+ ' property declaration, private before, union type, null last ' => [
100+ 'testMarker ' => ' /* testReadonlyNullablePropertyWithUnionTypeHintAndNullLast */ ' ,
101101 ],
102- [
103- '/* testReadonlyPropertyWithArrayTypeHint */ ' ,
102+ ' property declaration, private before, array type ' => [
103+ 'testMarker ' => ' /* testReadonlyPropertyWithArrayTypeHint */ ' ,
104104 ],
105- [
106- '/* testReadonlyPropertyWithSelfTypeHint */ ' ,
105+ ' property declaration, private before, self type ' => [
106+ 'testMarker ' => ' /* testReadonlyPropertyWithSelfTypeHint */ ' ,
107107 ],
108- [
109- '/* testReadonlyPropertyWithParentTypeHint */ ' ,
108+ ' property declaration, private before, parent type ' => [
109+ 'testMarker ' => ' /* testReadonlyPropertyWithParentTypeHint */ ' ,
110110 ],
111- [
112- '/* testReadonlyPropertyWithFullyQualifiedTypeHint */ ' ,
111+ ' property declaration, private before, FQN type ' => [
112+ 'testMarker ' => ' /* testReadonlyPropertyWithFullyQualifiedTypeHint */ ' ,
113113 ],
114- [
115- '/* testReadonlyIsCaseInsensitive */ ' ,
116- 'ReAdOnLy ' ,
114+ ' property declaration, public before, mixed case ' => [
115+ 'testMarker ' => ' /* testReadonlyIsCaseInsensitive */ ' ,
116+ 'testContent ' => ' ReAdOnLy ' ,
117117 ],
118- [
119- '/* testReadonlyConstructorPropertyPromotion */ ' ,
118+ ' property declaration, constructor property promotion ' => [
119+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotion */ ' ,
120120 ],
121- [
122- '/* testReadonlyConstructorPropertyPromotionWithReference */ ' ,
123- 'ReadOnly ' ,
121+ ' property declaration, constructor property promotion with reference, mixed case ' => [
122+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithReference */ ' ,
123+ 'testContent ' => ' ReadOnly ' ,
124124 ],
125- [
126- '/* testReadonlyPropertyInAnonymousClass */ ' ,
125+ ' property declaration, in anonymous class ' => [
126+ 'testMarker ' => ' /* testReadonlyPropertyInAnonymousClass */ ' ,
127127 ],
128- [
129- '/* testReadonlyPropertyDNFTypeUnqualified */ ' ,
128+ ' property declaration, no visibility, DNF type, unqualified ' => [
129+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeUnqualified */ ' ,
130130 ],
131- [
132- '/* testReadonlyPropertyDNFTypeFullyQualified */ ' ,
131+ ' property declaration, public before, DNF type, fully qualified ' => [
132+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeFullyQualified */ ' ,
133133 ],
134- [
135- '/* testReadonlyPropertyDNFTypePartiallyQualified */ ' ,
134+ ' property declaration, protected before, DNF type, partially qualified ' => [
135+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypePartiallyQualified */ ' ,
136136 ],
137- [
138- '/* testReadonlyPropertyDNFTypeRelativeName */ ' ,
137+ ' property declaration, private before, DNF type, namespace relative name ' => [
138+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeRelativeName */ ' ,
139139 ],
140- [
141- '/* testReadonlyPropertyDNFTypeMultipleSets */ ' ,
140+ ' property declaration, private before, DNF type, multiple sets ' => [
141+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeMultipleSets */ ' ,
142142 ],
143- [
144- '/* testReadonlyPropertyDNFTypeWithArray */ ' ,
143+ ' property declaration, private before, DNF type, union with array ' => [
144+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeWithArray */ ' ,
145145 ],
146- [
147- '/* testReadonlyPropertyDNFTypeWithSpacesAndComments */ ' ,
146+ ' property declaration, private before, DNF type, with spaces and comment ' => [
147+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeWithSpacesAndComments */ ' ,
148148 ],
149- [
150- '/* testReadonlyConstructorPropertyPromotionWithDNF */ ' ,
149+ ' property declaration, constructor property promotion, DNF type ' => [
150+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithDNF */ ' ,
151151 ],
152- [
153- '/* testReadonlyConstructorPropertyPromotionWithDNFAndReference */ ' ,
152+ ' property declaration, constructor property promotion, DNF type and reference ' => [
153+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithDNFAndReference */ ' ,
154154 ],
155- [
156- '/* testParseErrorLiveCoding */ ' ,
155+ ' live coding / parse error ' => [
156+ 'testMarker ' => ' /* testParseErrorLiveCoding */ ' ,
157157 ],
158158 ];
159159
@@ -188,67 +188,67 @@ public function testNotReadonly($testMarker, $testContent='readonly')
188188 *
189189 * @see testNotReadonly()
190190 *
191- * @return array
191+ * @return array<string, array<string, string>>
192192 */
193193 public static function dataNotReadonly ()
194194 {
195195 return [
196- [
197- '/* testReadonlyUsedAsClassConstantName */ ' ,
198- 'READONLY ' ,
196+ ' name of a constant, context: declaration using "const" keyword, uppercase ' => [
197+ 'testMarker ' => ' /* testReadonlyUsedAsClassConstantName */ ' ,
198+ 'testContent ' => ' READONLY ' ,
199199 ],
200- [
201- '/* testReadonlyUsedAsMethodName */ ' ,
200+ ' name of a method, context: declaration ' => [
201+ 'testMarker ' => ' /* testReadonlyUsedAsMethodName */ ' ,
202202 ],
203- [
204- '/* testReadonlyUsedAsPropertyName */ ' ,
203+ ' name of a property, context: property access ' => [
204+ 'testMarker ' => ' /* testReadonlyUsedAsPropertyName */ ' ,
205205 ],
206- [
207- '/* testReadonlyPropertyInTernaryOperator */ ' ,
206+ ' name of a property, context: property access in ternary ' => [
207+ 'testMarker ' => ' /* testReadonlyPropertyInTernaryOperator */ ' ,
208208 ],
209- [
210- '/* testReadonlyUsedAsFunctionName */ ' ,
209+ ' name of a function, context: declaration ' => [
210+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionName */ ' ,
211211 ],
212- [
213- '/* testReadonlyUsedAsFunctionNameWithReturnByRef */ ' ,
212+ ' name of a function, context: declaration with return by ref ' => [
213+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionNameWithReturnByRef */ ' ,
214214 ],
215- [
216- '/* testReadonlyUsedAsNamespaceName */ ' ,
217- 'Readonly ' ,
215+ ' name of namespace, context: declaration, mixed case ' => [
216+ 'testMarker ' => ' /* testReadonlyUsedAsNamespaceName */ ' ,
217+ 'testContent ' => ' Readonly ' ,
218218 ],
219- [
220- '/* testReadonlyUsedAsPartOfNamespaceName */ ' ,
221- 'Readonly ' ,
219+ ' partial name of namespace, context: declaration, mixed case ' => [
220+ 'testMarker ' => ' /* testReadonlyUsedAsPartOfNamespaceName */ ' ,
221+ 'testContent ' => ' Readonly ' ,
222222 ],
223- [
224- '/* testReadonlyAsFunctionCall */ ' ,
223+ ' name of a function, context: call ' => [
224+ 'testMarker ' => ' /* testReadonlyAsFunctionCall */ ' ,
225225 ],
226- [
227- '/* testReadonlyAsNamespacedFunctionCall */ ' ,
226+ ' name of a namespaced function, context: partially qualified call ' => [
227+ 'testMarker ' => ' /* testReadonlyAsNamespacedFunctionCall */ ' ,
228228 ],
229- [
230- '/* testReadonlyAsNamespaceRelativeFunctionCall */ ' ,
231- 'ReadOnly ' ,
229+ ' name of a function, context: namespace relative call, mixed case ' => [
230+ 'testMarker ' => ' /* testReadonlyAsNamespaceRelativeFunctionCall */ ' ,
231+ 'testContent ' => ' ReadOnly ' ,
232232 ],
233- [
234- '/* testReadonlyAsMethodCall */ ' ,
233+ ' name of a method, context: method call on object ' => [
234+ 'testMarker ' => ' /* testReadonlyAsMethodCall */ ' ,
235235 ],
236- [
237- '/* testReadonlyAsNullsafeMethodCall */ ' ,
238- 'readOnly ' ,
236+ ' name of a method, context: nullsafe method call on object ' => [
237+ 'testMarker ' => ' /* testReadonlyAsNullsafeMethodCall */ ' ,
238+ 'testContent ' => ' readOnly ' ,
239239 ],
240- [
241- '/* testReadonlyAsStaticMethodCallWithSpace */ ' ,
240+ ' name of a method, context: static method call with space after ' => [
241+ 'testMarker ' => ' /* testReadonlyAsStaticMethodCallWithSpace */ ' ,
242242 ],
243- [
244- '/* testClassConstantFetchWithReadonlyAsConstantName */ ' ,
245- 'READONLY ' ,
243+ ' name of a constant, context: constant access - uppercase ' => [
244+ 'testMarker ' => ' /* testClassConstantFetchWithReadonlyAsConstantName */ ' ,
245+ 'testContent ' => ' READONLY ' ,
246246 ],
247- [
248- '/* testReadonlyUsedAsFunctionCallWithSpaceBetweenKeywordAndParens */ ' ,
247+ ' name of a function, context: call with space and comment between keyword and parens ' => [
248+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionCallWithSpaceBetweenKeywordAndParens */ ' ,
249249 ],
250- [
251- '/* testReadonlyUsedAsMethodNameWithDNFParam */ ' ,
250+ ' name of a method, context: declaration with DNF parameter ' => [
251+ 'testMarker ' => ' /* testReadonlyUsedAsMethodNameWithDNFParam */ ' ,
252252 ],
253253 ];
254254
0 commit comments