Hi!
Maybe I didn't express myself clearly: I meant that the arguments in the
child's signature must be a superset of the arguments in the parent
signature, in the same order. Any required arguments in the parent may

It was clear to me you said that, however it is in no way clear why it must be so. LSP requires that any code that calls ObjParent could also call ObjChild, this is true. It does not say anything about supersets - it only says that preconditions should not be strengthened, and that's exactly what happens.

I'm assuming that the parameter would cause variations in behaviour
(which is generally the reason for having parameters), so by definition
ignoring it would cause different behaviour. I presume that this would
be unexpected.

Again, you are assuming behavior which has nothing to do with signatures. This way we had to disallow overriding at all - because somebody could write the overriding code that just ignores parameters and always returns 42! Behavior that is written into the code is of course expected, it's why it is there.

Arguments being silently ignored sounds like a potential bug to me. I
know it's something I've seen in code I've maintained.

No, it's not a bug - extra arguments were silently ignored in PHP since the dawn of time.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to