-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Process PHP configs using the ContainerConfigurator #54970
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...y/Component/DependencyInjection/Tests/Fixtures/config/config_builder_env_configurator.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
use Symfony\Component\DependencyInjection\Tests\Fixtures\AcmeConfig; | ||
use function Symfony\Component\DependencyInjection\Loader\Configurator\env; | ||
|
||
return function (AcmeConfig $config) { | ||
$config->color(env('COLOR')); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I still need to do some config prepending tests, but I feel that we've missed something here as the previous
$this->loadExtensionConfig()
is currently doing more things when prepend argument istrue
, e.g. the nested importing might be broken...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.
I saw you made the
ContainerConfigurator
able to prepend in #52636 so I assumed it was okay but it is indeed missing this part:symfony/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
Lines 238 to 245 in 7c956d8
Don’t know if it is an issue at all though 😓
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.
Yes, it'll be an issue when want to prepend nested configs using imports
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.
After some quick tests, the root issue should be mitigated by processing only the config value this way:
that will keep the prepending strategy working again. Would you mind creating another PR to update it? I can do it otherwise
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.
If you already have the tests I think you’re more reading than I am; go ahead 😁
Would
ContainerConfiguration::extension
serve a purpose then?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.
#54977
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 should be avoided internally where recursive importing is involved, as now importing from
prependExtension()
is supported (which requires an specific holding strategy to keep the importing order). However, you can still use it on your end for trivial array config importing (either in theprependExtension()
orloadExtension()
methods).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.
Okaaay thanks; glad I asked your review 😄