Hi!

Sam Barrow wrote:
I want to make two classes:

abstract class a {
        abstract public function go($a);
}
final class b extends a {
        abstract public function go(array $a);
}

LSP violation here: a accepts go("away") but b doesn't.

This will not work, I get an error that the two must be compatible.
Wouldn't it be a good idea to allow any type hint for a parameter that
does not specify a type hint?

No, because of the LSP. Subtypes should not strengthen preconditions.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

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

Reply via email to