Hi Vadim

Thanks for your follow-up.

On Sun, Jul 20, 2025 at 11:54 AM Vadim Dvorovenko
<vadim.dvorove...@gmail.com> wrote:
>
> Recently introduced pipeline operator is great, but together with
> assignment operator it will lead to mixing top-to-bottom and
> bottom-to-top code reading directions and vertigo.
>
> To reduce this problem i'd like to discuss the idea of left to right
> assignment operator. The draft rfc can be found here
> https://github.com/vadimonus/php-rfc-pipeline-assignment/blob/main/rfc.md
> , there is the part, that describes problem.

The problem you're describing is not unique to pipes. Code like this
is quite common.

$x = foo()
    ->bar()
    ->baz();

If we decide this is a problem (which I fundamentally disagree with),
then we should try to find a general solution, rather than something
that is specific to pipes. There's no reason why this example
shouldn't work.

foo()
    ->bar()
    ->baz() |>= $x;

At that point, you should probably also look for an operator that
isn't pipe-specific. But again, I disagree with the premise that this
is a problem to begin with.

> The current bahavior of pipe operator when used with variable is wery poorly 
> described in RFC

That's not quite accurate. It states:

> The left-hand side of the pipe may be any value or expression.

And according to PHPs expression model, variables get no special
treatment. They are evaluated and the result is used accordingly,
pipes are not special at all in that regard.

Cheers
Ilija

Reply via email to