Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Allow injecting the current env into php config closures#47906
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Works for me, except the deprecation, which is not needed.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
(rebase needed)
Thank you@HypeMC. |
The original idea of this PR was to allow injecting
string $envinto php config closures. Even though this can be done by injectingContainerConfigurator& callingenv()it seems kind of redundant when you don't need any features except the current env, eg when using the config builder classes:Injecting the
$envvariable looks a bit cleaner IMO.However, while working on this PR I discovered#41182 . Even though there's already an
$envvariable presets in the scope of php files which can be used for the same thing, it's not really IDE friendly:Since the original PR mentioned the that the
$envvariable was added for PHP <8 & Symfony 6.2 is >=8.1, it doesn't seem to be needed any more, so it can be deprecated.