Re: [RFC] Pipe to return
| From: | Oleksii Bulba | Date: | Wed, 04 Feb 2026 08:16:53 +0000 |
| Subject: | Re: [RFC] Pipe to return | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130002@lists.php.net to get a copy of this message | ||
On Sat, Jan 31, 2026 at 9:52 AM Vadim Dvorovenko <vadim.dvorovenko@gmail.com>
wrote:
> Introducing Pipe to return RFC
>
> https://wiki.php.net/rfc/pipe_to_return
>
> In short, RFC proposes piping expression result to
return to be
> used
> together with pipe operator to reduce cognitive load
>
> "Hello World" |> strlen
> <http://www.php.net/strlen>(...) |> return;
>
> --
>
> Vadim Dvorovenko
>
Hi Vadim,
thanks for the RFC — the idea of piping into return is interesting.
One question about semantics: what would be the expected behavior if there
is another pipe operand after return? For example:
$foo |> return |> bar(...);
Would this be a compile-time error, a no-op after return, or is return
intended to be a hard terminal in the pipe chain by definition?
Best regards,
Oleksii