2013/8/29 Nikita Popov <nikita....@gmail.com>: > Hi internals! > > This is a spinoff from the variadics thread. Quoting Stas: > >> I also think this: >> public function query($query, ...$params) >> public function query(...$params) >> should be legal too.
I respectfully disagree. The first method requires at least one parameter (or two, depending on the pending clarification in the other thread) , and the latest: zero or more (or 1 or more). > 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? I see no reason to do so and I would say -0.5. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php