Re: __constructor parameter limitations.

From: Date: Mon, 19 Sep 2011 05:04:39 +0000
Subject: Re: __constructor parameter limitations.
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-55514@lists.php.net to get a copy of this message
Am 19.09.2011 03:00, schrieb Stas Malyshev: > The example without abstract works, but produces E_STRICT which is useless too right - because the following code is totally valid and reasonable even if "my_function" will later get a fourth param $d='default' and the strict warnings here forcing you to disable E_STRICT with the negative impact losing usefull strict-warinings or rewrite tons of code after changes in a extended class with a new optional param someone who is using "my_b" needs not to know anything about "my_a" which usually is in a foreign file and often an external library <?php class my_a { public function my_function($a, $b, $c) { echo "$a, $b, $c"; } } class my_b extends my_a { public function my_function($a) { parent::my_function($a, 'internal default b', 'internal default c'); } } $instance = new my_b(); $instance->my_function('test'); ?>

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#55514) next »