Skip to content

Commit 0f32100

Browse files
committed
only get type check on Expr
1 parent 2bd4b02 commit 0f32100

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Rector\DeadCode\PhpDoc;
66

77
use PhpParser\Node;
8+
use PhpParser\Node\Expr;
89
use PhpParser\Node\Stmt\ClassConst;
910
use PhpParser\Node\Stmt\Expression;
1011
use PhpParser\Node\Stmt\Property;
@@ -46,6 +47,10 @@ public function isDead(VarTagValueNode $varTagValueNode, Property|ClassConst|Exp
4647
: $node->type;
4748

4849
if ($node instanceof Expression) {
50+
if (! $targetNode instanceof Expr) {
51+
return false;
52+
}
53+
4954
$varType = $this->nodeTypeResolver->getType($targetNode);
5055
$nativeType = $this->nodeTypeResolver->getNativeType($targetNode);
5156

0 commit comments

Comments
 (0)