FANDOM


 
m (Category: PHP)
Line 138: Line 138:
 
== Comments ==
 
== Comments ==
 
<!-- parsed by vimtips.py in 0.629234 seconds-->
 
<!-- parsed by vimtips.py in 0.629234 seconds-->
  +
[[Category:PHP]]

Revision as of 07:06, July 23, 2007

Previous TipNext Tip

Tip: #407 - Automatically generate PHPdoc comments

Created: January 18, 2003 23:57 Complexity: intermediate Author: Klaus Horsten <email.5--AT--gmx.net> Version: 6.0 Karma: 16/4 Imported from: Tip#407

Use JCommenter.vim for php-scripts:


jcommenter.vim : A script for automatically generating JavaDoc comments

http://vim.sourceforge.net/script.php?script_id=20


PHPdoc is an imitation of JAVAdoc.

The syntax between the two languages is very close,

see the examples below:


Example 1:

You have the PHP-function:

function serialize_it($something) {

$person = serialize($something); 
return $person; 

}


Put the cursor on the first line and call :call JCommentWriter()<CR>


You get

/**

* 
* 
* @param $something 
* @return 
*/ 

function serialize_it($something) {

$personen = serialize($something); 
return $personen; 

}


Example 2:

You have the PHP-class:

class submenu {

... 

}


Put the cursor on the first line and call :call JCommentWriter()<CR>


You get

/**

* 
* 
* @author 
* @version 
*/ 

class submenu {

... 

}


Example 3:

For a class-variable you get:

/**

  • /

var $urls;


Note:

It does not work if you have = like in

function serialize_it($something = ) {}


But I think jscript.vim can be adapted for the use with PHP.


Klaus

Comments

Community content is available under CC-BY-SA unless otherwise noted.