phpdoc

PHPDoc: @return void necessary?

折月煮酒 提交于 2019-11-28 03:44:57
Is it really necessary do something like this: /** * ... * * @return void */ I have quite a few methods that don't have a return value, and it seems really redundant to put something like this in the comment. Would it be considered bad form to leave it out? Jonathan Fingland If it makes it clear for the documentation, then leave it in, but it isn't strictly necessary. It's an entirely subjective decision. Personally, I would leave it out. EDIT I stand corrected. After a little googling, the wikipedia page says: @return [type description] This tag should not be used for constructors or methods

How to do multi-line comments in NetBeans without auto DocBlock formatting?

拟墨画扇 提交于 2019-11-28 00:59:41
问题 Sometimes in my code I like to comment out a block of code for temporary use/reference etc eg: /* blah */ But it's a minor annoyance that if I then want to go and insert a line inside that block, when I click enter, it will automatically put a * on the next line as though I were doing a DocBlock. This happens on every enter key: /* blah<enter pressed here> * */ Now I would have thought this 'auto-formatting' should only take place if the opening comment is using the format /** (two stars).

PHPDoc for variable-length arrays of arguments

让人想犯罪 __ 提交于 2019-11-27 23:01:42
Is there a syntax for documenting functions which take a single configuration array, rather than individual parameters? I'm thinking specifically of CodeIgniter-style libraries, which use a mechanism similar to this: <?php // // Library definition // class MyLibrary { var $foo; var $bar; var $baz; // ... and many more vars... /* Following is how CodeIgniter documents their built-in libraries, * which is mostly useless. AFAIK they should be specifying a name * and description for their @param (which they don't) and omitting * @return for constructors */ /** * @access public * @param array *

Is there a PHPCS standard targeting PHP docblocks?

余生长醉 提交于 2019-11-27 17:28:00
问题 Is there a PHPCS coding standard that would check that proper annotations ( @param , @return , @throws , etc.) are present in a docblock, including the proper spacing between them? 回答1: Try running the following command and see if it produces what you want: phpcs /path/to/code --standard=Squiz --sniffs=Squiz.Commenting.FunctionComment,Squiz.Commenting.FunctionCommentThrowTag,Squiz.Commenting.ClassComment,Squiz.Commenting.FileComment,Squiz.Commenting.VariableComment If it does, you could

Comment associative array in PHP Documentor

狂风中的少年 提交于 2019-11-27 14:38:26
I use several associative arrays in my PHP application and I'm using PHP documentor to comment my sources. I never really did specify comments for the arrays in an array, but now I need to do that and don't know how. $array = array('id' => 'test', 'class' => 'tester', 'options' => array('option1' => 1, 'option2' => 2)) How do I comment this array in the correct way for @var and @param comments? I could do this like this, but I don't know if this is correct: @param string $array['id'] @param string $array['class'] @param int $array['options']['option1'] But how to do this for the @var part? You

A tool to add and complete PHP source code documentation [closed]

北战南征 提交于 2019-11-27 10:48:53
I have several finished, older PHP projects with a lot of includes that I would like to document in javadoc/phpDocumentor style. While working through each file manually and being forced to do a code review alongside the documenting would be the best thing, I am, simply out of time constraints, interested in tools to help me automate the task as much as possible. The tool I am thinking about would ideally have the following features: Parse a PHP project tree and tell me where there are undocumented files, classes, and functions/methods (i.e. elements missing the appropriate docblock comment)

Best way to document Array options in PHPDoc?

≯℡__Kan透↙ 提交于 2019-11-27 09:51:26
问题 I'm struggling to write readable and easy to understand documentation that describes the multi-tree structure for Array options that are passed to a function. Here is an example array structure. $arr = [ 'fields' => [ 'title' => [ 'name' => 'Document.title', 'format' => 'string', 'readonly' => true ] ] ]; There are many possible options for the above array, but this is used as a parameter to a function that understands that structure. function doSomething(array $arr) { ... } I'd like to

php.ini - command line PHP and WAMP server access different files

余生颓废 提交于 2019-11-27 06:32:57
问题 I don't know if this is default behavior or not, but it seems weird to me. I installed WAMP server v2.2e from scratch, with PHP 5.4.3, on a windows 7 machine. I get these minor bugs that i don't really care about (when I activate an extension I sometimes need to exit WAMP and start it again to see the changes), but that's not why I'm here. When I click on the WAMP icon -> PHP -> php.ini, the file I open is the one in the apache directory ( <WAMP dir>\apache\apache2.4.2\bin\php.ini ) The

PHPDoc for variable-length arrays of arguments

China☆狼群 提交于 2019-11-27 04:38:10
问题 Is there a syntax for documenting functions which take a single configuration array, rather than individual parameters? I'm thinking specifically of CodeIgniter-style libraries, which use a mechanism similar to this: <?php // // Library definition // class MyLibrary { var $foo; var $bar; var $baz; // ... and many more vars... /* Following is how CodeIgniter documents their built-in libraries, * which is mostly useless. AFAIK they should be specifying a name * and description for their @param

Is there a standard for documenting GET/POST parameters?

此生再无相见时 提交于 2019-11-27 03:56:37
问题 In a PHP project, even when front controller logic is used for the main application, there can be many stand-alone scripts, ajax snippets and so on. Is there a standardized way - either PHPDoc or something else - to define in the first comment block of the script what GET and/or POST parameters the script will accept / require and of which type they are? I usually help myself by just adding @param s as if the file were a function, and a @return explanation for what the script does and returns