[GIT-PULLS] [php-src] PR #22633: feat: add pipe assignment operator (`|>=`)
[email protected] (calebdw)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
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!