You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4be03a5
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,6 @@ public function testBug7171(): void
152
152
[
153
153
'Parameter $repositoryClass of attribute class Bug7171\Entity constructor expects class-string<Bug7171\EntityRepository<T of object>>|null, \'stdClass\' given.',
154
154
66,
155
-
'Type #1 from the union: Classes Bug7171\EntityRepository<T of object> and stdClass are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php
+3-19Lines changed: 3 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,6 @@ public function testInstanceof(): void
78
78
[
79
79
'Instanceof between ImpossibleInstanceOf\Dolor and ImpossibleInstanceOf\Lorem will always evaluate to false.',
80
80
71,
81
-
'Classes ImpossibleInstanceOf\Lorem and ImpossibleInstanceOf\Dolor are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
82
81
],
83
82
[
84
83
'Instanceof between ImpossibleInstanceOf\FooImpl and ImpossibleInstanceOf\Foo will always evaluate to true.',
@@ -103,7 +102,6 @@ public function testInstanceof(): void
103
102
[
104
103
'Instanceof between ImpossibleInstanceOf\Test|null and ImpossibleInstanceOf\Lorem will always evaluate to false.',
105
104
119,
106
-
'Classes ImpossibleInstanceOf\Lorem and ImpossibleInstanceOf\Test are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
107
105
],
108
106
[
109
107
'Instanceof between ImpossibleInstanceOf\Test and ImpossibleInstanceOf\Test will always evaluate to true.',
@@ -112,7 +110,6 @@ public function testInstanceof(): void
112
110
[
113
111
'Instanceof between ImpossibleInstanceOf\Test|null and ImpossibleInstanceOf\Lorem will always evaluate to false.',
114
112
137,
115
-
'Classes ImpossibleInstanceOf\Lorem and ImpossibleInstanceOf\Test are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
116
113
],
117
114
[
118
115
'Instanceof between ImpossibleInstanceOf\Test and ImpossibleInstanceOf\Test will always evaluate to true.',
@@ -121,7 +118,6 @@ public function testInstanceof(): void
121
118
[
122
119
'Instanceof between ImpossibleInstanceOf\Test|null and ImpossibleInstanceOf\Lorem will always evaluate to false.',
123
120
155,
124
-
'Classes ImpossibleInstanceOf\Lorem and ImpossibleInstanceOf\Test are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
125
121
],
126
122
[
127
123
'Instanceof between ImpossibleInstanceOf\Test and ImpossibleInstanceOf\Test will always evaluate to true.',
@@ -228,7 +224,6 @@ public function testDoNotReportTypesFromPhpDocs(): void
228
224
[
229
225
'Instanceof between stdClass and Exception will always evaluate to false.',
230
226
15,
231
-
'Classes Exception and stdClass are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
232
227
],
233
228
[
234
229
'Instanceof between DateTimeInterface and DateTimeInterface will always evaluate to true.',
@@ -237,7 +232,6 @@ public function testDoNotReportTypesFromPhpDocs(): void
237
232
[
238
233
'Instanceof between DateTimeInterface and ImpossibleInstanceofNotPhpDoc\SomeFinalClass will always evaluate to false.',
239
234
30,
240
-
'Final class ImpossibleInstanceofNotPhpDoc\SomeFinalClass does not implement interface DateTimeInterface.',
241
235
],
242
236
]);
243
237
}
@@ -253,7 +247,6 @@ public function testReportTypesFromPhpDocs(): void
253
247
[
254
248
'Instanceof between stdClass and Exception will always evaluate to false.',
255
249
15,
256
-
'Classes Exception and stdClass are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
257
250
],
258
251
[
259
252
'Instanceof between DateTimeImmutable and DateTimeInterface will always evaluate to true.',
@@ -262,7 +255,6 @@ public function testReportTypesFromPhpDocs(): void
262
255
[
263
256
'Instanceof between DateTimeImmutable and ImpossibleInstanceofNotPhpDoc\SomeFinalClass will always evaluate to false.',
264
257
30,
265
-
'Classes ImpossibleInstanceofNotPhpDoc\SomeFinalClass and DateTimeImmutable are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
266
258
],
267
259
[
268
260
'Instanceof between DateTimeImmutable and DateTimeImmutable will always evaluate to true.',
@@ -272,7 +264,6 @@ public function testReportTypesFromPhpDocs(): void
272
264
[
273
265
'Instanceof between DateTimeImmutable and DateTime will always evaluate to false.',
274
266
36,
275
-
'Classes DateTime and DateTimeImmutable are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
276
267
//'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
277
268
],
278
269
]);
@@ -578,37 +569,30 @@ public function testNewIsAlwaysFinalClass(): void
578
569
[
579
570
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
580
571
17,
581
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
582
572
],
583
573
[
584
574
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
585
575
33,
586
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
587
576
],
588
577
[
589
578
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
590
579
43,
591
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
592
580
],
593
581
[
594
582
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
595
583
53,
596
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
597
584
],
598
585
[
599
586
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
600
587
63,
601
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
602
588
],
603
589
[
604
590
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar|null and ImpossibleInstanceofNewIsAlwaysFinal\Foo will always evaluate to false.',
605
591
73,
606
-
'Final class ImpossibleInstanceofNewIsAlwaysFinal\Bar does not implement interface ImpossibleInstanceofNewIsAlwaysFinal\Foo.',
607
592
],
608
593
[
609
594
'Instanceof between ImpossibleInstanceofNewIsAlwaysFinal\Bar|null and ImpossibleInstanceofNewIsAlwaysFinal\Baz will always evaluate to false.',
610
595
88,
611
-
'Classes ImpossibleInstanceofNewIsAlwaysFinal\Baz and ImpossibleInstanceofNewIsAlwaysFinal\Bar are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
612
596
],
613
597
]);
614
598
}
@@ -620,7 +604,6 @@ public function testBug13469(): void
620
604
[
621
605
sprintf('Instanceof between Bug13469\Foo and Stringable will always evaluate to %s.', PHP_VERSION_ID >= 80000 ? 'true' : 'false'),
622
606
23,
623
-
PHP_VERSION_ID < 80000 ? 'Final class Bug13469\Foo does not implement interface Stringable.' : null,
624
607
],
625
608
]);
626
609
}
@@ -661,16 +644,17 @@ public function testPossiblyImpureTip(): void
661
644
publicfunctiontestInTrait(): void
662
645
{
663
646
$this->treatPhpDocTypesAsCertain = true;
647
+
$tipText = 'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.';
'Instanceof between ImpossibleInstanceofInTrait\Cat and stdClass will always evaluate to false.',
667
651
25,
668
-
'Classes stdClass and ImpossibleInstanceofInTrait\Cat are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
652
+
$tipText,
669
653
],
670
654
[
671
655
'Instanceof between ImpossibleInstanceofInTrait\Dog and stdClass will always evaluate to false.',
672
656
25,
673
-
'Classes stdClass and ImpossibleInstanceofInTrait\Dog are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
'Call to function is_a() with CheckTypeFunctionCallReasons\Foo and \'CheckTypeFunctionCallReasons\\\\Bar\' will always evaluate to false.',
303
-
23,
304
-
'Final class CheckTypeFunctionCallReasons\Foo does not implement interface CheckTypeFunctionCallReasons\Bar.',
305
-
],
306
-
[
307
-
'Call to function is_a() with CheckTypeFunctionCallReasons\Baz and \'CheckTypeFunctionCallReasons\\\\Foo\' will always evaluate to false.',
308
-
28,
309
-
'Classes CheckTypeFunctionCallReasons\Foo and CheckTypeFunctionCallReasons\Baz are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -581,7 +581,7 @@ public function testBug3633(): void
581
581
[
582
582
'Strict comparison using === between class-string<$this(Bug3633\HelloWorld)> and \'Bug3633\\\OtherClass\' will always evaluate to false.',
583
583
37,
584
-
'Classes Bug3633\HelloWorld and Bug3633\OtherClass are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
584
+
$tipText,
585
585
],
586
586
[
587
587
'Strict comparison using === between \'Bug3633\\\HelloWorld\' and \'Bug3633\\\HelloWorld\' will always evaluate to true.',
@@ -595,7 +595,7 @@ public function testBug3633(): void
595
595
[
596
596
'Strict comparison using === between class-string<$this(Bug3633\OtherClass)> and \'Bug3633\\\HelloWorld\' will always evaluate to false.',
597
597
64,
598
-
'Classes Bug3633\OtherClass and Bug3633\HelloWorld are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
598
+
$tipText,
599
599
],
600
600
[
601
601
'Strict comparison using === between \'Bug3633\\\OtherClass\' and \'Bug3633\\\HelloWorld\' will always evaluate to false.',
@@ -610,12 +610,12 @@ public function testBug3633(): void
610
610
[
611
611
'Strict comparison using === between class-string<$this(Bug3633\FinalClass)> and \'Bug3633\\\HelloWorld\' will always evaluate to false.',
612
612
93,
613
-
'Classes Bug3633\FinalClass and Bug3633\HelloWorld are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
613
+
$tipText,
614
614
],
615
615
[
616
616
'Strict comparison using === between class-string<$this(Bug3633\FinalClass)> and \'Bug3633\\\OtherClass\' will always evaluate to false.',
617
617
96,
618
-
'Classes Bug3633\FinalClass and Bug3633\OtherClass are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
618
+
$tipText,
619
619
],
620
620
[
621
621
'Strict comparison using === between \'Bug3633\\\FinalClass\' and \'Bug3633\\\FinalClass\' will always evaluate to true.',
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -262,12 +262,10 @@ public static function dataIntersectionTypes(): array
262
262
[
263
263
'Parameter $a of anonymous function has unresolvable native type.',
264
264
27,
265
-
'Classes ArrowFunctionIntersectionTypes\Ipsum and ArrowFunctionIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
266
265
],
267
266
[
268
267
'Anonymous function has unresolvable native return type.',
269
268
27,
270
-
'Classes ArrowFunctionIntersectionTypes\Ipsum and ArrowFunctionIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
271
269
],
272
270
[
273
271
'Parameter $a of anonymous function has unresolvable native type.',
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Functions/ExistingClassesInClosureTypehintsRuleTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -321,12 +321,10 @@ public static function dataIntersectionTypes(): array
321
321
[
322
322
'Parameter $a of anonymous function has unresolvable native type.',
323
323
30,
324
-
'Classes ClosureIntersectionTypes\Ipsum and ClosureIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
325
324
],
326
325
[
327
326
'Anonymous function has unresolvable native return type.',
328
327
30,
329
-
'Classes ClosureIntersectionTypes\Ipsum and ClosureIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
330
328
],
331
329
[
332
330
'Parameter $a of anonymous function has unresolvable native type.',
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Functions/ExistingClassesInTypehintsRuleTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -391,12 +391,10 @@ public static function dataIntersectionTypes(): array
391
391
[
392
392
'Parameter $a of function FunctionIntersectionTypes\doBar() has unresolvable native type.',
393
393
30,
394
-
'Classes FunctionIntersectionTypes\Ipsum and FunctionIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
395
394
],
396
395
[
397
396
'Function FunctionIntersectionTypes\doBar() has unresolvable native return type.',
398
397
30,
399
-
'Classes FunctionIntersectionTypes\Ipsum and FunctionIntersectionTypes\Lorem are not in an inheritance relationship and because of single inheritance no object can be an instance of both.',
400
398
],
401
399
[
402
400
'Parameter $a of function FunctionIntersectionTypes\doBaz() has unresolvable native type.',
0 commit comments