Edit report at https://bugs.php.net/bug.php?id=67778&edit=1
ID: 67778
Updated by: [email protected]
Reported by: [email protected]
Summary: Constructor overriding and derived classes
Status: Open
Type: Bug
Package: PHP Language Specification
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2014-08-05 17:05:35] [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.