Skip to content

Commit 93a4f02

Browse files
committed
Fix RethrowExceptionRule
1 parent 72b9205 commit 93a4f02

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: src/Rule/Nette/RethrowExceptionRule.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ public function processNode(Node $node, Scope $scope): array
7474
}
7575
if (
7676
count($catch->stmts) === 1
77-
&& $catch->stmts[0] instanceof Node\Stmt\Throw_
78-
&& $catch->stmts[0]->expr instanceof Variable
77+
&& $catch->stmts[0] instanceof Node\Stmt\Expression
78+
&& $catch->stmts[0]->expr instanceof Node\Expr\Throw_
79+
&& $catch->stmts[0]->expr->expr instanceof Variable
7980
&& $catch->var !== null
8081
&& is_string($catch->var->name)
81-
&& is_string($catch->stmts[0]->expr->name)
82-
&& $catch->var->name === $catch->stmts[0]->expr->name
82+
&& is_string($catch->stmts[0]->expr->expr->name)
83+
&& $catch->var->name === $catch->stmts[0]->expr->expr->name
8384
) {
8485
continue 2;
8586
}

0 commit comments

Comments
 (0)