Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
nicolas-grekas merged 1 commit intosymfony:6.2fromHypeMC:env-param
Oct 19, 2022

Conversation

@HypeMC
Copy link
Member

QA
Branch?6.2
Bug fix?no
New feature?yes
Deprecations?yes
Tickets-
LicenseMIT
Doc PR-

The original idea of this PR was to allow injectingstring $env into 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:

- return function (AcmeConfig $config, ContainerConfigurator $c) {+ return function (AcmeConfig $config, string $env) {- if ('dev' === $c->env()) {+ if ('dev' === $env) {    // ...  }};

Injecting the$env variable looks a bit cleaner IMO.

However, while working on this PR I discovered#41182 . Even though there's already an$env variable presets in the scope of php files which can be used for the same thing, it's not really IDE friendly:

image

Since the original PR mentioned the that the$env variable 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.

@carsonbotcarsonbot added this to the6.2 milestoneOct 18, 2022
@carsonbotcarsonbot changed the title[DI] Allow injecting the current env into php config closures[DependencyInjection] Allow injecting the current env into php config closuresOct 18, 2022
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

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.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(rebase needed)

@nicolas-grekas
Copy link
Member

Thank you@HypeMC.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

4 participants

@HypeMC@nicolas-grekas@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp