Req #69110 [Opn->Dup]: Abstract method inheritance behaves differently from concrete inheritance
| From: | nikic@php.net | Date: | Sat, 16 Apr 2016 13:39:31 +0000 |
| Subject: | Req #69110 [Opn->Dup]: Abstract method inheritance behaves differently from concrete inheritance | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200590@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69110&edit=1
ID: 69110
Updated by: nikic@php.net
Reported by: draconyster at gmai dot com
Summary: Abstract method inheritance behaves differently from
concrete inheritance
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #63384.
Previous Comments:
------------------------------------------------------------------------
[2015-02-23 17:14:30] draconyster at gmai dot com
Description:
------------
When extending abstract classes you are not allowed to change an abstract method's signature to
a compatible one. This works perfectly fine for concrete classes though.
Test script:
---------------
//This code works:
class A {
public function a () {}
}
class B extends A {
public function a ($t = false) {}
}
//this code throws an error:
abstract class A {
abstract public function a ();
}
abstract class B extends A {
abstract public function a ($t = false);
}
Expected result:
----------------
Extending an abstract method should behaves consistently with extending concrete methods
Actual result:
--------------
Fatal error: Can't inherit abstract function A::a() (previously declared abstract in B)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69110&edit=1