From 01dc92cbc9c550c15f1e853733db6cb60e9181d7 Mon Sep 17 00:00:00 2001 From: "Anna Damm [CHECK24]" <167064895+annadamm-check24@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:13:35 +0100 Subject: [PATCH 1/4] Create spread_operator_stays.php.inc The spread operator should not be removed when changing to pipe operator --- .../Fixture/spread_operator_stays.php.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc diff --git a/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc b/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc new file mode 100644 index 00000000000..6d0ffbdacdd --- /dev/null +++ b/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc @@ -0,0 +1,13 @@ + +----- + array_unique(...); + +?> From 071ce2a8e8eec292f9429396e309e33a545412d6 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 27 Mar 2026 17:04:30 +0700 Subject: [PATCH 2/4] [Php85] Do not convert to pipe on use directly of spread operator on NestedFuncCallsToPipeOperatorRector --- .../Fixture/spread_operator_stays.php.inc | 7 ++++++- .../Expression/NestedFuncCallsToPipeOperatorRector.php | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc b/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc index 6d0ffbdacdd..af05b0694e4 100644 --- a/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc +++ b/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc @@ -1,5 +1,7 @@ array_unique(...); + |> array_unique(...); ?> diff --git a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php index 7f21e58b7fa..b92259b0305 100644 --- a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php +++ b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php @@ -145,6 +145,11 @@ private function processNestedCalls(Expr $expr, bool $deep = false): ?Expr // If we're deep in recursion and hit a non-FuncCall, this is the base if ($deep) { + // Spread argument can't be converted to pipe — keep the call as-is + if ($arg->unpack) { + return $expr; + } + // Return a pipe with the base expression on the left return new Pipe($arg->value, $this->createPlaceholderCall($expr)); } From c2fd3b306eb25a474d6991c3fdb662e7139a11fa Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 27 Mar 2026 10:07:16 +0000 Subject: [PATCH 3/4] [ci-review] Rector Rectify --- src/ChangesReporting/Output/JUnitOutputFormatter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ChangesReporting/Output/JUnitOutputFormatter.php b/src/ChangesReporting/Output/JUnitOutputFormatter.php index 88dd3f45452..2fbd7864967 100644 --- a/src/ChangesReporting/Output/JUnitOutputFormatter.php +++ b/src/ChangesReporting/Output/JUnitOutputFormatter.php @@ -57,16 +57,16 @@ public function report(ProcessResult $processResult, Configuration $configuratio $domDocument = new DOMDocument('1.0', 'UTF-8'); - $xmlTestSuite = $domDocument->createElement(self::XML_ELEMENT_TESTSUITE); - $xmlTestSuite->setAttribute(self::XML_ATTRIBUTE_NAME, 'rector'); + $domElement = $domDocument->createElement(self::XML_ELEMENT_TESTSUITE); + $domElement->setAttribute(self::XML_ATTRIBUTE_NAME, 'rector'); $xmlTestSuites = $domDocument->createElement(self::XML_ELEMENT_TESTSUITES); - $xmlTestSuites->appendChild($xmlTestSuite); + $xmlTestSuites->appendChild($domElement); $domDocument->appendChild($xmlTestSuites); - $this->appendSystemErrors($processResult, $configuration, $domDocument, $xmlTestSuite); - $this->appendFileDiffs($processResult, $configuration, $domDocument, $xmlTestSuite); + $this->appendSystemErrors($processResult, $configuration, $domDocument, $domElement); + $this->appendFileDiffs($processResult, $configuration, $domDocument, $domElement); echo $domDocument->saveXML() . PHP_EOL; } From cf8e9c71d3975f44774bf7c03e575acde0bd7189 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 27 Mar 2026 17:08:15 +0700 Subject: [PATCH 4/4] final touch: return --- .../Rector/Expression/NestedFuncCallsToPipeOperatorRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php index b92259b0305..58cd90de250 100644 --- a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php +++ b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php @@ -147,7 +147,7 @@ private function processNestedCalls(Expr $expr, bool $deep = false): ?Expr if ($deep) { // Spread argument can't be converted to pipe — keep the call as-is if ($arg->unpack) { - return $expr; + return null; } // Return a pipe with the base expression on the left