[php-src] PR #22633: feat: add pipe assignment operator (`|>=`)
| From: | calebdw | Date: | Wed, 08 Jul 2026 01:05:24 +0000 |
| Subject: | [php-src] PR #22633: feat: add pipe assignment operator (`|>=`) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36889@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22633
Author: calebdw
Hello!
This adds the
|>= compound assignment operator for the pipe operator, allowing
$x |>= callable to be used as shorthand for $x = $x |> callable.
Supports pipe chains on the RHS:
```php
$x |>= fn1(...) |> fn2(...) |> fn3(...);
// is equivalent to
$x = $x |> fn1(...) |> fn2(...) |> fn3(...);
```
Implementation modeled after ??= (ZEND_AST_ASSIGN_COALESCE), with a dedicated AST node
(ZEND_AST_ASSIGN_PIPE) and compiler function that uses memoization to avoid double-evaluating
complex LHS expressions.
Extracts shared callable dispatch logic into zend_pipe_build_fcall() helper used by both
|> and |>= compilation.
All variable target types supported: simple vars, array dims, object properties, static properties.
Thanks!