Skip to content

Commit

Permalink
Updated Rector to commit 8e6d46a58fff8e6bd5276b9ae473bfb91460b487
Browse files Browse the repository at this point in the history
rectorphp/rector-src@8e6d46a [Instanceof] Fix combination of dead instance and compare (#5319)
  • Loading branch information
TomasVotruba committed Dec 3, 2023
1 parent ab4ff53 commit d9834a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
declare (strict_types=1);
namespace Rector\DeadCode\Rector\If_;

use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\BooleanNot;
Expand Down Expand Up @@ -98,6 +100,10 @@ private function refactorStmtAndInstanceof(If_ $if, Instanceof_ $instanceof)
if ($this->shouldSkipFromNotTypedParam($instanceof)) {
return null;
}
if ($instanceof->expr instanceof Assign) {
$assignExpression = new Expression($instanceof->expr);
return \array_merge([$assignExpression], $if->stmts);
}
if ($if->cond !== $instanceof) {
return NodeTraverser::REMOVE_NODE;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '026398c9e1078cb3ac5cac41767b620872166859';
public const PACKAGE_VERSION = '8e6d46a58fff8e6bd5276b9ae473bfb91460b487';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-12-03 20:08:03';
public const RELEASE_DATE = '2023-12-03 20:10:35';
/**
* @var int
*/
Expand Down

0 comments on commit d9834a6

Please sign in to comment.