|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-11 00:00 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ Hi, Since php5.2, all my classes have error due to something that changed in php5.2 : Fatal error: Class XtfLexer cannot implement previously implemented interface XtfParserRegistrable The reason of that ? Well take a look at the classes (the code does not interest you as it's not the problem) interface XtfParserRegistrable {} interface XtfHeaderHandler extends XtfParserRegistrable {} class XtfLexer implements XtfHeaderHandler, XtfParserRegistrable {} Because the interface extends XtfParserRegistrable, the XtfLexer can not implements XtfParserRegistrable itself. This is STUPID, REALLY STUPID. What happens if one day I change the interface/classes I implements/extends, and if I still wish to benefit from one interface that is *possibly* implemented by my parents interfaces/classes? Well : it will fails. Reproduce code: --------------- Try this : interface XtfParserRegistrable {} interface XtfHeaderHandler extends XtfParserRegistrable {} class XtfLexer implements XtfHeaderHandler, XtfParserRegistrable {} Expected result: ---------------- We can implements interface implemented by parent class/interface, and no (fatal) error should be thrown. Actual result: -------------- We can't.