Skip to content

Commit 8c4b49b

Browse files
committed
More fixes
1 parent 25a0380 commit 8c4b49b

File tree

2 files changed

+64
-64
lines changed

2 files changed

+64
-64
lines changed

tests/PHPStan/Analyser/TypeSpecifierTest.php

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -131,86 +131,86 @@ public static function dataCondition(): iterable
131131
}
132132
yield from [
133133
[
134-
$this->createFunctionCall('is_int'),
134+
self::createFunctionCall('is_int'),
135135
['$foo' => 'int'],
136136
['$foo' => '~int'],
137137
],
138138
[
139-
$this->createFunctionCall('is_numeric'),
139+
self::createFunctionCall('is_numeric'),
140140
['$foo' => 'float|int|numeric-string'],
141141
['$foo' => '~float|int|numeric-string'],
142142
],
143143
[
144-
$this->createFunctionCall('is_scalar'),
144+
self::createFunctionCall('is_scalar'),
145145
['$foo' => 'bool|float|int|string'],
146146
['$foo' => '~bool|float|int|string'],
147147
],
148148
[
149149
new Expr\BinaryOp\BooleanAnd(
150-
$this->createFunctionCall('is_int'),
151-
$this->createFunctionCall('random'),
150+
self::createFunctionCall('is_int'),
151+
self::createFunctionCall('random'),
152152
),
153153
['$foo' => 'int'],
154154
[],
155155
],
156156
[
157157
new Expr\BinaryOp\BooleanOr(
158-
$this->createFunctionCall('is_int'),
159-
$this->createFunctionCall('random'),
158+
self::createFunctionCall('is_int'),
159+
self::createFunctionCall('random'),
160160
),
161161
[],
162162
['$foo' => '~int'],
163163
],
164164
[
165165
new Expr\BinaryOp\LogicalAnd(
166-
$this->createFunctionCall('is_int'),
167-
$this->createFunctionCall('random'),
166+
self::createFunctionCall('is_int'),
167+
self::createFunctionCall('random'),
168168
),
169169
['$foo' => 'int'],
170170
[],
171171
],
172172
[
173173
new Expr\BinaryOp\LogicalOr(
174-
$this->createFunctionCall('is_int'),
175-
$this->createFunctionCall('random'),
174+
self::createFunctionCall('is_int'),
175+
self::createFunctionCall('random'),
176176
),
177177
[],
178178
['$foo' => '~int'],
179179
],
180180
[
181-
new Expr\BooleanNot($this->createFunctionCall('is_int')),
181+
new Expr\BooleanNot(self::createFunctionCall('is_int')),
182182
['$foo' => '~int'],
183183
['$foo' => 'int'],
184184
],
185185

186186
[
187187
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'),
190190
),
191191
['$foo' => '~int'],
192192
[],
193193
],
194194
[
195195
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'),
198198
),
199199
[],
200200
['$foo' => 'int'],
201201
],
202202
[
203-
new Expr\BooleanNot(new Expr\BooleanNot($this->createFunctionCall('is_int'))),
203+
new Expr\BooleanNot(new Expr\BooleanNot(self::createFunctionCall('is_int'))),
204204
['$foo' => 'int'],
205205
['$foo' => '~int'],
206206
],
207207
[
208-
$this->createInstanceOf('Foo'),
208+
self::createInstanceOf('Foo'),
209209
['$foo' => 'Foo'],
210210
['$foo' => '~Foo'],
211211
],
212212
[
213-
new Expr\BooleanNot($this->createInstanceOf('Foo')),
213+
new Expr\BooleanNot(self::createInstanceOf('Foo')),
214214
['$foo' => '~Foo'],
215215
['$foo' => 'Foo'],
216216
],
@@ -280,15 +280,15 @@ public static function dataCondition(): iterable
280280
[
281281
new Expr\BinaryOp\BooleanAnd(
282282
new Variable('foo'),
283-
$this->createFunctionCall('random'),
283+
self::createFunctionCall('random'),
284284
),
285285
['$foo' => self::SURE_NOT_FALSEY],
286286
[],
287287
],
288288
[
289289
new Expr\BinaryOp\BooleanOr(
290290
new Variable('foo'),
291-
$this->createFunctionCall('random'),
291+
self::createFunctionCall('random'),
292292
),
293293
[],
294294
['$foo' => self::SURE_NOT_TRUTHY],
@@ -307,15 +307,15 @@ public static function dataCondition(): iterable
307307
[
308308
new Expr\BinaryOp\BooleanAnd(
309309
new PropertyFetch(new Variable('this'), 'foo'),
310-
$this->createFunctionCall('random'),
310+
self::createFunctionCall('random'),
311311
),
312312
['$this->foo' => self::SURE_NOT_FALSEY],
313313
[],
314314
],
315315
[
316316
new Expr\BinaryOp\BooleanOr(
317317
new PropertyFetch(new Variable('this'), 'foo'),
318-
$this->createFunctionCall('random'),
318+
self::createFunctionCall('random'),
319319
),
320320
[],
321321
['$this->foo' => self::SURE_NOT_TRUTHY],
@@ -328,82 +328,82 @@ public static function dataCondition(): iterable
328328

329329
[
330330
new Expr\BinaryOp\BooleanOr(
331-
$this->createFunctionCall('is_int'),
332-
$this->createFunctionCall('is_string'),
331+
self::createFunctionCall('is_int'),
332+
self::createFunctionCall('is_string'),
333333
),
334334
['$foo' => 'int|string'],
335335
['$foo' => '~int|string'],
336336
],
337337
[
338338
new Expr\BinaryOp\BooleanOr(
339-
$this->createFunctionCall('is_int'),
339+
self::createFunctionCall('is_int'),
340340
new Expr\BinaryOp\BooleanOr(
341-
$this->createFunctionCall('is_string'),
342-
$this->createFunctionCall('is_bool'),
341+
self::createFunctionCall('is_string'),
342+
self::createFunctionCall('is_bool'),
343343
),
344344
),
345345
['$foo' => 'bool|int|string'],
346346
['$foo' => '~bool|int|string'],
347347
],
348348
[
349349
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'),
352352
),
353353
[],
354354
['$foo' => '~int', '$bar' => '~string'],
355355
],
356356
[
357357
new Expr\BinaryOp\BooleanAnd(
358358
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'),
361361
),
362-
$this->createFunctionCall('random'),
362+
self::createFunctionCall('random'),
363363
),
364364
['$foo' => 'int|string'],
365365
[],
366366
],
367367
[
368368
new Expr\BinaryOp\BooleanOr(
369369
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'),
372372
),
373-
$this->createFunctionCall('random'),
373+
self::createFunctionCall('random'),
374374
),
375375
[],
376376
['$foo' => 'mixed'],
377377
],
378378
[
379379
new Expr\BinaryOp\BooleanOr(
380380
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'),
383383
),
384-
$this->createFunctionCall('random'),
384+
self::createFunctionCall('random'),
385385
),
386386
[],
387387
[],
388388
],
389389
[
390390
new Expr\BinaryOp\BooleanOr(
391391
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')),
394394
),
395-
$this->createFunctionCall('random'),
395+
self::createFunctionCall('random'),
396396
),
397397
[],
398398
['$foo' => 'int|string'],
399399
],
400400
[
401401
new Expr\BinaryOp\BooleanAnd(
402402
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')),
405405
),
406-
$this->createFunctionCall('random'),
406+
self::createFunctionCall('random'),
407407
),
408408
['$foo' => 'mixed'],
409409
[],
@@ -427,39 +427,39 @@ public static function dataCondition(): iterable
427427
],
428428
[
429429
new Identical(
430-
$this->createFunctionCall('is_int'),
430+
self::createFunctionCall('is_int'),
431431
new Expr\ConstFetch(new Name('true')),
432432
),
433433
['is_int($foo)' => 'true', '$foo' => 'int'],
434434
['is_int($foo)' => '~true', '$foo' => '~int'],
435435
],
436436
[
437437
new Identical(
438-
$this->createFunctionCall('is_string'),
438+
self::createFunctionCall('is_string'),
439439
new Expr\ConstFetch(new Name('true')),
440440
),
441441
['is_string($foo)' => 'true', '$foo' => 'string'],
442442
['is_string($foo)' => '~true', '$foo' => '~string'],
443443
],
444444
[
445445
new Identical(
446-
$this->createFunctionCall('is_int'),
446+
self::createFunctionCall('is_int'),
447447
new Expr\ConstFetch(new Name('false')),
448448
),
449449
['is_int($foo)' => 'false', '$foo' => '~int'],
450450
['$foo' => 'int', 'is_int($foo)' => '~false'],
451451
],
452452
[
453453
new Equal(
454-
$this->createFunctionCall('is_int'),
454+
self::createFunctionCall('is_int'),
455455
new Expr\ConstFetch(new Name('true')),
456456
),
457457
['$foo' => 'int'],
458458
['$foo' => '~int'],
459459
],
460460
[
461461
new Equal(
462-
$this->createFunctionCall('is_int'),
462+
self::createFunctionCall('is_int'),
463463
new Expr\ConstFetch(new Name('false')),
464464
),
465465
['$foo' => '~int'],
@@ -1183,7 +1183,7 @@ public static function dataCondition(): iterable
11831183
[
11841184
new Expr\BinaryOp\BooleanOr(
11851185
new Expr\BinaryOp\BooleanAnd(
1186-
$this->createFunctionCall('is_string', 'a'),
1186+
self::createFunctionCall('is_string', 'a'),
11871187
new NotIdentical(new String_(''), new Variable('a')),
11881188
),
11891189
new Identical(new Expr\ConstFetch(new Name('null')), new Variable('a')),
@@ -1194,9 +1194,9 @@ public static function dataCondition(): iterable
11941194
[
11951195
new Expr\BinaryOp\BooleanOr(
11961196
new Expr\BinaryOp\BooleanAnd(
1197-
$this->createFunctionCall('is_string', 'a'),
1197+
self::createFunctionCall('is_string', 'a'),
11981198
new Expr\BinaryOp\Greater(
1199-
$this->createFunctionCall('strlen', 'a'),
1199+
self::createFunctionCall('strlen', 'a'),
12001200
new LNumber(0),
12011201
),
12021202
),
@@ -1208,9 +1208,9 @@ public static function dataCondition(): iterable
12081208
[
12091209
new Expr\BinaryOp\BooleanOr(
12101210
new Expr\BinaryOp\BooleanAnd(
1211-
$this->createFunctionCall('is_array', 'a'),
1211+
self::createFunctionCall('is_array', 'a'),
12121212
new Expr\BinaryOp\Greater(
1213-
$this->createFunctionCall('count', 'a'),
1213+
self::createFunctionCall('count', 'a'),
12141214
new LNumber(0),
12151215
),
12161216
),
@@ -1221,7 +1221,7 @@ public static function dataCondition(): iterable
12211221
],
12221222
[
12231223
new Expr\BinaryOp\BooleanAnd(
1224-
$this->createFunctionCall('is_array', 'foo'),
1224+
self::createFunctionCall('is_array', 'foo'),
12251225
new Identical(
12261226
new FuncCall(
12271227
new Name('array_filter'),
@@ -1238,7 +1238,7 @@ public static function dataCondition(): iterable
12381238
],
12391239
[
12401240
new Expr\BinaryOp\BooleanAnd(
1241-
$this->createFunctionCall('is_array', 'foo'),
1241+
self::createFunctionCall('is_array', 'foo'),
12421242
new Expr\BinaryOp\GreaterOrEqual(
12431243
new FuncCall(
12441244
new Name('count'),
@@ -1255,7 +1255,7 @@ public static function dataCondition(): iterable
12551255
],
12561256
[
12571257
new Expr\BinaryOp\BooleanAnd(
1258-
$this->createFunctionCall('is_array', 'foo'),
1258+
self::createFunctionCall('is_array', 'foo'),
12591259
new Identical(
12601260
new FuncCall(
12611261
new Name('count'),
@@ -1272,7 +1272,7 @@ public static function dataCondition(): iterable
12721272
],
12731273
[
12741274
new Expr\BinaryOp\BooleanAnd(
1275-
$this->createFunctionCall('is_string', 'foo'),
1275+
self::createFunctionCall('is_string', 'foo'),
12761276
new NotIdentical(
12771277
new FuncCall(
12781278
new Name('strlen'),
@@ -1291,7 +1291,7 @@ public static function dataCondition(): iterable
12911291
],
12921292
[
12931293
new Expr\BinaryOp\BooleanAnd(
1294-
$this->createFunctionCall('is_numeric', 'int'),
1294+
self::createFunctionCall('is_numeric', 'int'),
12951295
new Expr\BinaryOp\Equal(
12961296
new Variable('int'),
12971297
new Expr\Cast\Int_(new Variable('int')),
@@ -1305,7 +1305,7 @@ public static function dataCondition(): iterable
13051305
],
13061306
[
13071307
new Expr\BinaryOp\BooleanAnd(
1308-
$this->createFunctionCall('is_numeric', 'float'),
1308+
self::createFunctionCall('is_numeric', 'float'),
13091309
new Expr\BinaryOp\Equal(
13101310
new Variable('float'),
13111311
new Expr\Cast\Int_(new Variable('float')),
@@ -1346,15 +1346,15 @@ private function toReadableResult(SpecifiedTypes $specifiedTypes): array
13461346
/**
13471347
* @param non-empty-string $className
13481348
*/
1349-
private function createInstanceOf(string $className, string $variableName = 'foo'): Expr\Instanceof_
1349+
private static function createInstanceOf(string $className, string $variableName = 'foo'): Expr\Instanceof_
13501350
{
13511351
return new Expr\Instanceof_(new Variable($variableName), new Name($className));
13521352
}
13531353

13541354
/**
13551355
* @param non-empty-string $functionName
13561356
*/
1357-
private function createFunctionCall(string $functionName, string $variableName = 'foo'): FuncCall
1357+
private static function createFunctionCall(string $functionName, string $variableName = 'foo'): FuncCall
13581358
{
13591359
return new FuncCall(new Name($functionName), [new Arg(new Variable($variableName))]);
13601360
}

0 commit comments

Comments
 (0)