Hi

Am 2025-07-20 21:31, schrieb Vadim Dvorovenko:
In fluent we even can write foo()->bar()->baz()->assignTo($x) (as it's user-defined method, we can make any logic). With fluent we do not need nor pipe, nor ltr-assignment. But someone thought fluent syntax is not good, as this is not native language operator, but a wrapper pattern, and we have pipe operator now.

FWIW: You can also define such an `assign_to()` function for use with pipes. See https://3v4l.org/R5b2f/rfc#vgit.master:

    function assign_to(&$var) {
        return function ($value) use (&$var) {
            $var = $value;
        };
    }

    $string = "Hello World!";

    $string
        |> strtolower(...)
        |> ucfirst(...)
        |> assign_to($result);

    var_dump($result);

Best regards
Tim Düsterhus

Reply via email to