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

From: Date: Fri, 23 Jan 2026 13:59:11 +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-129890@lists.php.net to get a copy of this message
Hi Am 2026-01-22 17:26, schrieb Rowan Tommins [IMSoP]:
The PHP equivalent would be something like this: $f = (DateTimeImmutable)?->format('c');
See my reply to Mathieu on why this specific one wouldn't work.
Or, slightly more readable but less consistent with casts: $f = (? as DateTimeImmutable)->format('c');
That would work, but indeed would not solve the reordering case. I also feel it is inventing more new syntax than the current “scope-resolution-operator” syntax the RFC uses (which is not just used for static method calls). Best regards Tim Düsterhus

« previous php.internals (#129890) next »