-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[DependencyInjection] Update ResolveClassPass
to check class existence
#61215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckServiceClassExistsPassTest.php
Outdated
Show resolved
Hide resolved
740f29a
to
65259c9
Compare
src/Symfony/Component/DependencyInjection/Compiler/CheckServiceClassExistsPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/CheckServiceClassExistsPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/CheckServiceClassExistsPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/CheckServiceClassExistsPass.php
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
But then it would not work if you define a manual id and make a typo in the class (although more of a niche case) |
So we could have something like |
65259c9
to
321ccff
Compare
There are many ways one can mess up with their DI config. Validating everything adds to the compilation time. That's something we always considered outside of the scope of the compilation step. |
ResolveClassPass
to check class existence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, test cases changes look consistent with the updated behavior.
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/fixture_app_services.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/fixture_app_services.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/fixture_app_services.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/ResolveClassPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/ResolveClassPass.php
Outdated
Show resolved
Hide resolved
9690e1e
to
349c87c
Compare
349c87c
to
dbd5c25
Compare
Thank you @GaryPEGEOT. |
…without a class when its id is a non-existing FQCN (nicolas-grekas) This PR was merged into the 7.4 branch. Discussion ---------- [DependencyInjection] Deprecate registering a service without a class when its id is a non-existing FQCN | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT #61215 might be too disruptive. This turns the exception into a deprecation. Commits ------- 7d3ad74 [DependencyInjection] Deprecate registering a service without a class when its id is a non-existing FQCN
Currently doesn't check for incorrect factories, but I'm not sure what would be the best approach