Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Stanislav Malyshev
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

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
On Tue, 2008-04-29 at 17:43 +0200, Stefan Walk wrote: > On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote: > > > 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? > > Th

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Stefan Walk
On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote: > 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? That would be a bad idea, because it violates a (in my opinion, the) c

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
On Tue, 2008-04-29 at 09:34 -0400, 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); > } > Sorry, function in class b should not be abstract. > This will

[PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
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 paramet