phpdoc

Is PHPDoc verbosity more trouble than it's worth? [closed]

帅比萌擦擦* 提交于 2020-06-26 03:18:22
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Improve this question I tried using PHPDoc for the first time today and quickly ran into a problem. For every 1 line of variable declarations, I had at least 5 lines of comments. Example: /** * Holds path the remote server * @name ... * @global ... */ $myvar = ... Of course,

Is PHPDoc verbosity more trouble than it's worth? [closed]

人走茶凉 提交于 2020-06-26 03:16:23
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Improve this question I tried using PHPDoc for the first time today and quickly ran into a problem. For every 1 line of variable declarations, I had at least 5 lines of comments. Example: /** * Holds path the remote server * @name ... * @global ... */ $myvar = ... Of course,

PHPDoc: Typehint in nested arrays (with e.g. 2 dimensions)

泄露秘密 提交于 2020-01-13 08:06:14
问题 Is there a correct way to document values/objects in arrays which are within another dimension? Normally an array will be handled like this: /** @var ClassName[] $Array */ $Array = array( $InstanceOfClassName,.. ) But i need something like this: /** @var ClassName[][] $Array */ $Array = array( 0 => array( $InstanceOfClassName,.. ) ) This is obviously not working, so what is the correct PHPDoc notation? 回答1: First, understand that this usage of @var is not standard phpDocumentor spec. It is

phpdoc standard for setting default value of an optional parameter?

∥☆過路亽.° 提交于 2020-01-13 07:42:10
问题 Example: /** * This function will determine whether or not one string starts with another string. * @param string $haystack <p>The string that needs to be checked.</p> * @param string $needle <p>The string that is being checked for.</p> * @param boolean $case[optional] <p>Set to false to ignore case(capital or normal characters)</p> * @return boolean <p>If the $haystack string does start with the $needle string, the return will be true. False if not.</p> */ function endsWith($haystack,$needle

Regex to strip phpdoc multiline comment

随声附和 提交于 2020-01-13 02:15:39
问题 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

Proper Way to Document Class in Netbeans PHP

Deadly 提交于 2020-01-11 05:40:07
问题 For reasons of ease of maintenance AND IDE class auto-completion and member hinting, I've used PHPDoc in my project. Given this example class: class my_class { public $id; public $name; public $number; public function __construct() { //Do something } public function Rename($name) { $this->name = $name; } } I would prefer to document all properties ( $id , $name and $number ) with the class documentation itself, which is above the class declaration, and then place documentation for methods (if