On Sun, Apr 25, 2021 at 10:26 PM Larry Garfield <[email protected]> wrote:
> https://wiki.php.net/rfc/partial_function_application Amazing, I've wanted this for so long! Have you considered extending this syntax to OOP, e.g. $obj->method(?) or SomeClass::staticMethod(?)? On Sun, Apr 25, 2021 at 10:51 PM Olle Härstedt <[email protected]> wrote: > Nice. :) Are there any other motivating use-cases besides pipe > operator (that are relevant for web dev)? One reason I'm personally excited about this proposal is that it would allow static analysis in more cases, e.g. $param = 'fooBar'; // What's this string? A user name? Elon Musk's favorite color? Text of US Constitution? somefunc($param); function somefunc($cb) { $cb(123, 'meh'); // What parameter types does this accept? } Allowing syntax like $param = fooBar(?, ?); would indicate clearly what this variable receives. Analysis tools would then be able to check if such a function exists and whether it would receive parameters of expected types. -- Best regards, Max Semenik
