| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Console\Exception; |
| 13 |
|
| 14 |
|
| 15 |
t> |
| 16 |
|
| 17 |
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface |
| 18 |
{ |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public static function fromEnumValue(string $name, string $value, array|\Closure $suggestedValues): self |
| 23 |
{ |
| 24 |
$error = \sprintf('The value "%s" is not valid for the "%s" argument.', $value, $name); |
| 25 |
|
| 26 |
if (\is_array($suggestedValues)) { |
| 27 |
$error .= \sprintf(' Supported values are "%s".', implode('", "', $suggestedValues)); |
| 28 |
} |
| 29 |
|
| 30 |
return new self($error); |
| 31 |
} |
| 32 |
} |