Re: [RFC] [Discussion] Never parameters

From: Date: Fri, 21 Mar 2025 20:41:36 +0000
Subject: Re: [RFC] [Discussion] Never parameters
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Thursday, 20 March 2025 at 16:57, Larry Garfield <[email protected]> wrote:

> On Thu, Mar 20, 2025, at 11:24 AM, Gina P. Banyard wrote:
> 
> > As the person that had the initial discussion in R11 with Jordan [1]
> > never as a parameter type for an interface actually is not the solution
> > for "poor man generics".
> > Matthew Fonda [2] already replied to the thread pointing out the remark
> > Nikita made in the discussion of the previous RFC.
> > But importantly, going from mixed parameter type to a generic parameter
> > type is allowed and not a BC change,
> > however, going from a never parameter type to a generic parameter type
> > is a BC break.
> 
> 
> To clarify, you're saying this:
> 
> [...]
>
> Am I following that? Because just from writing that I am not sure I agree, which means I may be
> misunderstanding. :-)

I am saying:
interface I {
  pubic function foo(never $a);
}

can ***not*** be "upgraded" to

interface I<A> {
    pubic function foo(A $a);
}

whereas it is possible to go from

interface I {
  pubic function foo(mixed $a);
}

to

interface I<A> {
    pubic function foo(A $a);
}

The implementing classes are completely irrelevant in this context.

Best regards,

Gina P. Banyard


Thread (33 messages)

« previous php.internals (#126902) next »