Initial commit: queue workspace

Made-with: Cursor
This commit is contained in:
apple
2026-03-21 02:55:24 +08:00
commit 78de918c37
12388 changed files with 1840126 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\Common\Lexer;
use Doctrine\Common\Lexer\AbstractLexer;
use function in_array;
use function is_numeric;
/** @extends AbstractLexer<TokenType, string|int> */
class EnumLexer extends AbstractLexer
{
/**
* {@inheritDoc}
*/
protected function getCatchablePatterns(): array
{
return [
'=|<|>',
'[a-z]+',
'\d+',
];
}
/**
* {@inheritDoc}
*/
protected function getNonCatchablePatterns(): array
{
return [
'\s+',
'(.)',
];
}
/**
* {@inheritDoc}
*/
protected function getType(&$value): TokenType
{
if (is_numeric($value)) {
$value = (int) $value;
return TokenType::INT;
}
if (in_array($value, ['=', '<', '>'])) {
return TokenType::OPERATOR;
}
return TokenType::STRING;
}
}