Skip to content

Commit 9afd587

Browse files
committed
Rector 2.0.13
1 parent a720434 commit 9afd587

4 files changed

Lines changed: 4 additions & 14 deletions

File tree

rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function refactor(Node $node) : ?StmtsAwareInterface
112112
$stmt->expr = $assign->expr;
113113
$lastStmt = \array_pop($node->stmts);
114114
$elseStmtsExceptLast = \array_slice($elseStmts, 0, -1);
115-
$node->stmts = [...$node->stmts, ...$elseStmtsExceptLast, $lastStmt];
115+
$node->stmts = \array_merge($node->stmts, $elseStmtsExceptLast, [$lastStmt]);
116116
return $node;
117117
}
118118
return null;

rules/EarlyReturn/Rector/Return_/PreparedValueToEarlyReturnRector.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99
use PhpParser\Node\Expr\AssignOp;
1010
use PhpParser\Node\Expr\Variable;
1111
use PhpParser\Node\Stmt;
12-
use PhpParser\Node\Stmt\Do_;
1312
use PhpParser\Node\Stmt\Expression;
14-
use PhpParser\Node\Stmt\For_;
15-
use PhpParser\Node\Stmt\Foreach_;
1613
use PhpParser\Node\Stmt\If_;
1714
use PhpParser\Node\Stmt\Return_;
18-
use PhpParser\Node\Stmt\While_;
1915
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
2016
use Rector\EarlyReturn\ValueObject\BareSingleAssignIf;
2117
use Rector\NodeManipulator\IfManipulator;
@@ -104,12 +100,6 @@ public function refactor(Node $node) : ?StmtsAwareInterface
104100
if ($stmt instanceof Expression && $stmt->expr instanceof AssignOp) {
105101
return null;
106102
}
107-
if (($stmt instanceof For_ || $stmt instanceof Foreach_ || $stmt instanceof While_ || $stmt instanceof Do_) && $initialAssign instanceof Assign) {
108-
$isReassignInLoop = (bool) $this->betterNodeFinder->findFirst($stmt, fn(Node $node): bool => $node instanceof Assign && $this->nodeComparator->areNodesEqual($node->var, $initialAssign->var));
109-
if ($isReassignInLoop) {
110-
return null;
111-
}
112-
}
113103
if ($stmt instanceof If_) {
114104
$ifs[$key] = $stmt;
115105
continue;

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = 'b38a15657cfe101e1ead4eaeb977d263cb049bd5';
22+
public const PACKAGE_VERSION = '2.0.13';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-04-26 18:10:08';
27+
public const RELEASE_DATE = '2025-04-24 15:52:43';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)