Skip to content

Commit 2bd0e31

Browse files
committed
Attempt to improve performance.
1 parent 617a6ec commit 2bd0e31

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Analyser/NodeScopeResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,6 +2288,11 @@ public function processStmtNode(
22882288

22892289
// emit error
22902290
foreach ($matchingCatchTypes as $catchTypeIndex => $matched) {
2291+
// Matched (non-dead) catches only need to be reported to the rule
2292+
// when in a trait, to detect disagreement between the classes using it.
2293+
if ($matched && !$scope->isInTrait()) {
2294+
continue;
2295+
}
22912296
$this->callNodeCallback($nodeCallback, new CatchWithUnthrownExceptionNode($catchNode, $catchTypes[$catchTypeIndex], $originalCatchTypes[$catchTypeIndex], $matched), $scope, $storage);
22922297
}
22932298

0 commit comments

Comments
 (0)