Files
provider_imap/lib/Client/Protocol/Response/Parser/ParseError.php
Sebastian Krupinski e51c65bf19 feat: initial version
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
2026-02-20 21:44:49 +00:00

24 lines
610 B
PHP

<?php
namespace Gricob\IMAP\Protocol\Response\Parser;
final class ParseError extends \Exception
{
/**
* @param TokenType[] $expected
*/
public static function unexpectedToken(?TokenType $given, array $expected, string $input): self
{
return new self(
sprintf(
"Expected token of type %s. Given %s.\n%s",
implode(
' or ',
array_map(fn (TokenType $type) => $type->name, $expected)
),
$given?->name ?? 'null',
$input
)
);
}
}