File tree Expand file tree Collapse file tree
tests/PHPStan/Rules/Comparison Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace PHPStan \Rules \Comparison ;
4+
5+ use PHPStan \Analyser \RicherScopeGetTypeHelper ;
6+ use PHPStan \Rules \Rule ;
7+ use PHPStan \Testing \RuleTestCase ;
8+ use function array_merge ;
9+
10+ /**
11+ * @extends RuleTestCase<StrictComparisonOfDifferentTypesRule>
12+ */
13+ class Bug14534Test extends RuleTestCase
14+ {
15+
16+ protected function getRule (): Rule
17+ {
18+ return new StrictComparisonOfDifferentTypesRule (
19+ self ::getContainer ()->getByType (RicherScopeGetTypeHelper::class),
20+ new PossiblyImpureTipHelper (true ),
21+ true ,
22+ true ,
23+ true ,
24+ );
25+ }
26+
27+ public function testRule (): void
28+ {
29+ $ this ->analyse ([__DIR__ . '/data/bug-14534.php ' ], []);
30+ }
31+
32+ public static function getAdditionalConfigFiles (): array
33+ {
34+ return array_merge (
35+ parent ::getAdditionalConfigFiles (),
36+ [__DIR__ . '/bug-14534.neon ' ],
37+ );
38+ }
39+
40+ }
Original file line number Diff line number Diff line change 1+ parameters :
2+ stubFiles :
3+ - data/bug-14534.stub
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug14534 ;
4+
5+ function test (\SplFileObject $ spl ): bool
6+ {
7+ if ($ spl ->key () === 1 ) {
8+ return $ spl ->key () === 1 ;
9+ }
10+
11+ return false ;
12+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @phpstan-all-methods-impure
5+ */
6+ class SplFileObject {}
You can’t perform that action at this time.
0 commit comments