On Thursday, January 22nd, 2026 at 10:52, Tim Düsterhus <[email protected]> 
wrote:

> Hi
> 

> Arnaud and I would like to start discussion on our RFC “Partial Function
> Application for instance of non-static methods ("$this")” which is
> intended to round-off the Partial Function Application RFC that was
> accepted recently:
> 

> https://wiki.php.net/rfc/partial_function_application_this
> 


Hi!

I often whished something like this existed :) Didn't get trough to suggest it 
because I wasn't sure of the syntax either (and lazyness)

still, my syntax suggestions:

    array_map(DateTimeImmutable->format("c"), $dates);

I understand this doesn't allow reordeing though, but it feels so much better 
and I expect would be what's needed for most cases that I hope something like 
this could work.

and an opt-in mechanic to reorder could be introduced for that use case. the 
previous suggestion could be a shortcut for:

    array_map(?::DateTimeImmutable->format("c"), $dates);

and a separate improvement to PFA could add support for picking arguments by 
name or position:

    array_find(?key::SomeObject->hasMatchingValue(?), $array);
    array_find(?2::SomeObject->hasMatchingValue(?), $array);


I noticed `?->method(?)` was considered; evne if it was possible, I would 
prefer if the type was explict, as you may want to use an interface name (or a 
union type, etc.) too

regards,


Mathieu Rochette


> Best regards
> Tim Düsterhus

Attachment: publickey - [email protected] - 0x8D30BA0E.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to