for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Remorhaz\Lexer\Runtime\Token;
use Remorhaz\Lexer\Runtime\IO\EmptyLexeme;
use Remorhaz\Lexer\Runtime\IO\LexemeInterface;
/**
* @psalm-immutable
*/
final class MatchFail implements MatchResultInterface
{
* @var int[]
* @psalm-var array<int,int>
private $offsets;
public function __construct(int ...$offsets)
$this->offsets = $offsets;
}
* @return bool
* @psalm-pure
public function shouldRepeat(): bool
return false;
public function hasToken(): bool
* @return TokenInterface
public function getToken(): TokenInterface
throw new Exception\TokenNotMatchedException($this->offsets);
public function hasLexeme(): bool
return true;
* @return LexemeInterface
public function getLexeme(): LexemeInterface
return EmptyLexeme::fromOffsets(...$this->offsets);