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] Add Enum Env Var Processor#46564

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.2fromjack-worman:EnumEnvVarProcessor
Jun 27, 2022
Merged

[DependencyInjection] Add Enum Env Var Processor#46564

nicolas-grekas merged 1 commit intosymfony:6.2fromjack-worman:EnumEnvVarProcessor
Jun 27, 2022

Conversation

@jack-worman
Copy link
Contributor

@jack-wormanjack-worman commentedJun 2, 2022
edited
Loading

QA
Branch?6.2
Bug fix?no
New feature?yes
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRwaiting on approval of feature

Add the ability to transform env variables into \BackedEnums.

For example, you could now autowire an enum from an environment variable:

<?phpuseSymfony\Component\DependencyInjection\Attribute\Autowire;enum AppEnv:string {case Test ='test';case Dev ='dev';case Stage ='stage';case Prod ='prod';}class Foo {publicfunction__construct(        #[Autowire('%env(enum:'.AppEnv::class.':APP_ENV)%')]privateAppEnv$appEnv,    ) {}}

jvasseur reacted with thumbs up emojiruudk reacted with heart emoji
@carsonbot
Copy link

Hey!

I think@ruudk has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@nicolas-grekas
Copy link
Member

This might miss some pieces as I think some regexps like this one might prevent using FQCN in%env()% parameters:

@nicolas-grekas
Copy link
Member

Please update the description of the PR to make it clear what you're proposing. I could guess by looking at the tests, but providing a proper PR description is nonetheless a good thing to help ppl understand what this is about, and start the doc later on.

@nicolas-grekas
Copy link
Member

A next step could be to find a way to make autowiring do its part, so that theenum: prefix wouldn't be needed.
But that's for another PR :)

👍

derrabus reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedJun 27, 2022
edited
Loading

Can you please rebase on latest 6.2? We don't merge PRs with merge commits. If you want to squash while doing so, please do (we'll do it when merging otherwise.)

@jack-worman
Copy link
ContributorAuthor

Rebase and squash is done!

@nicolas-grekas
Copy link
Member

Thank you@jack-worman.

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

@stofstofstof 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

@jack-worman@carsonbot@nicolas-grekas@stof

[8]ページ先頭

©2009-2025 Movatter.jp