Updated Rector to commit df255c0db4dbfce78ad3fc5bbdb9997490c2ec6d

df255c0db4 [FunctionLike] Skip return by ref with switch on SimplifyUselessVariableRector (#6623)
This commit is contained in:
Tomas Votruba 2024-12-20 14:26:22 +00:00
parent d31e479bfc
commit f61a8361f2
2 changed files with 9 additions and 2 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '8a49d9de4b568e4d074d1785acc31db8f085c72b';
public const PACKAGE_VERSION = 'df255c0db4dbfce78ad3fc5bbdb9997490c2ec6d';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-12-20 21:02:21';
public const RELEASE_DATE = '2024-12-20 14:23:58';
/**
* @var int
*/

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\NodeVisitorAbstract;
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
@ -41,6 +42,12 @@ final class ByRefReturnNodeVisitor extends NodeVisitorAbstract implements ScopeR
$this->setByRefAttribute($stmt->stmts);
continue;
}
if ($stmt instanceof Switch_) {
foreach ($stmt->cases as $case) {
$this->setByRefAttribute($case->stmts);
}
continue;
}
if ($stmt instanceof Return_) {
$stmt->setAttribute(AttributeKey::IS_BYREF_RETURN, \true);
}