问题
At the moment on my PhpStorm I have the following options enabled:
File | Settings | Editor | Inspections | Missing @return tag` -> Marked both options there (Ignore PHPDoc without @param + Ignore PHPDoc with return type hint).
File | Settings | Editor | Inspections | PHPDoc comment matches function/method signature` -> Mark option about allowing params with typehint.
So according to these settings my functions should look like this:
/**
* @throws \Exception
*/
public function submit(string $email, string $message): Response
{
throw new \Exception('whatever');
}
Never the less when I have a function with no docblock and I press on PhpStorm to auto generate the docblock for this function then it generates the docblocks also for the already typehinted arguments:
So a function like this:
public function submit(string $email, string $message): Response
{
throw new \Exception('whatever');
}
Will be converted to this:
/**
* @param string $email
* @param string $message
* @throws \Exception
*/
public function submit(string $email, string $message): Response
{
throw new \Exception('whatever');
}
Is there a way that I can configure my PhpStorm to generate the docblocks ONLY for parameters that do NOT have typehints.
Note that I know I can configure the templates from PhpStorm. I tried that solution.
On templates you can only tell PhpStorm it's all or nothing. I could not find a way of telling on templates to have the param docblocks only for those WITHOUT typehint.
来源:https://stackoverflow.com/questions/57347491/phpstorm-not-to-generate-docblock-for-function-method-arguments-that-are-typehin