我不明白为什么PhpStorm给了我以下警告
PHPDoc注释与这种方法不匹配函数或方法签名:
/** * 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; }
警告并不是非常具体,我已经尝试过几种改变返回类型为“Object”,“mixed”甚至“int”(尝试)的东西,但没有改变.这里有什么问题?
应该是@throws不@throw.
如果您只是在函数或类var声明的行上键入/ **,它将为您自动插入基础PHPDoc.这就是我注意到的区别.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。