Debian Codegraph @

vendor/symfony/console/Exception/InvalidOptionException.php

raw
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Console\Exception;
13
14 /**
15 * Represents an incorrect option name or value typed in the console.
16 *
17 * @author Jérôme Tamarelle <[email protected]>
18 */
19 class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
20 {
21 /**
22 * @internal
23 */
24 public static function fromEnumValue(string $name, string $value, array|\Closure $suggestedValues): self
25 {
26 $error = \sprintf('The value "%s" is not valid for the "%s" option.', $value, $name);
27
28 if (\is_array($suggestedValues)) {
29 $error .= \sprintf(' Supported values are "%s".', implode('", "', $suggestedValues));
30 }
31
32 return new self($error);
33 }
34 }