Zearin Posted January 18, 2007 Share Posted January 18, 2007 I've not too far into building my first framework (OOP) in PHP5, and I'm using Doxygen to generate documentation for it.I have a question about interfaces: If a parent class implements an interface, must all descendant classes explicitly say "implements InterfaceName" as well? If it is not strictly required, is it considered desirable in the interests of Best Practices?The reason I ask is that I have a small hierarchy consisting of three classes: Parent |-------+------|Child1 Child2I have all 3 classes explicitly stating "implements InterfaceName". However, Doxygen is generating a confusing result for me: although it seems to recognize that my interface is an interface and not a class, it builds the inheritance diagram as follows: Interface + +------------|-------------+ Child1 Parent Child2 + |----------------------| Child1 Child2So yeah. Doxygen's fault? Mine? Nobody's? Most importantly, I'm interested in Best Practices. :D Quote Link to comment Share on other sites More sharing options...
448191 Posted January 18, 2007 Share Posted January 18, 2007 [quote]I have a question about interfaces: If a parent class implements an interface, must all descendant classes explicitly say "implements InterfaceName" as well? [/quote]No.Avoid multiple levels of inheritance, only the parent class need specify the interface. Correct diagram should like this: Interface + Parent + |----------------------| Child1 Child2Child classes can implement other interfaces in addition. Quote Link to comment Share on other sites More sharing options...
Zearin Posted January 18, 2007 Author Share Posted January 18, 2007 Thanks.In that case, is there a standard way to mark child classes as inheriting an interface from above? (I'm talking about in documentation codeblocks, e.g. "/** @someTag some text ... */".) Quote Link to comment Share on other sites More sharing options...
448191 Posted January 18, 2007 Share Posted January 18, 2007 Not that I know of. Quote Link to comment Share on other sites More sharing options...
Jenk Posted January 23, 2007 Share Posted January 23, 2007 Shouldn't need it, as the documentor should reference the parent class. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.