Bug #67777 [Opn->Csd]: Method overriding and derived classes

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=67777&edit=1

 ID:                 67777
 Updated by:         [email protected]
 Reported by:        [email protected]
 Summary:            Method overriding and derived classes
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            PHP Language Specification
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of [email protected]
Revision: http://git.php.net/?p=php-langspec.git;a=commit;h=a763e15f705de443d1529e50e479bf86c5f0d7be
Log: Fix bug #67777


Previous Comments:
------------------------------------------------------------------------
[2014-11-27 13:01:19] cmbecker69 at gmx dot de

> When a derived class overrides a method, if there is no abstract
> decl (either abstract decl in an abstract parent or a decl in an
> implemented interface) in the inheritance hierarchy then
> whatever signature you want can be used for the derived method.

In this case, however, the derived class doesn't *override* a
method, but rather it *introduces* a new method.

------------------------------------------------------------------------
[2014-11-27 10:44:52] [email protected]

Is this a PHP bug ?

------------------------------------------------------------------------
[2014-08-05 17:01:00] [email protected]

Description:
------------
https://github.com/php/php-langspec/blob/master/spec/14-classes.md#general

"Methods and properties from a base class can be overridden in a derived class by redeclaring them with the same signature defined in the base class." This is not accurate. When a derived class overrides a method, if there is no abstract decl (either abstract decl in an abstract parent or a decl in an implemented interface) in the inheritance hierarchy then whatever signature you want can be used for the derived method. If there is an abstract decl in the inheritance hierarchy, then the derived method's signature must match the signature of the abstract decl. 



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67777&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.