@@ -43,117 +43,117 @@ public function testReadonly($testMarker, $testContent='readonly')
43
43
*
44
44
* @see testReadonly()
45
45
*
46
- * @return array
46
+ * @return array<string, array<string, string>>
47
47
*/
48
48
public static function dataReadonly ()
49
49
{
50
50
return [
51
- [
52
- '/* testReadonlyProperty */ ' ,
51
+ ' property declaration, no visibility ' => [
52
+ 'testMarker ' => ' /* testReadonlyProperty */ ' ,
53
53
],
54
- [
55
- '/* testVarReadonlyProperty */ ' ,
54
+ ' property declaration, var keyword before ' => [
55
+ 'testMarker ' => ' /* testVarReadonlyProperty */ ' ,
56
56
],
57
- [
58
- '/* testReadonlyVarProperty */ ' ,
57
+ ' property declaration, var keyword after ' => [
58
+ 'testMarker ' => ' /* testReadonlyVarProperty */ ' ,
59
59
],
60
- [
61
- '/* testStaticReadonlyProperty */ ' ,
60
+ ' property declaration, static before ' => [
61
+ 'testMarker ' => ' /* testStaticReadonlyProperty */ ' ,
62
62
],
63
- [
64
- '/* testReadonlyStaticProperty */ ' ,
63
+ ' property declaration, static after ' => [
64
+ 'testMarker ' => ' /* testReadonlyStaticProperty */ ' ,
65
65
],
66
- [
67
- '/* testConstReadonlyProperty */ ' ,
66
+ ' constant declaration, with visibility ' => [
67
+ 'testMarker ' => ' /* testConstReadonlyProperty */ ' ,
68
68
],
69
- [
70
- '/* testReadonlyPropertyWithoutType */ ' ,
69
+ ' property declaration, missing type ' => [
70
+ 'testMarker ' => ' /* testReadonlyPropertyWithoutType */ ' ,
71
71
],
72
- [
73
- '/* testPublicReadonlyProperty */ ' ,
72
+ ' property declaration, public before ' => [
73
+ 'testMarker ' => ' /* testPublicReadonlyProperty */ ' ,
74
74
],
75
- [
76
- '/* testProtectedReadonlyProperty */ ' ,
75
+ ' property declaration, protected before ' => [
76
+ 'testMarker ' => ' /* testProtectedReadonlyProperty */ ' ,
77
77
],
78
- [
79
- '/* testPrivateReadonlyProperty */ ' ,
78
+ ' property declaration, private before ' => [
79
+ 'testMarker ' => ' /* testPrivateReadonlyProperty */ ' ,
80
80
],
81
- [
82
- '/* testPublicReadonlyPropertyWithReadonlyFirst */ ' ,
81
+ ' property declaration, public after ' => [
82
+ 'testMarker ' => ' /* testPublicReadonlyPropertyWithReadonlyFirst */ ' ,
83
83
],
84
- [
85
- '/* testProtectedReadonlyPropertyWithReadonlyFirst */ ' ,
84
+ ' property declaration, protected after ' => [
85
+ 'testMarker ' => ' /* testProtectedReadonlyPropertyWithReadonlyFirst */ ' ,
86
86
],
87
- [
88
- '/* testPrivateReadonlyPropertyWithReadonlyFirst */ ' ,
87
+ ' property declaration, private after ' => [
88
+ 'testMarker ' => ' /* testPrivateReadonlyPropertyWithReadonlyFirst */ ' ,
89
89
],
90
- [
91
- '/* testReadonlyWithCommentsInDeclaration */ ' ,
90
+ ' property declaration, private before, comments in declaration ' => [
91
+ 'testMarker ' => ' /* testReadonlyWithCommentsInDeclaration */ ' ,
92
92
],
93
- [
94
- '/* testReadonlyWithNullableProperty */ ' ,
93
+ ' property declaration, private before, nullable type ' => [
94
+ 'testMarker ' => ' /* testReadonlyWithNullableProperty */ ' ,
95
95
],
96
- [
97
- '/* testReadonlyNullablePropertyWithUnionTypeHintAndNullFirst */ ' ,
96
+ ' property declaration, private before, union type, null first ' => [
97
+ 'testMarker ' => ' /* testReadonlyNullablePropertyWithUnionTypeHintAndNullFirst */ ' ,
98
98
],
99
- [
100
- '/* testReadonlyNullablePropertyWithUnionTypeHintAndNullLast */ ' ,
99
+ ' property declaration, private before, union type, null last ' => [
100
+ 'testMarker ' => ' /* testReadonlyNullablePropertyWithUnionTypeHintAndNullLast */ ' ,
101
101
],
102
- [
103
- '/* testReadonlyPropertyWithArrayTypeHint */ ' ,
102
+ ' property declaration, private before, array type ' => [
103
+ 'testMarker ' => ' /* testReadonlyPropertyWithArrayTypeHint */ ' ,
104
104
],
105
- [
106
- '/* testReadonlyPropertyWithSelfTypeHint */ ' ,
105
+ ' property declaration, private before, self type ' => [
106
+ 'testMarker ' => ' /* testReadonlyPropertyWithSelfTypeHint */ ' ,
107
107
],
108
- [
109
- '/* testReadonlyPropertyWithParentTypeHint */ ' ,
108
+ ' property declaration, private before, parent type ' => [
109
+ 'testMarker ' => ' /* testReadonlyPropertyWithParentTypeHint */ ' ,
110
110
],
111
- [
112
- '/* testReadonlyPropertyWithFullyQualifiedTypeHint */ ' ,
111
+ ' property declaration, private before, FQN type ' => [
112
+ 'testMarker ' => ' /* testReadonlyPropertyWithFullyQualifiedTypeHint */ ' ,
113
113
],
114
- [
115
- '/* testReadonlyIsCaseInsensitive */ ' ,
116
- 'ReAdOnLy ' ,
114
+ ' property declaration, public before, mixed case ' => [
115
+ 'testMarker ' => ' /* testReadonlyIsCaseInsensitive */ ' ,
116
+ 'testContent ' => ' ReAdOnLy ' ,
117
117
],
118
- [
119
- '/* testReadonlyConstructorPropertyPromotion */ ' ,
118
+ ' property declaration, constructor property promotion ' => [
119
+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotion */ ' ,
120
120
],
121
- [
122
- '/* testReadonlyConstructorPropertyPromotionWithReference */ ' ,
123
- 'ReadOnly ' ,
121
+ ' property declaration, constructor property promotion with reference, mixed case ' => [
122
+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithReference */ ' ,
123
+ 'testContent ' => ' ReadOnly ' ,
124
124
],
125
- [
126
- '/* testReadonlyPropertyInAnonymousClass */ ' ,
125
+ ' property declaration, in anonymous class ' => [
126
+ 'testMarker ' => ' /* testReadonlyPropertyInAnonymousClass */ ' ,
127
127
],
128
- [
129
- '/* testReadonlyPropertyDNFTypeUnqualified */ ' ,
128
+ ' property declaration, no visibility, DNF type, unqualified ' => [
129
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeUnqualified */ ' ,
130
130
],
131
- [
132
- '/* testReadonlyPropertyDNFTypeFullyQualified */ ' ,
131
+ ' property declaration, public before, DNF type, fully qualified ' => [
132
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeFullyQualified */ ' ,
133
133
],
134
- [
135
- '/* testReadonlyPropertyDNFTypePartiallyQualified */ ' ,
134
+ ' property declaration, protected before, DNF type, partially qualified ' => [
135
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypePartiallyQualified */ ' ,
136
136
],
137
- [
138
- '/* testReadonlyPropertyDNFTypeRelativeName */ ' ,
137
+ ' property declaration, private before, DNF type, namespace relative name ' => [
138
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeRelativeName */ ' ,
139
139
],
140
- [
141
- '/* testReadonlyPropertyDNFTypeMultipleSets */ ' ,
140
+ ' property declaration, private before, DNF type, multiple sets ' => [
141
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeMultipleSets */ ' ,
142
142
],
143
- [
144
- '/* testReadonlyPropertyDNFTypeWithArray */ ' ,
143
+ ' property declaration, private before, DNF type, union with array ' => [
144
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeWithArray */ ' ,
145
145
],
146
- [
147
- '/* testReadonlyPropertyDNFTypeWithSpacesAndComments */ ' ,
146
+ ' property declaration, private before, DNF type, with spaces and comment ' => [
147
+ 'testMarker ' => ' /* testReadonlyPropertyDNFTypeWithSpacesAndComments */ ' ,
148
148
],
149
- [
150
- '/* testReadonlyConstructorPropertyPromotionWithDNF */ ' ,
149
+ ' property declaration, constructor property promotion, DNF type ' => [
150
+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithDNF */ ' ,
151
151
],
152
- [
153
- '/* testReadonlyConstructorPropertyPromotionWithDNFAndReference */ ' ,
152
+ ' property declaration, constructor property promotion, DNF type and reference ' => [
153
+ 'testMarker ' => ' /* testReadonlyConstructorPropertyPromotionWithDNFAndReference */ ' ,
154
154
],
155
- [
156
- '/* testParseErrorLiveCoding */ ' ,
155
+ ' live coding / parse error ' => [
156
+ 'testMarker ' => ' /* testParseErrorLiveCoding */ ' ,
157
157
],
158
158
];
159
159
@@ -188,67 +188,67 @@ public function testNotReadonly($testMarker, $testContent='readonly')
188
188
*
189
189
* @see testNotReadonly()
190
190
*
191
- * @return array
191
+ * @return array<string, array<string, string>>
192
192
*/
193
193
public static function dataNotReadonly ()
194
194
{
195
195
return [
196
- [
197
- '/* testReadonlyUsedAsClassConstantName */ ' ,
198
- 'READONLY ' ,
196
+ ' name of a constant, context: declaration using "const" keyword, uppercase ' => [
197
+ 'testMarker ' => ' /* testReadonlyUsedAsClassConstantName */ ' ,
198
+ 'testContent ' => ' READONLY ' ,
199
199
],
200
- [
201
- '/* testReadonlyUsedAsMethodName */ ' ,
200
+ ' name of a method, context: declaration ' => [
201
+ 'testMarker ' => ' /* testReadonlyUsedAsMethodName */ ' ,
202
202
],
203
- [
204
- '/* testReadonlyUsedAsPropertyName */ ' ,
203
+ ' name of a property, context: property access ' => [
204
+ 'testMarker ' => ' /* testReadonlyUsedAsPropertyName */ ' ,
205
205
],
206
- [
207
- '/* testReadonlyPropertyInTernaryOperator */ ' ,
206
+ ' name of a property, context: property access in ternary ' => [
207
+ 'testMarker ' => ' /* testReadonlyPropertyInTernaryOperator */ ' ,
208
208
],
209
- [
210
- '/* testReadonlyUsedAsFunctionName */ ' ,
209
+ ' name of a function, context: declaration ' => [
210
+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionName */ ' ,
211
211
],
212
- [
213
- '/* testReadonlyUsedAsFunctionNameWithReturnByRef */ ' ,
212
+ ' name of a function, context: declaration with return by ref ' => [
213
+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionNameWithReturnByRef */ ' ,
214
214
],
215
- [
216
- '/* testReadonlyUsedAsNamespaceName */ ' ,
217
- 'Readonly ' ,
215
+ ' name of namespace, context: declaration, mixed case ' => [
216
+ 'testMarker ' => ' /* testReadonlyUsedAsNamespaceName */ ' ,
217
+ 'testContent ' => ' Readonly ' ,
218
218
],
219
- [
220
- '/* testReadonlyUsedAsPartOfNamespaceName */ ' ,
221
- 'Readonly ' ,
219
+ ' partial name of namespace, context: declaration, mixed case ' => [
220
+ 'testMarker ' => ' /* testReadonlyUsedAsPartOfNamespaceName */ ' ,
221
+ 'testContent ' => ' Readonly ' ,
222
222
],
223
- [
224
- '/* testReadonlyAsFunctionCall */ ' ,
223
+ ' name of a function, context: call ' => [
224
+ 'testMarker ' => ' /* testReadonlyAsFunctionCall */ ' ,
225
225
],
226
- [
227
- '/* testReadonlyAsNamespacedFunctionCall */ ' ,
226
+ ' name of a namespaced function, context: partially qualified call ' => [
227
+ 'testMarker ' => ' /* testReadonlyAsNamespacedFunctionCall */ ' ,
228
228
],
229
- [
230
- '/* testReadonlyAsNamespaceRelativeFunctionCall */ ' ,
231
- 'ReadOnly ' ,
229
+ ' name of a function, context: namespace relative call, mixed case ' => [
230
+ 'testMarker ' => ' /* testReadonlyAsNamespaceRelativeFunctionCall */ ' ,
231
+ 'testContent ' => ' ReadOnly ' ,
232
232
],
233
- [
234
- '/* testReadonlyAsMethodCall */ ' ,
233
+ ' name of a method, context: method call on object ' => [
234
+ 'testMarker ' => ' /* testReadonlyAsMethodCall */ ' ,
235
235
],
236
- [
237
- '/* testReadonlyAsNullsafeMethodCall */ ' ,
238
- 'readOnly ' ,
236
+ ' name of a method, context: nullsafe method call on object ' => [
237
+ 'testMarker ' => ' /* testReadonlyAsNullsafeMethodCall */ ' ,
238
+ 'testContent ' => ' readOnly ' ,
239
239
],
240
- [
241
- '/* testReadonlyAsStaticMethodCallWithSpace */ ' ,
240
+ ' name of a method, context: static method call with space after ' => [
241
+ 'testMarker ' => ' /* testReadonlyAsStaticMethodCallWithSpace */ ' ,
242
242
],
243
- [
244
- '/* testClassConstantFetchWithReadonlyAsConstantName */ ' ,
245
- 'READONLY ' ,
243
+ ' name of a constant, context: constant access - uppercase ' => [
244
+ 'testMarker ' => ' /* testClassConstantFetchWithReadonlyAsConstantName */ ' ,
245
+ 'testContent ' => ' READONLY ' ,
246
246
],
247
- [
248
- '/* testReadonlyUsedAsFunctionCallWithSpaceBetweenKeywordAndParens */ ' ,
247
+ ' name of a function, context: call with space and comment between keyword and parens ' => [
248
+ 'testMarker ' => ' /* testReadonlyUsedAsFunctionCallWithSpaceBetweenKeywordAndParens */ ' ,
249
249
],
250
- [
251
- '/* testReadonlyUsedAsMethodNameWithDNFParam */ ' ,
250
+ ' name of a method, context: declaration with DNF parameter ' => [
251
+ 'testMarker ' => ' /* testReadonlyUsedAsMethodNameWithDNFParam */ ' ,
252
252
],
253
253
];
254
254
0 commit comments