This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206163 - Please make documentation parser little bit smarter.
Summary: Please make documentation parser little bit smarter.
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: PHPDoc (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 19:09 UTC by nazzz
Modified: 2016-09-22 03:58 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nazzz 2011-12-08 19:09:18 UTC
It would be nice to have a button that would parse php file and create missing documentation blocks automatically for class properties and methods. 

Also I would like to see documentation process little bit more smarter. For example currently such code by default is described as:

class myClass
{
    /**
     *
     * @var type 
     */
    public $var1 = 0;
    
    /**
     *
     * @var type 
     */
    public static $var2 = array();

    /**
     *
     * @param type $var
     * @return type 
     */
    public function myMethod($var = array())
    {
        return is_array($var) ? $var : false;
    }
}

What can be improved here is:
* Catching visibility, static or abstract declarations and including it to documentation. 
* Variables containing default value should be automatically recognised as correct datatype (boolean, integer, float, string or array) and values that does not have default property should be marked as "@param mixed". 
* Methods that does not return any value should be marked as "@return void".

So as result we could receive something like this:

class myClass
{
    /**
     * 
     * @access public
     * @var integer
     */
    public $var1 = 0;
    
    /**
     * @static
     * @access public
     * @var array
     */
    public static $var2 = array();

    /**
     * 
     * @access public
     * @param array $var
     * @return array|boolean 
     */
    public function myMethod($var = array())
    {
        return is_array($var) ? $var : false;
    }
    
    /**
     * 
     * @access public
     * @param mixed $name
     * @param mixed $value
     * @return void
     */
    public function __set($name, $value)
    {
        $this->$name = $value;
    }
}