mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit e7e8c5bfac8df0f605d6588c3612a05cca74b017
e7e8c5bfac
[DeadCode] Skip key variable used in throw stmts in catch on RemoveUnusedForeachKeyRector (#6606)
This commit is contained in:
parent
de72a9244a
commit
d257e68fbf
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'd2298c6fd6fb233e4fcec5d3b69cd2eed52910e6';
|
public const PACKAGE_VERSION = 'e7e8c5bfac8df0f605d6588c3612a05cca74b017';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-12-18 13:44:24';
|
public const RELEASE_DATE = '2024-12-18 16:35:21';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,8 @@ use PhpParser\Node\Expr\Variable;
|
|||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PhpParser\Node\Stmt\Expression;
|
use PhpParser\Node\Stmt\Expression;
|
||||||
|
use PhpParser\Node\Stmt\Finally_;
|
||||||
|
use PhpParser\Node\Stmt\TryCatch;
|
||||||
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
|
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||||
use Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer;
|
use Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
@ -83,6 +85,12 @@ final class StmtsManipulator
|
|||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
$stmts = \array_slice($stmtsAware instanceof StmtsAwareInterface ? $stmtsAware->stmts : $stmtsAware, $jumpToKey, null, \true);
|
$stmts = \array_slice($stmtsAware instanceof StmtsAwareInterface ? $stmtsAware->stmts : $stmtsAware, $jumpToKey, null, \true);
|
||||||
|
if ($stmtsAware instanceof TryCatch) {
|
||||||
|
$stmts = \array_merge($stmts, $stmtsAware->catches);
|
||||||
|
if ($stmtsAware->finally instanceof Finally_) {
|
||||||
|
$stmts = \array_merge($stmts, $stmtsAware->finally->stmts);
|
||||||
|
}
|
||||||
|
}
|
||||||
$variable = new Variable($variableName);
|
$variable = new Variable($variableName);
|
||||||
return (bool) $this->betterNodeFinder->findFirst($stmts, fn(Node $subNode): bool => $this->exprUsedInNodeAnalyzer->isUsed($subNode, $variable));
|
return (bool) $this->betterNodeFinder->findFirst($stmts, fn(Node $subNode): bool => $this->exprUsedInNodeAnalyzer->isUsed($subNode, $variable));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user