Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DX] Better error on bad service class name #11301

Closed
Labels
DXDX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjection
@weaverryan

Description

@weaverryan

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, theappDevDebugProjectContainer is confusing. I'dlove 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 addclass_exists in the compiled code, which would be a bummer.

The advantage is clear, the solution might be harder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp