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..af05b0694e4 --- /dev/null +++ b/rules-tests/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector/Fixture/spread_operator_stays.php.inc @@ -0,0 +1,18 @@ + +----- + array_unique(...); + +?> diff --git a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php index 7f21e58b7fa..58cd90de250 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 null; + } + // Return a pipe with the base expression on the left return new Pipe($arg->value, $this->createPlaceholderCall($expr)); } 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; }