Re: [RFC] Pipe to return

From: Date: Sun, 01 Feb 2026 07:10:03 +0000
Subject: Re: [RFC] Pipe to return
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-129971@lists.php.net to get a copy of this message
Jordi Kroon:
function giveMeFourtyTwo() {
     return 42
         |> return;
} ... fn () => 'hello world'
         |> strlen(...)
         |> return;
Thanks for examples. I've already had a test for first case (https://github.com/vadimonus/php-src/blob/pipe-to-return/Zend/tests/pipe_operator/pipe_to_return/two_returns.phpt) Now i have added test for second case (https://github.com/vadimonus/php-src/blob/pipe-to-return/Zend/tests/pipe_operator/pipe_to_return/008.phpt) to be sure it's not valid and cannot be accidently treated as returning of (fn () => 'hello world' |> strlen(...)) from function as callable -- Vadim Dvorovenko

« previous php.internals (#129971) next »