diff --git a/rules-tests/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector/Fixture/assign_with_existing_parentheses.php.inc b/rules-tests/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector/Fixture/assign_with_existing_parentheses.php.inc new file mode 100644 index 00000000000..030587ae5f9 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector/Fixture/assign_with_existing_parentheses.php.inc @@ -0,0 +1,15 @@ + +----- + diff --git a/src/PhpParser/Printer/BetterStandardPrinter.php b/src/PhpParser/Printer/BetterStandardPrinter.php index f2f18342f9c..5dc11f7e3ed 100644 --- a/src/PhpParser/Printer/BetterStandardPrinter.php +++ b/src/PhpParser/Printer/BetterStandardPrinter.php @@ -478,9 +478,7 @@ private function wrapBinaryOpWithBrackets(Node $node): void $node->left->setAttribute(AttributeKey::ORIGINAL_NODE, null); } - if ($node->right instanceof Assign - && $this->origTokens instanceof TokenStream - && ! $this->origTokens->haveParens($node->right->getStartTokenPos(), $node->right->getEndTokenPos())) { + if ($node->right instanceof Assign && $this->origTokens instanceof TokenStream) { $node->right->setAttribute(AttributeKey::ORIGINAL_NODE, null); }