Contents
How to get rid of a reflectionexception error?
Check if there are any spelling mistakes in the routing file, that is may be the name you have written is something and the file name is something else. Check for unnecessary extra lines in *.routing.yml of your module. Add ‘Controller’ to end of file with your Controller Class and to end of Class Name of Controller.
How to fix a reflectionexception error in Drupal?
ReflectionException: Class Drupal\\mdm_user\\Routing\\RouteSubscriber does not exist in ReflectionClass->__construct () (line 31 of core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php). Any idea is appreciated ! It has to be the file structure.
Why do I get the error reflectionexception class does not exist?
Not strictly related to the question but received the error ReflectionException: Class config does not exist I had added a new .env variable with spaces in it. Running php artisan config:clear told me that any .env variable with spaces in it should be surrounded by ” s.
When do you get a classnotfound exception?
Whenever you get a ClassNotFound Exception check the following: For some reason I had to run composer dumpautoload -o. Notice flag -o which mean with optimization. I don’t have any idea why it works only with it but give it a try. Perhaps it helps someone. This will surely work. If not then, you need to do and then, the aforementioned commands.
What to do when reflectionexception does not exist in Laravel?
In my case, there was a syntax error in a Trait, but ReflectionException was shown for the actual Class using that Trait instead. When it is looking for the seeder class file, you can run composer dump-autoload. When you run it again and it’s looking for the Model, you can reference it on the seeder file itself.
When do I get a reflectionexception in composer?
If the issue is not resolved by composer dump-autoload or is not a newly created class. Check for syntax errors in your class and its traits as well. In my case, there was a syntax error in a Trait, but ReflectionException was shown for the actual Class using that Trait instead.