ronvanderheijden / vscode-phpdoc-generator Goto Github PK
View Code? Open in Web Editor NEWPHPDoc Generator is a VSCode extension that generates a documentation block using a keyboard shortcut.
License: MIT License
PHPDoc Generator is a VSCode extension that generates a documentation block using a keyboard shortcut.
License: MIT License
const VALUE = 'string';
=>
/**
* @var string
*/
const VALUE = 'string';
If a function is throwing exception, it does not add @throws in the doc.
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)
When a PHPDoc is already available, it should be updated.
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:
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().
vscode-phpdoc-generator/lib/regex.js
Line 13 in 37ed3da
'abstract' and 'static' are optional properties.
<?php
abstract class Test
{
}
final class Test
{
}
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.
On Visual Studio Code version 1.45.1 the Control+Enter shortcut is not working, no way to use the extension.
Am I missing something?
Would really love if *
(space asterisk) could be added automatically whenever Enter is pressed from within a PHPdoc, whether on the first line /**
or a middle line.
Please add a setting to allow for custom date formatting. Ideally, support PHP DateTime::format options.
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+))?/;
}
function test(): \Test
function test(): App\Test
Now:
/**
* @return void
*/
function name(): ?float
{
}
Must be:
/**
* @return float|null
*/
function name(): ?float
{
}
https://yadi.sk/i/LVmgqaCulEA1VA
https://yadi.sk/i/nxBGkc26JtQ2nw
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;
}
The @return comment for all functions is always void even when its explicitly an array or string etc.
Add support for parameters on multiple lines.
Example
protected function swapNumbers(
int &$number1,
int &$number2
): void
{
$number1 ^= $number2 ^= $number1 ^= $number2;
}
public \Test $test;
public App\Test $test;
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.
[os]-latest
-> https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-onExample of code:
class MyClass {
public function update(
string $type,
string $slug,
string $title,
string $description
) {
//todo
}
}
when press ctrl+enter phpdoc don't generate for method update
I got:
/**
* @var undefined
*/
protected $currentGroup;
Other extensions returns the following:
/**
* @var [type]
*/
protected $currentGroup;
https://yadi.sk/i/CQa8gfkrwPCJDA
It is convenient, because this is type has not highlight.
function test(array $arr): string
{
}
I want to use different configuration for different folders.
The general config is used for all project, and another config is used for '/tests/...'.
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)
interface ServiceCalculator
{
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.