How to use PHPdoc in Eclipse

We are currently at the beginning of a new project and want (this time) to comment as much as possible from the very beginning to help in future development.

I tried to figure out what are the best methods for using phpDoc in Eclipse, but with pretty subtle results.

Can you share your recommendations and tricks using phpDoc for comments in Eclipse?

+3
source share
2 answers

There is no “real standard” about what to comment on and how, but some tags are used by almost everyone who comments on its code.

For example, I usually use at least:

  • brief descriptions
  • ,
  • @param type name description: /
  • @returns type: /
  • @throws ExceptionType: /
  • @see ...: URL,
  • , @package @subpackage
  • , ( IDE, ) @property type $name: Eclipse PDT , - Doctrine , .

Eclipse PDT, ( @param); , Eclipse PDT: , ; -)


, , / (Zend Framework, Doctrine,...), , - , -, .

, Zend Framework, :

/**
 * @package    Zend_Cache
 * @subpackage Zend_Cache_Backend
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface

:

/**
 * Test if a cache is available for the given id and (if yes) return it (false else)
 *
 * WARNING $doNotTestCacheValidity=true is unsupported by the Apc backend
 *
 * @param  string  $id                     cache id
 * @param  boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
 * @return string cached datas (or false)
 */
public function load($id, $doNotTestCacheValidity = false)


, - : , .

+9

, , phpdoc Eclipse .

, , - PhpDocumentor . PhpDocumentor , errors.html . , PhpDocumentor, , . .

, , , PHP_CodeSniffer PEAR [1]. , , , .

[1] - http://pear.php.net/package/PHP_CodeSniffer

+1

Source: https://habr.com/ru/post/1733759/


All Articles