Skip to content

Commit 25c6fbd

Browse files
committed
Updated Rector to commit 9dccc8a0efb26609bdc90e5e7b99dafb4e2fde78
rectorphp/rector-src@9dccc8a [CodeQuality] Handle with assign on SimplifyIfElseToTernaryRector (#7951)
1 parent a51dfdd commit 25c6fbd

5 files changed

Lines changed: 9 additions & 7 deletions

File tree

rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
use PhpParser\Node\Stmt\ElseIf_;
1010
use PhpParser\Node\Stmt\If_;
1111
use PhpParser\Token;
12+
use Rector\Contract\Rector\HTMLAverseRectorInterface;
1213
use Rector\NodeTypeResolver\Node\AttributeKey;
1314
use Rector\Rector\AbstractRector;
1415
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1516
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
1617
/**
1718
* @see \Rector\Tests\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector\CompleteMissingIfElseBracketRectorTest
1819
*/
19-
final class CompleteMissingIfElseBracketRector extends AbstractRector
20+
final class CompleteMissingIfElseBracketRector extends AbstractRector implements HTMLAverseRectorInterface
2021
{
2122
public function getRuleDefinition(): RuleDefinition
2223
{

rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function refactor(Node $node): ?Node
113113
if ($this->isNodeTooLong($assign)) {
114114
return null;
115115
}
116-
if ($ternary->cond instanceof BinaryOp) {
116+
if ($ternary->cond instanceof BinaryOp || $ternary->cond instanceof Assign) {
117117
$ternary->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null);
118118
}
119119
$expression = new Expression($assign);

rules/Php86/Rector/FuncCall/MinMaxToClampRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare (strict_types=1);
44
namespace Rector\Php86\Rector\FuncCall;
55

6+
use PhpParser\Node\Identifier;
67
use PhpParser\Node;
78
use PhpParser\Node\Arg;
89
use PhpParser\Node\Expr;
@@ -97,7 +98,7 @@ private function createClampFuncCall(FuncCall $outerFuncCall, FuncCall $innerFun
9798
}
9899
private function isSupportedArg(Arg $arg): bool
99100
{
100-
return !$arg->unpack && $arg->name === null;
101+
return !$arg->unpack && !$arg->name instanceof Identifier;
101102
}
102103
/**
103104
* @return array{Expr, Expr}|null

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 = '2.4.0';
22+
public const PACKAGE_VERSION = '9dccc8a0efb26609bdc90e5e7b99dafb4e2fde78';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2026-04-02 18:19:53';
27+
public const RELEASE_DATE = '2026-04-04 09:34:02';
2828
/**
2929
* @var int
3030
*/

src/Rector/AbstractRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ protected function getType(Node $node): Type
180180
/**
181181
* Use this method for getting native expr type
182182
*/
183-
protected function getNativeType(Expr $node): Type
183+
protected function getNativeType(Expr $expr): Type
184184
{
185-
return $this->nodeTypeResolver->getNativeType($node);
185+
return $this->nodeTypeResolver->getNativeType($expr);
186186
}
187187
/**
188188
* @param Node|Node[] $nodes

0 commit comments

Comments
 (0)