I had a good conversation with @delacry over the library that was introduced .
And what struck me the most was the last example.
$topAdmins = $users |> array_filter ( ? , fn ( User $u ) => $u -> isActive ()) |> array_map ( fn ( User $u ) => $u -> refresh (), ? ) |> array_filter ( ? , fn ( User $u ) => $u -> isAdmin ()) |> ( fn ( $us ) => ( usort ( $us , fn ( User $a , User $b ) => $a -> name <=> $b -> name ) ? $us : $us )) |> array_slice ( ? , 0 , 10 );
Enter fullscreen mode
Exit fullscreen mode
It is an example with the upcoming partial function application change (PHP 8.6).
I do agree, while it looks miles better than it is in PHP 8.5, it still is not that straight forward as the solutions with the builder pattern.
So I took a bit of time off from my dates project to come up with PAF . POAF looked weird to me, and PAF reminded me of a thing we said in Dutch when I was young, pief poef paf.…