Skip to content

Commit 436e6d3

Browse files
committed
Bleeding edge - check instanceof *Type that have better alternative as method on Type
1 parent e799fc2 commit 436e6d3

8 files changed

+866
-0
lines changed

conf/bleedingEdge.neon

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ parameters:
3030
varTagType: true
3131
closureDefaultParameterTypeRule: true
3232
newRuleLevelHelper: true
33+
instanceofType: true

conf/config.level0.neon

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ conditionalTags:
1616
phpstan.rules.rule: %featureToggles.runtimeReflectionRules%
1717
PHPStan\Rules\Api\ApiInstanceofRule:
1818
phpstan.rules.rule: %featureToggles.runtimeReflectionRules%
19+
PHPStan\Rules\Api\ApiInstanceofTypeRule:
20+
phpstan.rules.rule: %featureToggles.instanceofType%
1921
PHPStan\Rules\Api\RuntimeReflectionFunctionRule:
2022
phpstan.rules.rule: %featureToggles.runtimeReflectionRules%
2123
PHPStan\Rules\Api\RuntimeReflectionInstantiationRule:
@@ -92,6 +94,8 @@ services:
9294
class: PHPStan\Rules\Api\ApiClassConstFetchRule
9395
-
9496
class: PHPStan\Rules\Api\ApiInstanceofRule
97+
-
98+
class: PHPStan\Rules\Api\ApiInstanceofTypeRule
9599
-
96100
class: PHPStan\Rules\Api\NodeConnectingVisitorAttributesRule
97101
-

conf/config.neon

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ parameters:
6060
varTagType: false
6161
closureDefaultParameterTypeRule: false
6262
newRuleLevelHelper: false
63+
instanceofType: false
6364
fileExtensions:
6465
- php
6566
checkAdvancedIsset: false
@@ -286,6 +287,7 @@ parametersSchema:
286287
varTagType: bool()
287288
closureDefaultParameterTypeRule: bool()
288289
newRuleLevelHelper: bool()
290+
instanceofType: bool()
289291
])
290292
fileExtensions: listOf(string())
291293
checkAdvancedIsset: bool()
@@ -443,6 +445,8 @@ conditionalTags:
443445
phpstan.parser.richParserNodeVisitor: %featureToggles.nodeConnectingVisitorCompatibility%
444446
PHPStan\Parser\CurlSetOptArgVisitor:
445447
phpstan.parser.richParserNodeVisitor: %featureToggles.curlSetOptTypes%
448+
PHPStan\Parser\TypeTraverserInstanceofVisitor:
449+
phpstan.parser.richParserNodeVisitor: %featureToggles.instanceofType%
446450

447451
services:
448452
-
@@ -480,6 +484,9 @@ services:
480484
-
481485
class: PHPStan\Parser\CurlSetOptArgVisitor
482486

487+
-
488+
class: PHPStan\Parser\TypeTraverserInstanceofVisitor
489+
483490
-
484491
class: PHPStan\Parser\ArrowFunctionArgVisitor
485492
tags:

0 commit comments

Comments
 (0)