-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Add compiler pass and command to check that services wiring matches type declarations #32256
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/Compiler/CheckTypeHintsPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/CheckTypeHintsPass.php
Outdated
Show resolved
Hide resolved
220c681
to
cca6826
Compare
The failure is expected (the pass is not available yet when executing the Framework bundle tests). |
src/Symfony/Component/DependencyInjection/Exception/InvalidParameterTypeHintException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php
Outdated
Show resolved
Hide resolved
Nice feature ! |
0cc5ae0
to
f64d9a9
Compare
0eb486f
to
c0743cb
Compare
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.
PR is now able to lint the container of the Symfony Demo app successfully.
The core of the PR is the new CheckTypeDeclarationsPass
.
The feature is totally opt-in so that it's totally safe merging:
- the pass is not wired by default - it runs only if one enables it in their
Kernel
(ppl from the strict camp will like doing so) - the logic runs on-demand also when executing the
lint:container
command
I enabled the pass in functional tests, for dogfooding :)
c0743cb
to
8230a15
Compare
@@ -17,7 +17,7 @@ | |||
</service> | |||
<service id="Symfony\Component\Validator\Validator\ValidatorInterface" alias="validator" /> | |||
|
|||
<service id="validator.builder" class="Symfony\Component\Validator\ValidatorBuilderInterface"> | |||
<service id="validator.builder" class="Symfony\Component\Validator\ValidatorBuilder"> |
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.
relevant for lower branches?
Thank you @GuilhemN. |
…ces wiring matches type declarations (alcalyn, GuilhemN, nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [DI] Add compiler pass and command to check that services wiring matches type declarations | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27744 | License | MIT | Doc PR | PR replacing #27825. It adds a `lint:container` command asserting the type hints used in your code are correct. Commits ------- 8230a15 Make it really work on real apps 4b3e9d4 Fix comments, improve the feature a6292b9 [DI] Add compiler pass to check arguments type hint
And thank you @alcalyn too! |
PR replacing #27825.
It adds a
lint:container
command asserting the type hints used in your code are correct.