#66445·symfony

[Console] Support array of enum for `#[Argument]` and `#[Option]`

Author: ThomasLandauerCreated Sep 29, 2026Updated Sep 29, 2026
LabelsConsole

Description

Am I right that with #[Option] array $roles = [] you can define an input argument/option as array, but the array elements will always be read as strings? Source: https://symfony.com/doc/current/console/input.html#using-options-in-invokable-commands

I'm suggesting to support arrays of enums too, similar to EnumType in forms: https://symfony.com/doc/current/reference/forms/types/enum.html#class

Example

The syntax could be: #[Option(class: Role::class)] array $roles = []