Enabling PHP method chaining with a makeshift pipe operator
Sebastiaan Luca, a freelance Laravel developer from Antwerp, coded up a couple of functions that mimic a pipe operator.
An interesting RFC proposal by Sara Golemon submitted in April 2016 suggested the use of a pipe operator to enable method chaining for any value and method. Yet as of today, it's still being discussed and there's no saying if it will ever make its way into PHP. So in the meantime, here's a solution!
https://blog.sebastiaanluca.com/enabling-php-method-chaining-with-a-makeshift-pipe-operator
Let's hope a real pipe operator will land someday in PHP.
I'm hopeful. Done well, I think it needs partial function application first, so that no additional syntax is required for the rhs.
— SaraMG (@SaraMG) February 21, 2018
What are your thoughts on "Enabling PHP method chaining with a makeshift pipe operator"?