Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Derick Rethans
On Thu, 26 Feb 2004, Timm Friebe wrote: On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: Hello Timm, [...] Should work #1, Bar::connect() adds an argument No the sugnature is incompatible. An instance of Foo cannot be called with Bar or Connector's connect() Signature. Hence Bar is

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Andrey Hristov
Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. And as a consequence maybe interfaces shouldn't allow constructors. Does inheritance include visibility rules? ;) Andrey -- PHP

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Zeev Suraski
At 03:28 26/02/2004, Derick Rethans wrote: On Thu, 26 Feb 2004, Marcus Boerger wrote: Hello Timm, well for normal methods we must do that. The derived class must support the same signature that the base class supports. In you example that would only work if the derived method would have a

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Marcus Boerger
Hello Andrey, Thursday, February 26, 2004, 1:08:19 PM, you wrote: Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. And as a consequence maybe interfaces shouldn't allow

[PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
[EMAIL PROTECTED]:~/devel/php/tests cat inheritance.php ?php class Foo { function __construct($foo) { } } class Bar extends Foo { function __construct($foo, $bar) { // Add = NULL after $bar to make it work } } ? [EMAIL PROTECTED]:~/devel/php/tests php-dev

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. And as a consequence maybe interfaces shouldn't allow constructors. marcus Wednesday, February 25, 2004, 11:36:57 PM, you wrote: [EMAIL

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this. What if I want to add a non-default parameter to an

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, well for normal methods we must do that. The derived class must support the same signature that the base class supports. In you example that would only work if the derived method would have a default parameter for the additional parameter: ?php class Foo { function

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Wed, 2004-02-25 at 23:52, Timm Friebe wrote: On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this.

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: Hello Timm, [...] Should work #1, Bar::connect() adds an argument No the sugnature is incompatible. An instance of Foo cannot be called with Bar or Connector's connect() Signature. Hence Bar is not a Foo or Connector. Hrm, that's quite a

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, Hello Zeev, please have a look at this thread. Obviously you started a huge BC break here. See my second comment on a possible way out. Thursday, February 26, 2004, 2:13:48 AM, you wrote: On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: Hello Timm, [...] Should work #1,

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 02:13, Timm Friebe wrote: On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: Hello Timm, [...] Should work #1, Bar::connect() adds an argument No the sugnature is incompatible. An instance of Foo cannot be called with Bar or Connector's connect() Signature. Hence

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 02:38, Marcus Boerger wrote: Hello Timm, [...] Yes! Maybe it would be good to apply the correct rules with E_COMPILE_ERROR in cases where interfaces come into play and E_STRICT for compatibility mode and non interfaces. Would that work for you? Yupp, that's perfect. -

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 23:36 25/02/2004 +0100, Timm Friebe wrote: [EMAIL PROTECTED]:~/devel/php/tests cat inheritance.php ?php class Foo { function __construct($foo) { } } class Bar extends Foo { function __construct($foo, $bar) { // Add = NULL after $bar to make it work } } ? [EMAIL

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 23:52 25/02/2004 +0100, Timm Friebe wrote: On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this. What if I want

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 08:03 26/02/2004 +0100, Timm Friebe wrote: On Thu, 2004-02-26 at 07:49, Andi Gutmans wrote: At 23:36 25/02/2004 +0100, Timm Friebe wrote: [...] Guys, You are breaking the isA relationship. We fixed this so that from now on, people will not make such mistakes anymore (I think it's the right