Bug #67778 [Opn->Csd]: Constructor overriding and derived classes

From: Date: Sun, 28 Jun 2015 21:52:12 +0000
Subject: Bug #67778 [Opn->Csd]: Constructor overriding and derived classes
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-819@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67778&edit=1 ID: 67778 Updated by: stas@php.net Reported by: joelm@php.net Summary: Constructor overriding and derived classes -Status: Open +Status: Closed Type: Bug Package: PHP Language Specification PHP Version: Irrelevant -Assigned To: +Assigned To: stas Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2015-06-28 21:52:06] stas@php.net Abstract is not an override, it's an implementation, since abstract is not a method definition, so there's nothing to override. You only override an existing method. I'll refine the language to emphasize this fact. ------------------------------------------------------------------------ [2014-08-05 17:05:35] joelm@php.net Description: ------------ https://github.com/php/php-langspec/blob/master/spec/14-classes.md#constructors "Constructors can be overridden in a derived class by redeclaring them. However, an overriding constructor need not have the same signature as defined in the base class." This is not accurate. If there is no abstract decl for __construct in the inheritance hierarchy, then the derived class can use whatever signature it wants. If there is an abstract decl for __construct in the inheritance hierarchy, then the derived class's __construct method needs to match the signature of the abstract decl. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67778&edit=1

« previous php.standards (#819) next »