|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-21 20:56 UTC] helly@php.net
[2012-02-02 22:02 UTC] lsmith@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 06:00:01 2025 UTC |
Description: ------------ When we want to implement an interface in a child class that extends an abstract class that contains an abstract method that is in the interface, we get an error. This kind of bug has already been submited in #35057 and was marked as bogus because AClasse::show obviously is not the same as IClasse::show. But in the code we only say that IClasse::show is the same as AClasseConcrete::show. To me, the IClasse should not care how AClasseConcrete manage to implements the interface. The important thing is that AClasseConcrete::show IS the same as IClasse::show. I've checked the documentation and was not able to find this exact case and I've try this concept in other langages (like Java) with success. I think at least it should be discussed. If it has been discussed already, I'm really sorry for the time I made you spent on this. Greatings Reproduce code: --------------- interface IClasse { public function show (); } abstract class AClasse { abstract public function show (); } class AClasseConcrete extends AClasse implements IClasse { public function show (){ echo "Everything is ok"; } } $classe = new AClasseConcrete (); $classe->show (); Expected result: ---------------- "Everything is ok" Actual result: -------------- Fatal error: Can't inherit abstract function IClasse::show() (previously declared abstract in AClasse) in /home/geraldc/workspace/Copix_3/www/syntax_playground.php