but it is not logical foo() in B can do anything with $a before or after parent::foo() and the caller does not need to know at any point that B has anything to do with the class A
Am 20.09.2011 19:40, schrieb Stas Malyshev:Hi! On 9/19/11 2:32 AM, Gustavo Lopes wrote: > The thing if you introduce func_get_args() to the argument, any discussion > about enforcing signatures becomes meaningless. One could argue this > should be allowed: > > class A { > function foo() {} > } > > class B extends A { > function foo($a) {} > } No, this can not be allowed because A's signature accepts any call, including foo(), but B's only accepts one with at least one parameters, so LSP is broken here. That is regardless of what A::foo() is doing inside, since arguments are going to be checked first. Having said that, even in this case I would probably not go as far as producing a fatal error - though E_STRICT would be OK here -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm
signature.asc
Description: OpenPGP digital signature