Inheritance/compatibility behavior
| From: | Sam Barrow | Date: | Tue, 29 Apr 2008 13:34:07 +0000 |
| Subject: | Inheritance/compatibility behavior | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-37292@lists.php.net to get a copy of this message | ||
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);
}
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?
Ie, I can do the above, but not the following:
abstract class a {
abstract public function go(myClass $a);
}
final class b extends a {
abstract public function go(array $a);
}