vscode-php-getters-setters icon indicating copy to clipboard operation
vscode-php-getters-setters copied to clipboard

Allow to generate setter and getter return type from short doc block

Open Serhii-DV opened this issue 5 years ago • 2 comments

Now, it allows to generate right return type only for 'long' doc blocks, like this:

/**
 * Some variable
 *
 * @var string
 */
private $var;

And it generates getter and setter method with string return type.

But, it doesn't understand short doc block version:

/** @var string */
private $var;

It generates with mixed return type.

Serhii-DV avatar Apr 11 '19 12:04 Serhii-DV

Same problem

ScorpioT1000 avatar May 21 '19 04:05 ScorpioT1000

I didn't have time to fix this in the TS and submit a PR for it but it's fairly trivial to patch the JS to work this way.

In Property.js change the for loop to use previousline not previousline - 1

and change the end of docblock detection to just use

// Reached the end of the doc block if (!text.includes('*')) {

That seems to "just work" for me, however dirty and hacky :)

avfletch avatar May 11 '20 11:05 avfletch