Description
This may be easy, or may be hard :).
If you create a service and specify a bad class name, you'll get an error at runtime (when you use the service) similar to:
PHP Fatal error: Class 'Knp\FooBundle\Security\Voter\CourseVoter' not found in /path/to/project/app/cache/dev/appDevDebugProjectContainer.php on line 3832
To a beginner, the appDevDebugProjectContainer
is confusing. I'd love to say something like:
Class "Knp\FooBundle\Security\Voter\CourseVoter" not found. Check the spelling on the "class" configuration for your "course_voter" service.
This could be easily done in a compiler pass. My concern is side effects :). Is it possible that a class will not be available at compiler time but will be available at run-time? If a compiler class won't work, we'd need to add class_exists
in the compiled code, which would be a bummer.
The advantage is clear, the solution might be harder.