2021-05-06 13:26:28 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2021-05-06 13:26:28 +02:00
|
|
|
namespace Rector\FileFormatter\Exception;
|
|
|
|
|
|
|
|
use InvalidArgumentException;
|
2021-05-10 22:23:08 +00:00
|
|
|
final class InvalidIndentStyleException extends \InvalidArgumentException
|
2021-05-06 13:26:28 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param array<int, string> $allowedStyles
|
2021-05-09 20:15:43 +00:00
|
|
|
* @return $this
|
2021-05-06 13:26:28 +02:00
|
|
|
*/
|
2021-05-09 20:15:43 +00:00
|
|
|
public static function fromStyleAndAllowedStyles(string $style, array $allowedStyles)
|
2021-05-06 13:26:28 +02:00
|
|
|
{
|
2021-05-09 20:15:43 +00:00
|
|
|
$message = \sprintf('Given style "%s" is not allowed. Allowed are "%s"', $style, \implode(' ', $allowedStyles));
|
2021-05-06 13:26:28 +02:00
|
|
|
return new self($message);
|
|
|
|
}
|
|
|
|
}
|