Re: [RFC] Always generate fatal error for incompatible method signatures
| From: | Gabriel O | Date: | Tue, 09 Apr 2019 10:58:26 +0000 |
| Subject: | Re: [RFC] Always generate fatal error for incompatible method signatures | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105169@lists.php.net to get a copy of this message | ||
I see you are trying to solve inconsistency, but i would do it opposite way. LSP errors should be
warnings, they are not show stopper errors. It’s very much possible code violating LSP keeps
working correctly. And in modern PHP development, everybody considers warnings as show stoppers
anyway, so impact here is only in production. When some LSP breakage sneaks unnoticed into
production and my INI settings just silence these and log them, I would prefer it to not crash
there, because problem with these show only when expecting parent but receiving child, not when
child breaks LSP but its nowhere used in place of parent.
And this RFC conveniently shows only big LSP violation examples like array -> int, but not widely
used narrowing like mixed/object -> specific instance.
> On 9. Apr 2019, at 10:25, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
> Hi internals,
>
> A small cleanup RFC for PHP 8:
> https://wiki.php.net/rfc/lsp_errors
>
> This makes all incompatible method signature (LSP) errors fatal, rather
> than only warning in some cases. Especially after
> https://wiki.php.net/rfc/parameter-no-type-variance I
> don't think there's
> any reason to keep this backdoor in place.
>
> Regards,
> Nikita