Re: [RFC] [Discussion] Never parameters

From: Date: Thu, 20 Mar 2025 16:57:09 +0000
Subject: Re: [RFC] [Discussion] Never parameters
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-126872@lists.php.net to get a copy of this message
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: interface I { pubic function foo(mixed $a); } class C implements I { public function foo(mixed $b) { ... } } Can turn into this: interface I<A> { pubic function foo(A $a); } class C implements I<Foo> { public function foo(Foo $b) { ... } } But this could not turn into that: interface I { pubic function foo(never $a); } class C implements I { public function foo(Foo $b) { ... } } Am I following that? Because just from writing that I am not sure I agree, which means I may be misunderstanding. :-) --Larry Garfield

« previous php.internals (#126872) next »