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
. 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.
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
.
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.
EDIT 2:
Even stranger thing is that in autoload_classmap.php
I see the class being loaded after running dump-autoload
我发现错误实际上是所注入的接口没有任何实现它的对象,因此实际上无法注入任何具体的类。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.