Code Monkey home page Code Monkey logo

vscode-phpdoc-generator's People

Contributors

dmitrach avatar ronvanderheijden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-phpdoc-generator's Issues

Optional alignment parameters and return

I ofter align parameters to columns.

   /**
     * Adds a new value to the current group or to the given group.
     *
     * @param  string $name
     * @param  mixed  $value
     * @param  string $groupName
     * @return void
     */
    public function add(string $name, $value, string $groupName = null)

I got:

   /**
     * @param string $name
     * @param mixed $value
     * @param string $groupName
     * 
     * @return void
     */
    public function add(string $name, $value, string $groupName = null)

https://yadi.sk/i/LcKyJ0fQFtzi_A

Update PHPDoc

When a PHPDoc is already available, it should be updated.

Local variable documentation

Please add support for documenting (local) variables.

When issuing the command Generate a PHPDoc comment on such a line of code:

$test = new \stdClass();

a PHPDoc comment should be added:

/** @var \stdClass $test */
$test = new \stdClass();

Incorrect indent for functions

Incorrect:

static public function name()
{
}

https://yadi.sk/i/lf-ZLcu6_MxDVw

Incorrect:

function name()
{
}

https://yadi.sk/i/bAbl8KYzcGpLwg

Correct:

public static function name()
{
}

https://yadi.sk/i/-BnRF7Q8zYAEBQ

The main characteristics of a named function are 'function' and its name: function name().

return /(\s+)?(?:abstract\s+)?(?:public|private|protected)?\s+(?:static\s+)?function\s+(\w+)\s*\((.+)?\)(?:\s*:\s*(\\?\w+))?/;

'abstract' and 'static' are optional properties.

Optional description

I describe methods, because without descriptions those functions are not understanding, even when they have descriptions of parameters.

Comments must be generated with descriptions.
Not all people use the description, therefore the it must be as option and default is enabled.

Detect function indentation

When using the keyboard shortcut on a function which is indented in the file, the resulting docblock does not detect this:

Screenshot 2020-05-17 at 11 52 18

It would be nice if this identation is detected and matched, using the user's current setting for spaces/tabs

Parser for the return type of the function

The returned function type is not recognized correctly when a space is added before :.

/**
* @param string $foo
* 
* @return bool
*/
function correct(string $foo): bool
{
}

/**
* @param string $foo
* 
* @return void
*/
function incorrect(string $foo) : bool
{
}

Incorrect regular expression in lib/regex.js.
Should be

 static method() {                                                                                                                                                  
     return /(\s+)?(?:abstract\s+)?(?:public|private|protected)?\s+(?:static\s+)?function\s+(\w+)\s*\((.+)?\)(?:\s*:\s+(\\?\w+))?/;                                 
}

Controlled margin before 'return'

I do not use a new line after parameters and before 'return'.
Many people use different margins between groups.

    /**
     * Returns a EstimateGroup by the name.
     *
     * @param  string $name
     * @return EstimateGroup|null
     */
    public function getGroup(string $name): ?EstimateGroup
    {
        return $this->groups[$name] ?? null;
    }

https://yadi.sk/i/cdht01JFZD6oyA

Handle multiline method parameters

Add support for parameters on multiple lines.

Example

protected function swapNumbers(
    int &$number1, 
    int &$number2
): void
{
    $number1 ^= $number2 ^= $number1 ^= $number2;
}

Different formats of types and short types

I have the following code:

    public function name(int $value): int
    {
        # code...
    }

I got the following comment:

    /**
     * @param integer $value
     * 
     * @return int
     */
    public function name(int $value): int
    {
        # code...
    }

There are different formats of types: short and long. This should be controlled by the configuration and they should have the same format.

Arguments have two types

I got the description

    /**
     * Adds a new value to the current group or to the given group.
     *
     * @param  string $name
     * @param  mixed  $value
     * @param  string $groupName
     * @return void
     */
    public function add(string $name, $value, string $groupName = null)

Must be:

    /**
     * Adds a new value to the current group or to the given group.
     *
     * @param  string $name
     * @param  mixed  $value
     * @param  string|null $groupName
     * @return void
     */
    public function add(string $name, $value, string $groupName = null)

https://yadi.sk/i/gQW1sLXPn_mEKQ

__constructor without @return

The extenstion generates @return void for __constuctor()
PHP does not forbid returning data from __constructor(), but it usually doesn't.

This should be the default, without @return:

   /**
    * Description...
    */
   public function __construct()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.