Re: [RFC] Partial Function Application for instance of non-static methods ("$this")

From: Date: Thu, 22 Jan 2026 17:30:03 +0000
Subject: Re: [RFC] Partial Function Application for instance of non-static methods ("$this")
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-129871@lists.php.net to get a copy of this message
On Thursday, January 22nd, 2026 at 10:52, Tim Düsterhus <tim@bastelstu.be> 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: [application/pgp-keys] publickey - mathieu@rochette.cc - 0x8D30BA0E.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#129871) next »