要设置基于Symphoy Annotation的路由,我有这一行
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
它工作正常但是不推荐使用的方法:
* @return void
*
* @throws \InvalidArgumentException
*
* @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
* autoloading should be deferred to the globally registered autoloader by then. For now,
* use @example AnnotationRegistry::registerLoader('class_exists')
*/
public static function registerLoader(callable $callable)
由此我不明白我应该使用什么。
谢谢你的建议
AnnotationRegistry已弃用,将在doctrine / annotations 2.0中删除,但现在仍然需要它。
如果你已经设置了自动加载器,他们建议的简单解决方法是通过传入'class_exists'来设置AnnotationRegistry,这是一个php callable函数,只检查类是否存在并返回true / false。
AnnotationRegistry::registerLoader('class_exists');