PhpStorm not to generate docblock for function/method arguments that are typehinted

萝らか妹 提交于 2019-12-24 01:54:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!