我想继承PHPDoc的调度程序中引发的异常,以改进文档并了解所有可能的异常。
class SomeController
{
...
/**
* @return JsonResponse
* ### MISSING AUTO GENERATED PHPDOC: @throws SomeException
*/
public function changePassword()
{
/** @uses SomedHandler::handleSomething()*/
$this->commandBus->dispatch(Something::fromArray([
...
]));
return new JsonResponse(null, Response::HTTP_NO_CONTENT);
}
}
class SomedHandler extends SimpleCommandHandler
{
/**
* @param Something $something
* @throws SomeException
*/
public function handleSomething(Something $something)
{
throw new SomeException();
}
}
如上所示,我无法将引发的异常嵌套在处理程序中。我的尝试是在类和要分派的方法中使用标签@uses
,但PhpStorm并未为方法handleSomething()
生成异常。尽管@uses
有助于导航,但我也想抛出异常。