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

From: Date: Fri, 23 Jan 2026 13:13:58 +0000
Subject: Re: [RFC] Partial Function Application for instance of non-static methods ("$this")
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-129889@lists.php.net to get a copy of this message
Hi Am 2026-01-23 14:06, schrieb Mathieu Rochette:
(DateTimeImmutable)?->format("c") feels a bit weird. Reminds me too much of the null-safe operator.
That's because it is. It's literally the same case of a DateTimeImmutable constant with useless parentheses and the null-safe object member access: https://3v4l.org/NebOR#veol
They could have incompatible signatures, yes, but they also could have compatible ones too. It's not a deal breaker. I don't imagine needing this in practice. But I don't see why the language would prevent that; I can already make that mistake with short closures or any methods. For me, it's the role of the static analyzer to tell me if I made such a mistake (or runtime errors ^^).
The signature would need to be “unique” to properly generate the signature of the resulting Closure. Best regards Tim Düsterhus

« previous php.internals (#129889) next »