How to document class properties in PHP 5 with phpDocumentor

后端 未结 4 720
感情败类
感情败类 2020-12-30 20:41

Take in consideration the following PHP 5 class:

class SomeClass
{
    //I want to document this property...
    private $foo;


    function __construct()
          


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 21:24

    In the case you use a __get and __set magic methods you can use @property

    /**
      * Description for the class
      * @property type $foo Description for foo
      * @property type $foo Description for bar
      */
     class SomeClass
     {
         private $foo;
         protected $bar;
    
         public function __get(){
             ...
         }
    
         public function __set(){
             ...
         }
     }
    

    Links with more info:

    • http://www.phpdoc.org/docs/latest/for-users/phpdoc/tags/property.html
    • http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.property.pkg.html

提交回复
热议问题