diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 3da4ed6b1c1..fb96c0a5ac6 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -745,11 +745,13 @@ Symfony provides the following env var processors: Tries to convert an environment variable to an actual ``\BackedEnum`` value. This processor takes the fully qualified name of the ``\BackedEnum`` as an argument:: - # App\Enum\Environment + // App\Enum\Suit.php enum Environment: string { - case Development = 'dev'; - case Production = 'prod'; + case Clubs = 'clubs'; + case Spades = 'spades'; + case Diamonds = 'diamonds'; + case Hearts = 'hearts'; } .. configuration-block:: @@ -758,7 +760,7 @@ Symfony provides the following env var processors: # config/services.yaml parameters: - typed_env: '%env(enum:App\Enum\Environment:APP_ENV)%' + suit: '%env(enum:App\Enum\Suit:CARD_SUIT)%' .. code-block:: xml @@ -773,14 +775,17 @@ Symfony provides the following env var processors: https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - %env(enum:App\Enum\Environment:APP_ENV)% + %env(enum:App\Enum\Suit:CARD_SUIT)% .. code-block:: php // config/services.php - $container->setParameter('typed_env', '%env(enum:App\Enum\Environment:APP_ENV)%'); + $container->setParameter('suit', '%env(enum:App\Enum\Suit:CARD_SUIT)%'); + + 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. .. versionadded:: 6.2