On Thu, Sep 26, 2013 at 11:19 PM, Robert Stoll <rst...@tutteli.ch> wrote:
> Heya > > > > I would like to have some opinions on the topic inconsistency between > methods and __construct > > See the following code: > > > > class A { > > function __construct($a) {} > > function foo($a) {} > > } > > class B extends A { > > function __construct($a, $b) {} > > function foo($a, $b) {} > > } > > > > If you work in strict mode, then you will see the error message > > Strict Standards: Declaration of B::foo() should be compatible with > A::foo($a) > > > > I perfectly understand that the strict standard cannot be applied to the > __construct and I would not suggest to change that. But I think it is > somewhat strange that I am able to call __construct as it was a normal > method from everywhere. > > Am I the only one thinking this, is there actually someone who is using > __construct as re-initialising method? > > > > Cheers, > > Robert > > > > > > > > php doesn't invoke the parent's constructor from the subclass if the subclass also have a constructor, so in that case calling parent::__construct() manually is your only option if you want the parent constructor to be executed. -- Ferenc Kovács @Tyr43l - http://tyrael.hu