Re: phpdoc and interfaces
| From: | Chuck Burgess | Date: | Tue, 05 Aug 2008 16:51:47 +0000 |
| Subject: | Re: phpdoc and interfaces | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-50534@lists.php.net to get a copy of this message | ||
On Tue, Aug 5, 2008 at 9:22 AM, David Jean Louis <izimobil@gmail.com> wrote:
> Does phpdoc can recognize/handle php interfaces ?
> If so:
> * are there any @ tags to put or something special to do to make phpdoc
> list them in the "classes" toc ? (or better: an "interfaces" toc);
> * how do I make phpdoc mention and link the interface in a class that
> implements one (ala class inheritance) ?
Just verified phpdoc's behavior using this test file:
*<?php
/**
* file docblock
* @package Test
*/
/**
* interface docblock
* @package Test
*/
interface Foo {
public function hello() {}
}
/**
* class docblock
* @package Test
*/
class Bar implements Foo {
public function hello() {
return false;
}
}
?>
*The resulting docs (with the default *HTML:frames:default* output
converter) show that the left-side menu does indeed list *Interfaces* as a
heading just like it does with *Classes* and *Functions*. Looking at the
class doc for *Bar*, I see it includes a specific section for "Implements
interfaces:" and it lists *Foo*. Looking at the interface doc for *Foo*, it
does *not* list classes that implement it.
So, specifically addressing David's questions:
- yes, phpdoc recognizes interfaces
- no @tags are necessary... it looks for the keywords in the code itself
- it does list them under an *Interfaces* table-of-contents area
- you don't have to do anything special in order for a class's doc to
show the interfaces that it implements... in fact, you can't really stop it
from doing so ;-)
--
CRB