[英]Laravel 4 ReflectionException on DI
I am working on a code as a new developer and after long refactoring I got one error that is bugging me. 我正在以新开发人员的身份编写代码,经过长时间的重构,我遇到了一个困扰我的错误。 One method id erroring out, and it is throwing a ReflectionException: Class does not exist
. 一种方法id出错,并且抛出了ReflectionException: Class does not exist
。 The error is thrown in this line: 该行中将引发错误:
$shippingService = App::make('ShippingServiceInterface');
The actual class does of course exist. 实际的课程当然存在。 I've tried running composer dump-autoload
, and halting and bringing up vagrant machine up again but no avail. 我试过运行composer dump-autoload
,并再次停止并启动无业游民的机器,但无济于事。
Interface itself has two methods and is namespaced. 接口本身有两种方法,并已命名空间。
Folder structure is different than regular Laravel app in a way that everything is stored in a lib
folder which is autoloaded completely through composer.json
. 文件夹结构与常规Laravel应用程序不同之处在于,所有内容都存储在lib
文件夹中,该文件夹通过composer.json
完全自动加载。
Any ideas how can I track this issue down? 有什么想法可以追踪这个问题吗?
EDIT: 编辑:
I tried adding it to an existing service provider and then running dump-autoload
, but still the same. 我尝试将其添加到现有服务提供商中,然后运行dump-autoload
,但仍然相同。
EDIT 2: 编辑2:
Even stranger thing is that in autoload_classmap.php
I see the class being loaded after running dump-autoload
甚至更奇怪的是,在autoload_classmap.php
我看到运行dump-autoload
之后正在dump-autoload
我发现错误实际上是所注入的接口没有任何实现它的对象,因此实际上无法注入任何具体的类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.