-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
fix container linting for ProfilerController service in some cases #1459
Conversation
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.
This needs to be done in a compiler pass, not in the DI extension.
DI extensions are working with a partial container. They don't see services defined by other bundles, so there won't ever be a twig
service at that point.
92ae932
to
97f9adb
Compare
Thanks @stof. Indeed this was not working 🤦♂️ Now done within a compiler pass instead. |
e0d6155
to
68f0251
Compare
Interesting test fail with --prefer-lowest on Symfony 4.4.0 🤔 checking |
57923fd
to
25c4cb5
Compare
composer.json
Outdated
@@ -34,7 +34,7 @@ | |||
"symfony/cache": "^4.3.3|^5.0|^6.0", | |||
"symfony/config": "^4.4.3|^5.0|^6.0", | |||
"symfony/console": "^3.4.30|^4.3.3|^5.0|^6.0", | |||
"symfony/dependency-injection": "^4.3.3|^5.0|^6.0", | |||
"symfony/dependency-injection": "^4.4.18|^5.1.10|^6.0", |
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.
needs symfony/symfony#39151
@@ -235,9 +235,9 @@ | |||
</service> | |||
|
|||
<service id="Doctrine\Bundle\DoctrineBundle\Controller\ProfilerController"> | |||
<argument type="service" id="twig" on-invalid="ignore"/> |
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.
Instead of this whole PR, isn't proper fix to use on-invalid="ignore_uninitialized"
instead?
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.
This indeed makes the container linter happy 🤔
But technically the service definition is still useless/invalid if twig
or profiler
are not available? I don't mind 😊 Can also adjust it.
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.
It's symfony's job to remove useless services automatically. If it doesn't do that, that would be an issue for https://github.com/symfony/symfony. symfony/dependency-injection shouldn't shift such responsibility to all the bundles for such use cases instead.
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.
Seems like this was discussed a while back: symfony/symfony#36701
Anyway let's go with the simple solution for now. I will adjust the PR.
25c4cb5
to
8938612
Compare
Looks like ignore_unitialized is still not enough, we do really need to remove it manually... Fixes #1461
Closes #1457