Skip to content

Commit a3612cb

Browse files
Fix phpstan error
1 parent 6c44887 commit a3612cb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Parser/TypeTraverserInstanceofVisitor.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ final class TypeTraverserInstanceofVisitor extends NodeVisitorAbstract
1313

1414
public const ATTRIBUTE_NAME = 'insideTypeTraverserMap';
1515

16+
private const TYPE_TRAVERSER_CLASSES = [
17+
'phpstan\\type\\typetraverser',
18+
'phpstan\\type\\simultaneoustypetraverser',
19+
];
20+
1621
private int $depth = 0;
1722

1823
#[Override]
@@ -33,7 +38,7 @@ public function enterNode(Node $node): ?Node
3338
if (
3439
$node instanceof Node\Expr\StaticCall
3540
&& $node->class instanceof Node\Name
36-
&& $node->class->toLowerString() === 'phpstan\\type\\typetraverser'
41+
&& \in_array($node->class->toLowerString(), self::TYPE_TRAVERSER_CLASSES, true)
3742
&& $node->name instanceof Node\Identifier
3843
&& $node->name->toLowerString() === 'map'
3944
) {
@@ -49,7 +54,7 @@ public function leaveNode(Node $node): ?Node
4954
if (
5055
$node instanceof Node\Expr\StaticCall
5156
&& $node->class instanceof Node\Name
52-
&& $node->class->toLowerString() === 'phpstan\\type\\typetraverser'
57+
&& \in_array($node->class->toLowerString(), self::TYPE_TRAVERSER_CLASSES, true)
5358
&& $node->name instanceof Node\Identifier
5459
&& $node->name->toLowerString() === 'map'
5560
) {

0 commit comments

Comments
 (0)