Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"nikic/php-parser": "^5.7",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.33",
"phpstan/phpstan": "2.1.x-dev",
"react/event-loop": "^1.6",
"react/promise": "^3.3",
"react/socket": "^1.17",
Expand Down
19 changes: 0 additions & 19 deletions src/PhpParser/Printer/BetterStandardPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use PhpParser\Node\Expr\BinaryOp\Pipe;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Instanceof_;
use PhpParser\Node\Expr\Match_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Yield_;
Expand All @@ -29,7 +28,6 @@
use PhpParser\Node\Stmt\Nop;
use PhpParser\PrettyPrinter\Standard;
use PhpParser\Token;
use PHPStan\Node\Expr\AlwaysRememberedExpr;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Rector\NodeAnalyzer\ExprAnalyzer;
Expand Down Expand Up @@ -128,23 +126,6 @@ protected function p(
int $lhsPrecedence = self::MAX_PRECEDENCE,
bool $parentFormatPreserved = false
): string {
// handle already AlwaysRememberedExpr
// @see https://github.com/rectorphp/rector/issues/8815#issuecomment-2503453191
if ($node instanceof AlwaysRememberedExpr) {
return $this->p($node->getExpr(), $precedence, $lhsPrecedence, $parentFormatPreserved);
}

// handle overlapped origNode is Match_ and its subnodes still have AlwaysRememberedExpr
$originalNode = $node->getAttribute(AttributeKey::ORIGINAL_NODE);
if ($originalNode instanceof Match_) {
$subNodeNames = $node->getSubNodeNames();
foreach ($subNodeNames as $subNodeName) {
while ($originalNode->{$subNodeName} instanceof AlwaysRememberedExpr) {
$originalNode->{$subNodeName} = $originalNode->{$subNodeName}->getExpr();
}
}
}

$this->wrapBinaryOpWithBrackets($node);

$content = parent::p($node, $precedence, $lhsPrecedence, $parentFormatPreserved);
Expand Down
Loading