2021-04-25 21:07 GMT, Max Semenik <maxsem.w...@gmail.com>: > On Sun, Apr 25, 2021 at 10:26 PM Larry Garfield <la...@garfieldtech.com> > 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 <olleharst...@gmail.com> > 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.
Like an alternative to value objects (`class Email ... `)? Not sure I understand how, sorry. Olle -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php