Re: [RFC] Parameter No Type Variance
| From: | Josh Di Fabio | Date: | Mon, 21 Nov 2016 09:49:19 +0000 |
| Subject: | Re: [RFC] Parameter No Type Variance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97103@lists.php.net to get a copy of this message | ||
On Mon, Nov 21, 2016 at 9:40 AM Niklas Keller <me@kelunik.com> wrote:
> Morning Internals,
>
> I'd like to announce a RFC to allow omitting the type declarations for
> parameters in subclasses:
> https://wiki.php.net/rfc/parameter-no-type-variance
>
> PHP doesn't currently allow variance for parameters as checking these for
> compatibility isn't possible on compile time.
> This limitation is caused by autoloading and doesn't allow widening the
> accepted parameters.
>
> This RFC proposes to allow ommiting the type entirely in a subclass, as
> dropping all parameter constraints is
> always valid according to the LSP principle.
>
> We already allow return types being added in subclasses.
>
> Your feedback is welcome. :-)
>
> Regards, Niklas
>
Sounds good Niklas!