Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[Php85] Do not convert to pipe on use directly of spread operator on …
…NestedFuncCallsToPipeOperatorRector
  • Loading branch information
samsonasik committed Mar 27, 2026
commit 071ce2a8e8eec292f9429396e309e33a545412d6
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?php

namespace Rector\Tests\Php85\Rector\Expression\NestedFuncCallsToPipeOperatorRector\Fixture;

$arrayOfArrays = [['a'], ['a'], ['b']];
$merged = array_unique(array_merge(...$arrayOfArrays));

?>
-----
<?php

namespace Rector\Tests\Php85\Rector\Expression\NestedFuncCallsToPipeOperatorRector\Fixture;

$arrayOfArrays = [['a'], ['a'], ['b']];
$merged = array_merge(...$arrayOfArrays)
|> array_unique(...);
|> array_unique(...);

?>
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Loading