Skip to content

[DependencyInjection] Changing enum: example away from APP_ENV #17507

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 1 commit into from
Jan 23, 2024

Conversation

ThomasLandauer
Copy link
Contributor

@ThomasLandauer ThomasLandauer commented Dec 5, 2022

https://symfony.com/doc/current/configuration/env_var_processors.html#built-in-environment-variable-processors

Reason: When I first read this, I was expecting that the Symfony-internal ways to get the environment ({{ app.environment }}, $routingConfigurator->env() ,etc.) would now return the enum. But this is not the case. So if you explain the new processor with exactly this example, there needs to be a caution box, explaining that Symfony's methods still return the string.

  • If you don't agree with this change, I'd still open a separate PR to add the following info (taken from https://symfony.com/blog/new-in-symfony-6-2-improved-enum-support#enums-in-environment-variables), cause that's a missing piece of information here:

    The value stored in the CARD_SUIT env var would be a string like 'spades' but the
    application will use the Suit::Spdes enum value.

  • Besides, as the list of processors is getting longer and longer, I'd suggest to create a sub-heading for each (under "Built-In Environment Variable Processors") and sort them alphabetically, to get rid of the endless indentation, and improve scanability, and get them included in the TOC.
    Should I create a PR for this? If yes, for which version?

@javiereguiluz
Copy link
Member

Not sure what to do about this. At first I was against this PR ... but now I think I'm in favor of it.

What do others think about this? Thanks!

@javiereguiluz javiereguiluz added the Waiting team decision Request for comments from Symfony Docs Team members label Jun 30, 2023
@javiereguiluz javiereguiluz added this to the 6.3 milestone Jan 23, 2024
Reason: When I first read this, I was expecting that the Symfony-internal ways to get the environment (`{{ app.environment }}`, `$routingConfigurator->env()` ,etc.) would now return the enum. But this is not the case. So if you explain the new processor with exactly this example, there needs to be a caution box, explaining that Symfony's methods still return the string.

* If you don't agree with this change, I'd still open a separate PR to add this info (taken from https://symfony.com/blog/new-in-symfony-6-2-improved-enum-support#enums-in-environment-variables), cause that's a missing piece of information:

> The value stored in the ``CARD_SUIT`` env var would be a string like `'spades'` but the
> application will use the ``Suit::Spdes`` enum value.

* Besides, as the list of processors is getting longer and longer, I'd suggest to create a sub-heading for each (under "Built-In Environment Variable Processors"), to get rid of the endless indentation, and improve scanability, and get them included in the TOC.
Should I create a PR for this?
@javiereguiluz javiereguiluz changed the base branch from 6.2 to 6.3 January 23, 2024 15:27
@carsonbot carsonbot changed the title Changing enum: example away from APP_ENV [DependencyInjection] Changing enum: example away from APP_ENV Jan 23, 2024
@javiereguiluz javiereguiluz merged commit 49cc99a into symfony:6.3 Jan 23, 2024
@javiereguiluz
Copy link
Member

This is now merged. I agree that using some env var related to Symfony environments can be too confusing. Thanks Thomas!

@ThomasLandauer ThomasLandauer deleted the patch-2 branch January 23, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DependencyInjection Waiting team decision Request for comments from Symfony Docs Team members
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants