Mathieu Rochette


On Friday, January 23rd, 2026 at 09:37, Tim Düsterhus <[email protected]> wrote:

> Hi
> 

> Am 2026-01-22 18:30, schrieb
> 

> Mathieu Rochette
> 

> :
> 

> > 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)
> 

> 

> Thank you for participating in the discussion of this RFC then. Having
> more voices available helps building things that suit the community best
> :-)
> 

> > still, my syntax suggestions:
> > 

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

> 

> Unfortunately this doesn't work, because it is a already-legal method
> call on a method stored in the constant called `DateTimeImmutable`. See:
> https://3v4l.org/3khkT#veol

ohhh

then, continuing on bikeshedding, I think I still prefer 
`?::DateTimeImmutable->format("c")` or `(? as DateTimeImmutable)->format("c")` 
as Larry mentioned.

`(DateTimeImmutable)?->format("c")` feels a bit weird. Reminds me too much of 
the null-safe operator.

> 

> > 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
> 

> 

> Union types would likely be unsupported either way, since multiple
> members of the union could have incompatible signatures for the same
> 


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 ^^). 


> Interfaces are fully supported with the currently proposed
> syntax (it's explicitly mentioned in the RFC).
> 

> 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