|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-12-28 22:39 UTC] sniper@php.net
[2005-12-28 22:48 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
Description: ------------ when implementing interfaces that have common methods in a parent class and an extended class, the code below produces an error. if i provide a method in the child class, it works. it also works if the parent class doesn't implement its' interface. but i think i should be able to inherit from the parent class and satisfy both interfaces. though it would be easy in this example to "code around" the problem, i ran across this in a situation where it won't be quite as easy. Reproduce code: --------------- <?php interface gotsMyMethod { public function myMethod(); } class theparent implements gotsMyMethod { public function myMethod() { return "boo!"; } } interface iNeedsMyMethod { public function myMethod(); } class child extends theparent implements iNeedsMyMethod { } $child = new child(); echo $child->myMethod(); ?> Expected result: ---------------- I expect the code to run without any errors and output "boo!" Actual result: -------------- Fatal error: Can't inherit abstract function iNeedsMyMethod::myMethod() (previously declared abstract in gotsMyMethod) in C:\www\test\bug.php on line 13