phpdoc

How to indicate that method is a part of interface with PHPDoc?

跟風遠走 提交于 2019-12-05 05:28:34
How to indicate that method is a part of interface with PHPDoc? For example: /** * @implements BarInterface */ class Foo implements BarInterface { /** * @thisMethodIsHereBecauseItIsAPartOf("BarInterface") */ public function doBar() { } } Is there anything appropriate to replace @thisMethodIsHereBecauseItIsAPartOf("BarInterface") with? How to indicate that method is a part of interface with PHPDoc? You do not need to document that, because you use implements BarInterface and a source-code documentation system normally handles these automatically. However you can also use @inherit(doc) : /** *

phpDocumentor How to document available options for string parameter

断了今生、忘了曾经 提交于 2019-12-05 02:50:28
问题 I have a public method for a class and I would like to document the available string values that the method can accept. Would this be acceptable: /** * Set size of photos * * @param string $size can be one of these options: url_sq, url_t, url_s, url_m, url_o * @return void */ public function setSize($size){ $this->_size = $size; } 回答1: Yes, it's acceptable, but you can do it smarter: class TheClass { const photo_size_sq = 'url_sq'; const photo_size_tiny = 'url_t'; const photo_size_small =

Phpdoc No Summary found for this file

こ雲淡風輕ζ 提交于 2019-12-05 00:29:10
I've installed phpDoc on our server, set up etc. It's producing documentation correctly. We're using the 'Responsive' template, however this error occurs regardless of the template used. Under the 'Errors', each file scanned seems to have the following error: Type Line Description error 0 No summary was found for this file I've googled exhaustively for this, and can't find a solution. I've even gone through the effort of tracking down the server error code behind the message PPC:ERR-50000 and attempting to track back the condition which causes the error, but got a bit lost. My Question: What

What is the purpose of these PHPDOC properties?

余生颓废 提交于 2019-12-04 14:58:43
In general, the PHPDOC properties are self-explanatory, but I'm having hard time understanding these: @category - what is this exactly? @package - could some one provide me examples about the usage of this property? The package tag is the key organizing tag that you use in your code. When phpDocumentor generates the docs, it collects elements into the packages that you set. In some cases, you might choose to only use one package name (@package MyPackage) for your entire codebase, such that all files, classes, etc, will appear in that package's docs. However, if you choose to organize things

How to use PHPdoc in Eclipse

为君一笑 提交于 2019-12-04 13:04:28
We are currently in the beginning of a new project, and would like to (for once) comment as much as possible from the start to help future development. I have tried to find out what best practices are of using phpDoc in Eclipse, but with pretty slim results. Can you share your best practices and tricks of using phpDoc to comment stuff in Eclipse? There is no "real standard" about what should be commented and how, but some tags are used by pretty much anyone who comments his code. For instance, I generally use at least : a short descriptions optionnally, a long description @param type name

Eclipse PDT and custom PHPDoc annotations

混江龙づ霸主 提交于 2019-12-04 11:51:51
问题 Is there any way to add custom phpdoc annotation for Eclipse PDT? For example, I want to see @depends (for PHPUnit) in autocomplete list for comments, but now I can see there only standard annotations (for example, @deprecated ) . Thanks in advance. 回答1: I assumed there would be a configuration file somewhere, but looking through the various folders in my Zend Studio installation didnt give me the results I was hoping for. Searching Eclipse.org for Content Assist yielded http://help.eclipse

Regex to strip phpdoc multiline comment

◇◆丶佛笑我妖孽 提交于 2019-12-04 08:37:49
I have this: /** * @file * API for loading and interacting with modules. * More explaination here. * * @author Reveller <me@localhost> * @version 19:05 28-12-2008 */ I'm looking for a regex to strip all but the @token data, so the result would be: @file API for loading and interacting with modules. More explaination here. @author Reveller <me@localhost> @version 19:05 28-12-2008 I now have this: $text = preg_replace('/\r?\n *\* */', ' ', $text); It does the job partially: it only removes the * in front of each line. Who could help me so it also strips /** and the final slash /? Any help would

phpDoc notation to specify return type identical to parameter type

。_饼干妹妹 提交于 2019-12-04 08:27:02
Imagine the following hypothetical class structure, not an all too uncommon scenario with all PHPdoc hinting set up correctly: class BaseFilter { /** ...base methods... */ } class TextFilter extends BaseFilter { public function setMinLength($len) { /** ...irrelevant */ } } class SomethingWithFilters { /** * @param BaseFilter $filter A valid filter to be added. * @return BaseFilter The filter that was added for easy chaining */ public function addFilter(BaseFilter $filter) { $this->filters[] = $filter; return $filter; } /** @var BaseFilter[] A list of filters */ private $filters = []; } Now I

Parsing PHP Doc Comments into a Data Structure

点点圈 提交于 2019-12-04 07:57:16
问题 I'm using the Reflection API in PHP to pull a DocComment (PHPDoc) string from a method $r = new ReflectionMethod($object); $comment = $r->getDocComment(); This will return a string that looks something like this (depending on how well the method was documented) /** * Does this great things * * @param string $thing * @return Some_Great_Thing */ Are there any built-in methods or functions that can parse a PHP Doc Comment String into a data structure? $object = some_magic_function_or_method(

How to doc a variable number of parameters

白昼怎懂夜的黑 提交于 2019-12-04 07:29:56
How do I doc a variable number of parameters? I am writing an application in PHP and JavaScript. Currently I have (in JavaScript): /** * Description * @param {String} description */ function fn() { // arguments holds all strings. } So, how do I doc n-number of string params? E.g. PhpDocumentor suggests using an ellipsis /** * Example of unlimited parameters. * Returns a formatted var_dump for debugging purposes * (since the recurrences of $v are not listed in the actual function signature in the code, * you may wish to highlight they are "optional" in their description) * @param string $s