Re: Declaration of Bar::__construct() must be compatible with that of Foo::__construct()
| From: | Adam Maccabee Trachtenberg | Date: | Thu, 26 Feb 2004 00:08:43 +0000 |
| Subject: | Re: Declaration of Bar::__construct() must be compatible with that of Foo::__construct() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8138@lists.php.net to get a copy of this message | ||
On Thu, 26 Feb 2004, Marcus Boerger wrote:
> 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 connect($server) {
> }
> }
>
> class Bar extends Foo {
> function connect($server, $port = NULL) {
> }
> }
> ?>
When was this change made? I have a CVS check out from yesterday and
this is not enforced. This will breaks lots of PHP 4 code.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!