Re: [PHP-DEV] [RFC] Pipe to return

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

This would lead to parse-time time error, return |> is not valid grammar sequence.

···

04.02.2026 15:16, Oleksii Bulba пишет:

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