Re: Signature compatibility: Number of arguments
| From: | Nikita Popov | Date: | Thu, 29 Aug 2013 10:53:23 +0000 |
| Subject: | Re: Signature compatibility: Number of arguments | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68676@lists.php.net to get a copy of this message | ||
On Thu, Aug 29, 2013 at 11:33 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> This is a general issue in PHP that we might want to fix: Currently a
> method A is not compatible with a method B if A has less arguments than B.
>
> E.g. both of the following are incompatible signatures:
>
> public function foo($bar)
> public function foo()
>
> public function foo($bar = NULL)
> public function foo()
>
> This doesn't really make sense. Removing parameters doesn't violate LSP,
> because in PHP it is legal to pass more arguments than declared. (Only
> adding additional required parameters would violate LSP.)
>
> Is it okay to change this?
>
> Thanks,
> Nikita
>
Patch for this change: https://github.com/php/php-src/pull/424
Nikita