* * @internal * * TODO drop when PHP 8.1 / symfony 6.1+ can be required */ class InputOption extends BaseInputOption { /** @var list|\Closure(CompletionInput,CompletionSuggestions):list */ private $suggestedValues; /** * @param string|string[]|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts * @param int|null $mode The option mode: One of the VALUE_* constants * @param string|bool|int|float|string[]|null $default The default value (must be null for self::VALUE_NONE) * @param list|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completionnull for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ public function __construct( string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [], ) { parent::__construct($name, $shortcut, $mode, $description, $default); $this->suggestedValues = $suggestedValues; if ([] !== $suggestedValues && !$this->acceptValue()) { throw new LogicException('Cannot set suggested values if the option does not accept a value.'); } } /** * Adds suggestions to $suggestions for the current completion input. * * @see Command::complete() */ public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { $values = $this->suggestedValues; if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) { // @phpstan-ignore-line throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values))); } if ([] !== $values) { $suggestions->suggestValues($values); } } } __halt_compiler();----SIGNATURE:----Jyqwj/7Isi5Qosr136EwCtFtoPn3LAenzyQJsy9xHgEJxo6GIWuUGmJpYMaWYVeczrOIuYtzF14nxU6g05d2TfYjq2mu0VMayFe0E51lz8xi9L1+Q9MVdkf779kH5Jc8F8Iv8EIapdq9lk/1FQ5dgihvUgD1KD8pbRCxNRtnjOUWwyJ+nS2rX28h+LQXHGgfpTYlyMG8wdADGsCBN0zKqvAF4kyBTPuuE7RnXchWGgRJDvEDlWTspQSRbV2fZJJUY0r+AyQHu1Ap+j83ngfwiymvkjv0U7RkoZdaYqvL9oj76d2rNNH6udIj+g/yv7CzqqvWqJhVsgHB77WJ8xhKg4E0x3ztJ+lXR/WzqXmbpmQkx4QL0A03cZV78vZzDfxYC67TcTBmZhKJVSqnHclRGUBJoyCmorzxj5QziUs4KYfLDzdqU4GxV+TCJgd8x+HuRLCZKQTdnXmsAqsPeMKjrPq1DdA/79MLrX03hTZhz/QSJ3Ww0qSdZLJo9t51YoG2ir7YXA+Bu8ZDYEaR2CL4ijbQJgLkldtYtqNScvDlqXrErwOE9wQSzPJhz3iE4OVRq8fwEMAQ8nXl+UZZC/Fc0mh6vqMe+rFTbzl1Ep23MKkXchovW2h8dWtPquLfDsLYvkJuFPe8LJmeKjCZtwaID52LkxZgTy3tJ13U3Bos11I=----ATTACHMENT:----MzYzOTY1ODQ2NzA4NTQxIDQzNTEwMTA4NjY3MTI4ODcgMTQ0NTA4MDU3OTAyNzM0Ng==