mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-25 09:49:48 +01:00
Updated Rector to commit e4e77b2fe9ddefec46aeea5b18ea90ade7188874
e4e77b2fe9
[Strict] Handle in assign on BooleanInIfConditionRuleFixerRector (#6685)
This commit is contained in:
parent
13d175711c
commit
d0a75a7d2c
rules/CodeQuality/Rector/If_
src
@ -27,7 +27,6 @@ use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer;
|
||||
use Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer;
|
||||
use Rector\PhpParser\Node\Value\ValueResolver;
|
||||
@ -125,9 +124,6 @@ CODE_SAMPLE
|
||||
$node->cond = $binaryOp;
|
||||
return [$expression, $node];
|
||||
}
|
||||
if ($node->cond instanceof Assign) {
|
||||
$binaryOp->left->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true);
|
||||
}
|
||||
$node->cond = $binaryOp;
|
||||
return $node;
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '9691e9eaf4400f57e9008c409756dae37efdde7e';
|
||||
public const PACKAGE_VERSION = 'e4e77b2fe9ddefec46aeea5b18ea90ade7188874';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2025-01-20 12:29:31';
|
||||
public const RELEASE_DATE = '2025-01-21 19:26:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@ use PhpParser\Node\AttributeGroup;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\CallLike;
|
||||
use PhpParser\Node\Expr\Match_;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
@ -316,6 +317,19 @@ final class BetterStandardPrinter extends Standard
|
||||
{
|
||||
return $this->pAttrGroups($param->attrGroups) . $this->pModifiers($param->flags) . ($param->type instanceof Node ? $this->p($param->type) . ' ' : '') . ($param->byRef ? '&' : '') . ($param->variadic ? '...' : '') . $this->p($param->var) . ($param->default instanceof Expr ? ' = ' . $this->p($param->default) : '') . ($param->hooks !== [] ? ' {' . $this->pStmts($param->hooks) . $this->nl . '}' : '');
|
||||
}
|
||||
protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode, int $precedence, int $lhsPrecedence) : string
|
||||
{
|
||||
/**
|
||||
* ensure left side is assign and right side is just created
|
||||
*
|
||||
* @see https://github.com/rectorphp/rector-src/pull/6668
|
||||
* @see https://github.com/rectorphp/rector/issues/8980
|
||||
*/
|
||||
if ($leftNode instanceof Assign && $leftNode->getStartTokenPos() > 0 && $rightNode->getStartTokenPos() < 0) {
|
||||
$leftNode->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true);
|
||||
}
|
||||
return parent::pInfixOp($class, $leftNode, $operatorString, $rightNode, $precedence, $lhsPrecedence);
|
||||
}
|
||||
private function cleanStartIndentationOnHeredocNowDoc(string $content) : string
|
||||
{
|
||||
$lines = NewLineSplitter::split($content);
|
||||
|
Loading…
x
Reference in New Issue
Block a user