@@ -131,86 +131,86 @@ public static function dataCondition(): iterable
131
131
}
132
132
yield from [
133
133
[
134
- $ this -> createFunctionCall ('is_int ' ),
134
+ self :: createFunctionCall ('is_int ' ),
135
135
['$foo ' => 'int ' ],
136
136
['$foo ' => '~int ' ],
137
137
],
138
138
[
139
- $ this -> createFunctionCall ('is_numeric ' ),
139
+ self :: createFunctionCall ('is_numeric ' ),
140
140
['$foo ' => 'float|int|numeric-string ' ],
141
141
['$foo ' => '~float|int|numeric-string ' ],
142
142
],
143
143
[
144
- $ this -> createFunctionCall ('is_scalar ' ),
144
+ self :: createFunctionCall ('is_scalar ' ),
145
145
['$foo ' => 'bool|float|int|string ' ],
146
146
['$foo ' => '~bool|float|int|string ' ],
147
147
],
148
148
[
149
149
new Expr \BinaryOp \BooleanAnd (
150
- $ this -> createFunctionCall ('is_int ' ),
151
- $ this -> createFunctionCall ('random ' ),
150
+ self :: createFunctionCall ('is_int ' ),
151
+ self :: createFunctionCall ('random ' ),
152
152
),
153
153
['$foo ' => 'int ' ],
154
154
[],
155
155
],
156
156
[
157
157
new Expr \BinaryOp \BooleanOr (
158
- $ this -> createFunctionCall ('is_int ' ),
159
- $ this -> createFunctionCall ('random ' ),
158
+ self :: createFunctionCall ('is_int ' ),
159
+ self :: createFunctionCall ('random ' ),
160
160
),
161
161
[],
162
162
['$foo ' => '~int ' ],
163
163
],
164
164
[
165
165
new Expr \BinaryOp \LogicalAnd (
166
- $ this -> createFunctionCall ('is_int ' ),
167
- $ this -> createFunctionCall ('random ' ),
166
+ self :: createFunctionCall ('is_int ' ),
167
+ self :: createFunctionCall ('random ' ),
168
168
),
169
169
['$foo ' => 'int ' ],
170
170
[],
171
171
],
172
172
[
173
173
new Expr \BinaryOp \LogicalOr (
174
- $ this -> createFunctionCall ('is_int ' ),
175
- $ this -> createFunctionCall ('random ' ),
174
+ self :: createFunctionCall ('is_int ' ),
175
+ self :: createFunctionCall ('random ' ),
176
176
),
177
177
[],
178
178
['$foo ' => '~int ' ],
179
179
],
180
180
[
181
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' )),
181
+ new Expr \BooleanNot (self :: createFunctionCall ('is_int ' )),
182
182
['$foo ' => '~int ' ],
183
183
['$foo ' => 'int ' ],
184
184
],
185
185
186
186
[
187
187
new Expr \BinaryOp \BooleanAnd (
188
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' )),
189
- $ this -> createFunctionCall ('random ' ),
188
+ new Expr \BooleanNot (self :: createFunctionCall ('is_int ' )),
189
+ self :: createFunctionCall ('random ' ),
190
190
),
191
191
['$foo ' => '~int ' ],
192
192
[],
193
193
],
194
194
[
195
195
new Expr \BinaryOp \BooleanOr (
196
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' )),
197
- $ this -> createFunctionCall ('random ' ),
196
+ new Expr \BooleanNot (self :: createFunctionCall ('is_int ' )),
197
+ self :: createFunctionCall ('random ' ),
198
198
),
199
199
[],
200
200
['$foo ' => 'int ' ],
201
201
],
202
202
[
203
- new Expr \BooleanNot (new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' ))),
203
+ new Expr \BooleanNot (new Expr \BooleanNot (self :: createFunctionCall ('is_int ' ))),
204
204
['$foo ' => 'int ' ],
205
205
['$foo ' => '~int ' ],
206
206
],
207
207
[
208
- $ this -> createInstanceOf ('Foo ' ),
208
+ self :: createInstanceOf ('Foo ' ),
209
209
['$foo ' => 'Foo ' ],
210
210
['$foo ' => '~Foo ' ],
211
211
],
212
212
[
213
- new Expr \BooleanNot ($ this -> createInstanceOf ('Foo ' )),
213
+ new Expr \BooleanNot (self :: createInstanceOf ('Foo ' )),
214
214
['$foo ' => '~Foo ' ],
215
215
['$foo ' => 'Foo ' ],
216
216
],
@@ -280,15 +280,15 @@ public static function dataCondition(): iterable
280
280
[
281
281
new Expr \BinaryOp \BooleanAnd (
282
282
new Variable ('foo ' ),
283
- $ this -> createFunctionCall ('random ' ),
283
+ self :: createFunctionCall ('random ' ),
284
284
),
285
285
['$foo ' => self ::SURE_NOT_FALSEY ],
286
286
[],
287
287
],
288
288
[
289
289
new Expr \BinaryOp \BooleanOr (
290
290
new Variable ('foo ' ),
291
- $ this -> createFunctionCall ('random ' ),
291
+ self :: createFunctionCall ('random ' ),
292
292
),
293
293
[],
294
294
['$foo ' => self ::SURE_NOT_TRUTHY ],
@@ -307,15 +307,15 @@ public static function dataCondition(): iterable
307
307
[
308
308
new Expr \BinaryOp \BooleanAnd (
309
309
new PropertyFetch (new Variable ('this ' ), 'foo ' ),
310
- $ this -> createFunctionCall ('random ' ),
310
+ self :: createFunctionCall ('random ' ),
311
311
),
312
312
['$this->foo ' => self ::SURE_NOT_FALSEY ],
313
313
[],
314
314
],
315
315
[
316
316
new Expr \BinaryOp \BooleanOr (
317
317
new PropertyFetch (new Variable ('this ' ), 'foo ' ),
318
- $ this -> createFunctionCall ('random ' ),
318
+ self :: createFunctionCall ('random ' ),
319
319
),
320
320
[],
321
321
['$this->foo ' => self ::SURE_NOT_TRUTHY ],
@@ -328,82 +328,82 @@ public static function dataCondition(): iterable
328
328
329
329
[
330
330
new Expr \BinaryOp \BooleanOr (
331
- $ this -> createFunctionCall ('is_int ' ),
332
- $ this -> createFunctionCall ('is_string ' ),
331
+ self :: createFunctionCall ('is_int ' ),
332
+ self :: createFunctionCall ('is_string ' ),
333
333
),
334
334
['$foo ' => 'int|string ' ],
335
335
['$foo ' => '~int|string ' ],
336
336
],
337
337
[
338
338
new Expr \BinaryOp \BooleanOr (
339
- $ this -> createFunctionCall ('is_int ' ),
339
+ self :: createFunctionCall ('is_int ' ),
340
340
new Expr \BinaryOp \BooleanOr (
341
- $ this -> createFunctionCall ('is_string ' ),
342
- $ this -> createFunctionCall ('is_bool ' ),
341
+ self :: createFunctionCall ('is_string ' ),
342
+ self :: createFunctionCall ('is_bool ' ),
343
343
),
344
344
),
345
345
['$foo ' => 'bool|int|string ' ],
346
346
['$foo ' => '~bool|int|string ' ],
347
347
],
348
348
[
349
349
new Expr \BinaryOp \BooleanOr (
350
- $ this -> createFunctionCall ('is_int ' , 'foo ' ),
351
- $ this -> createFunctionCall ('is_string ' , 'bar ' ),
350
+ self :: createFunctionCall ('is_int ' , 'foo ' ),
351
+ self :: createFunctionCall ('is_string ' , 'bar ' ),
352
352
),
353
353
[],
354
354
['$foo ' => '~int ' , '$bar ' => '~string ' ],
355
355
],
356
356
[
357
357
new Expr \BinaryOp \BooleanAnd (
358
358
new Expr \BinaryOp \BooleanOr (
359
- $ this -> createFunctionCall ('is_int ' , 'foo ' ),
360
- $ this -> createFunctionCall ('is_string ' , 'foo ' ),
359
+ self :: createFunctionCall ('is_int ' , 'foo ' ),
360
+ self :: createFunctionCall ('is_string ' , 'foo ' ),
361
361
),
362
- $ this -> createFunctionCall ('random ' ),
362
+ self :: createFunctionCall ('random ' ),
363
363
),
364
364
['$foo ' => 'int|string ' ],
365
365
[],
366
366
],
367
367
[
368
368
new Expr \BinaryOp \BooleanOr (
369
369
new Expr \BinaryOp \BooleanAnd (
370
- $ this -> createFunctionCall ('is_int ' , 'foo ' ),
371
- $ this -> createFunctionCall ('is_string ' , 'foo ' ),
370
+ self :: createFunctionCall ('is_int ' , 'foo ' ),
371
+ self :: createFunctionCall ('is_string ' , 'foo ' ),
372
372
),
373
- $ this -> createFunctionCall ('random ' ),
373
+ self :: createFunctionCall ('random ' ),
374
374
),
375
375
[],
376
376
['$foo ' => 'mixed ' ],
377
377
],
378
378
[
379
379
new Expr \BinaryOp \BooleanOr (
380
380
new Expr \BinaryOp \BooleanAnd (
381
- $ this -> createFunctionCall ('is_int ' , 'foo ' ),
382
- $ this -> createFunctionCall ('is_string ' , 'bar ' ),
381
+ self :: createFunctionCall ('is_int ' , 'foo ' ),
382
+ self :: createFunctionCall ('is_string ' , 'bar ' ),
383
383
),
384
- $ this -> createFunctionCall ('random ' ),
384
+ self :: createFunctionCall ('random ' ),
385
385
),
386
386
[],
387
387
[],
388
388
],
389
389
[
390
390
new Expr \BinaryOp \BooleanOr (
391
391
new Expr \BinaryOp \BooleanAnd (
392
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' , 'foo ' )),
393
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_string ' , 'foo ' )),
392
+ new Expr \BooleanNot (self :: createFunctionCall ('is_int ' , 'foo ' )),
393
+ new Expr \BooleanNot (self :: createFunctionCall ('is_string ' , 'foo ' )),
394
394
),
395
- $ this -> createFunctionCall ('random ' ),
395
+ self :: createFunctionCall ('random ' ),
396
396
),
397
397
[],
398
398
['$foo ' => 'int|string ' ],
399
399
],
400
400
[
401
401
new Expr \BinaryOp \BooleanAnd (
402
402
new Expr \BinaryOp \BooleanOr (
403
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_int ' , 'foo ' )),
404
- new Expr \BooleanNot ($ this -> createFunctionCall ('is_string ' , 'foo ' )),
403
+ new Expr \BooleanNot (self :: createFunctionCall ('is_int ' , 'foo ' )),
404
+ new Expr \BooleanNot (self :: createFunctionCall ('is_string ' , 'foo ' )),
405
405
),
406
- $ this -> createFunctionCall ('random ' ),
406
+ self :: createFunctionCall ('random ' ),
407
407
),
408
408
['$foo ' => 'mixed ' ],
409
409
[],
@@ -427,39 +427,39 @@ public static function dataCondition(): iterable
427
427
],
428
428
[
429
429
new Identical (
430
- $ this -> createFunctionCall ('is_int ' ),
430
+ self :: createFunctionCall ('is_int ' ),
431
431
new Expr \ConstFetch (new Name ('true ' )),
432
432
),
433
433
['is_int($foo) ' => 'true ' , '$foo ' => 'int ' ],
434
434
['is_int($foo) ' => '~true ' , '$foo ' => '~int ' ],
435
435
],
436
436
[
437
437
new Identical (
438
- $ this -> createFunctionCall ('is_string ' ),
438
+ self :: createFunctionCall ('is_string ' ),
439
439
new Expr \ConstFetch (new Name ('true ' )),
440
440
),
441
441
['is_string($foo) ' => 'true ' , '$foo ' => 'string ' ],
442
442
['is_string($foo) ' => '~true ' , '$foo ' => '~string ' ],
443
443
],
444
444
[
445
445
new Identical (
446
- $ this -> createFunctionCall ('is_int ' ),
446
+ self :: createFunctionCall ('is_int ' ),
447
447
new Expr \ConstFetch (new Name ('false ' )),
448
448
),
449
449
['is_int($foo) ' => 'false ' , '$foo ' => '~int ' ],
450
450
['$foo ' => 'int ' , 'is_int($foo) ' => '~false ' ],
451
451
],
452
452
[
453
453
new Equal (
454
- $ this -> createFunctionCall ('is_int ' ),
454
+ self :: createFunctionCall ('is_int ' ),
455
455
new Expr \ConstFetch (new Name ('true ' )),
456
456
),
457
457
['$foo ' => 'int ' ],
458
458
['$foo ' => '~int ' ],
459
459
],
460
460
[
461
461
new Equal (
462
- $ this -> createFunctionCall ('is_int ' ),
462
+ self :: createFunctionCall ('is_int ' ),
463
463
new Expr \ConstFetch (new Name ('false ' )),
464
464
),
465
465
['$foo ' => '~int ' ],
@@ -1183,7 +1183,7 @@ public static function dataCondition(): iterable
1183
1183
[
1184
1184
new Expr \BinaryOp \BooleanOr (
1185
1185
new Expr \BinaryOp \BooleanAnd (
1186
- $ this -> createFunctionCall ('is_string ' , 'a ' ),
1186
+ self :: createFunctionCall ('is_string ' , 'a ' ),
1187
1187
new NotIdentical (new String_ ('' ), new Variable ('a ' )),
1188
1188
),
1189
1189
new Identical (new Expr \ConstFetch (new Name ('null ' )), new Variable ('a ' )),
@@ -1194,9 +1194,9 @@ public static function dataCondition(): iterable
1194
1194
[
1195
1195
new Expr \BinaryOp \BooleanOr (
1196
1196
new Expr \BinaryOp \BooleanAnd (
1197
- $ this -> createFunctionCall ('is_string ' , 'a ' ),
1197
+ self :: createFunctionCall ('is_string ' , 'a ' ),
1198
1198
new Expr \BinaryOp \Greater (
1199
- $ this -> createFunctionCall ('strlen ' , 'a ' ),
1199
+ self :: createFunctionCall ('strlen ' , 'a ' ),
1200
1200
new LNumber (0 ),
1201
1201
),
1202
1202
),
@@ -1208,9 +1208,9 @@ public static function dataCondition(): iterable
1208
1208
[
1209
1209
new Expr \BinaryOp \BooleanOr (
1210
1210
new Expr \BinaryOp \BooleanAnd (
1211
- $ this -> createFunctionCall ('is_array ' , 'a ' ),
1211
+ self :: createFunctionCall ('is_array ' , 'a ' ),
1212
1212
new Expr \BinaryOp \Greater (
1213
- $ this -> createFunctionCall ('count ' , 'a ' ),
1213
+ self :: createFunctionCall ('count ' , 'a ' ),
1214
1214
new LNumber (0 ),
1215
1215
),
1216
1216
),
@@ -1221,7 +1221,7 @@ public static function dataCondition(): iterable
1221
1221
],
1222
1222
[
1223
1223
new Expr \BinaryOp \BooleanAnd (
1224
- $ this -> createFunctionCall ('is_array ' , 'foo ' ),
1224
+ self :: createFunctionCall ('is_array ' , 'foo ' ),
1225
1225
new Identical (
1226
1226
new FuncCall (
1227
1227
new Name ('array_filter ' ),
@@ -1238,7 +1238,7 @@ public static function dataCondition(): iterable
1238
1238
],
1239
1239
[
1240
1240
new Expr \BinaryOp \BooleanAnd (
1241
- $ this -> createFunctionCall ('is_array ' , 'foo ' ),
1241
+ self :: createFunctionCall ('is_array ' , 'foo ' ),
1242
1242
new Expr \BinaryOp \GreaterOrEqual (
1243
1243
new FuncCall (
1244
1244
new Name ('count ' ),
@@ -1255,7 +1255,7 @@ public static function dataCondition(): iterable
1255
1255
],
1256
1256
[
1257
1257
new Expr \BinaryOp \BooleanAnd (
1258
- $ this -> createFunctionCall ('is_array ' , 'foo ' ),
1258
+ self :: createFunctionCall ('is_array ' , 'foo ' ),
1259
1259
new Identical (
1260
1260
new FuncCall (
1261
1261
new Name ('count ' ),
@@ -1272,7 +1272,7 @@ public static function dataCondition(): iterable
1272
1272
],
1273
1273
[
1274
1274
new Expr \BinaryOp \BooleanAnd (
1275
- $ this -> createFunctionCall ('is_string ' , 'foo ' ),
1275
+ self :: createFunctionCall ('is_string ' , 'foo ' ),
1276
1276
new NotIdentical (
1277
1277
new FuncCall (
1278
1278
new Name ('strlen ' ),
@@ -1291,7 +1291,7 @@ public static function dataCondition(): iterable
1291
1291
],
1292
1292
[
1293
1293
new Expr \BinaryOp \BooleanAnd (
1294
- $ this -> createFunctionCall ('is_numeric ' , 'int ' ),
1294
+ self :: createFunctionCall ('is_numeric ' , 'int ' ),
1295
1295
new Expr \BinaryOp \Equal (
1296
1296
new Variable ('int ' ),
1297
1297
new Expr \Cast \Int_ (new Variable ('int ' )),
@@ -1305,7 +1305,7 @@ public static function dataCondition(): iterable
1305
1305
],
1306
1306
[
1307
1307
new Expr \BinaryOp \BooleanAnd (
1308
- $ this -> createFunctionCall ('is_numeric ' , 'float ' ),
1308
+ self :: createFunctionCall ('is_numeric ' , 'float ' ),
1309
1309
new Expr \BinaryOp \Equal (
1310
1310
new Variable ('float ' ),
1311
1311
new Expr \Cast \Int_ (new Variable ('float ' )),
@@ -1346,15 +1346,15 @@ private function toReadableResult(SpecifiedTypes $specifiedTypes): array
1346
1346
/**
1347
1347
* @param non-empty-string $className
1348
1348
*/
1349
- private function createInstanceOf (string $ className , string $ variableName = 'foo ' ): Expr \Instanceof_
1349
+ private static function createInstanceOf (string $ className , string $ variableName = 'foo ' ): Expr \Instanceof_
1350
1350
{
1351
1351
return new Expr \Instanceof_ (new Variable ($ variableName ), new Name ($ className ));
1352
1352
}
1353
1353
1354
1354
/**
1355
1355
* @param non-empty-string $functionName
1356
1356
*/
1357
- private function createFunctionCall (string $ functionName , string $ variableName = 'foo ' ): FuncCall
1357
+ private static function createFunctionCall (string $ functionName , string $ variableName = 'foo ' ): FuncCall
1358
1358
{
1359
1359
return new FuncCall (new Name ($ functionName ), [new Arg (new Variable ($ variableName ))]);
1360
1360
}
0 commit comments