Mat*_*oli 13 php warnings phpdoc phpstorm
我无法理解为什么PhpStorm会PHPDoc comment does not match function or method signature对此方法给出以下警告:
/**
* Create a new instance of the class
* @param string $classname Class to instantiate
* @return object the instance
* @throw FactoryException If the class is not instantiable
*/
private function newInstance($classname) {
$reflectionClass = new \ReflectionClass($classname);
if (! $reflectionClass->isInstantiable()) {
throw new FactoryException("The class $classname is not instantiable.");
}
return new $classname;
}
Run Code Online (Sandbox Code Playgroud)
警告不是很具体,我已经尝试过几种方法,例如将返回类型更改为"对象","混合"或甚至"整数"(尝试),但它没有改变.这里有什么问题 ?
应该@throws不是@throw.
如果您只是键入/**函数或类var声明的行,它将自动为您插入一个基本的PHPDoc.这就是我注意到差异的方式.
