validation-bugsnag-email
This commit is contained in:
8
vendor/doctrine/lexer/UPGRADE.md
vendored
8
vendor/doctrine/lexer/UPGRADE.md
vendored
@@ -6,6 +6,14 @@ awareness about deprecated code.
|
||||
- Use of our low-overhead runtime deprecation API, details:
|
||||
https://github.com/doctrine/deprecations/
|
||||
|
||||
# Upgrade to 3.0.0
|
||||
|
||||
`Doctrine\Common\Lexer\Token` no longer implements `ArrayAccess`.
|
||||
Parameter type declarations have been added to
|
||||
`Doctrine\Common\Lexer\AbstractLexer` and `Doctrine\Common\Lexer\Token`.
|
||||
You should add both parameter type declarations and return type declarations to
|
||||
your lexers, based on the `@return` phpdoc.
|
||||
|
||||
# Upgrade to 2.0.0
|
||||
|
||||
`AbstractLexer::glimpse()` and `AbstractLexer::peek()` now return
|
||||
|
11
vendor/doctrine/lexer/composer.json
vendored
11
vendor/doctrine/lexer/composer.json
vendored
@@ -26,15 +26,14 @@
|
||||
],
|
||||
"homepage": "https://www.doctrine-project.org/projects/lexer.html",
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"doctrine/deprecations": "^1.0"
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9 || ^10",
|
||||
"phpstan/phpstan": "^1.3",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||
"doctrine/coding-standard": "^10",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"psalm/plugin-phpunit": "^0.18.3",
|
||||
"vimeo/psalm": "^4.11 || ^5.0"
|
||||
"vimeo/psalm": "^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
54
vendor/doctrine/lexer/src/AbstractLexer.php
vendored
54
vendor/doctrine/lexer/src/AbstractLexer.php
vendored
@@ -7,7 +7,6 @@ namespace Doctrine\Common\Lexer;
|
||||
use ReflectionClass;
|
||||
use UnitEnum;
|
||||
|
||||
use function get_class;
|
||||
use function implode;
|
||||
use function preg_split;
|
||||
use function sprintf;
|
||||
@@ -27,31 +26,25 @@ abstract class AbstractLexer
|
||||
{
|
||||
/**
|
||||
* Lexer original input string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $input;
|
||||
private string $input;
|
||||
|
||||
/**
|
||||
* Array of scanned tokens.
|
||||
*
|
||||
* @var list<Token<T, V>>
|
||||
*/
|
||||
private $tokens = [];
|
||||
private array $tokens = [];
|
||||
|
||||
/**
|
||||
* Current lexer position in input string.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $position = 0;
|
||||
private int $position = 0;
|
||||
|
||||
/**
|
||||
* Current peek of current lexer position.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $peek = 0;
|
||||
private int $peek = 0;
|
||||
|
||||
/**
|
||||
* The next token in the input.
|
||||
@@ -59,7 +52,7 @@ abstract class AbstractLexer
|
||||
* @var mixed[]|null
|
||||
* @psalm-var Token<T, V>|null
|
||||
*/
|
||||
public $lookahead;
|
||||
public Token|null $lookahead;
|
||||
|
||||
/**
|
||||
* The last matched/seen token.
|
||||
@@ -67,14 +60,12 @@ abstract class AbstractLexer
|
||||
* @var mixed[]|null
|
||||
* @psalm-var Token<T, V>|null
|
||||
*/
|
||||
public $token;
|
||||
public Token|null $token;
|
||||
|
||||
/**
|
||||
* Composed regex for input parsing.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $regex;
|
||||
private string|null $regex = null;
|
||||
|
||||
/**
|
||||
* Sets the input data to be tokenized.
|
||||
@@ -86,7 +77,7 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInput($input)
|
||||
public function setInput(string $input)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->tokens = [];
|
||||
@@ -125,7 +116,7 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPosition($position = 0)
|
||||
public function resetPosition(int $position = 0)
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
@@ -133,11 +124,9 @@ abstract class AbstractLexer
|
||||
/**
|
||||
* Retrieve the original lexer's input until a given position.
|
||||
*
|
||||
* @param int $position
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInputUntilPosition($position)
|
||||
public function getInputUntilPosition(int $position)
|
||||
{
|
||||
return substr($this->input, 0, $position);
|
||||
}
|
||||
@@ -151,7 +140,7 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @psalm-assert-if-true !=null $this->lookahead
|
||||
*/
|
||||
public function isNextToken($type)
|
||||
public function isNextToken(int|string|UnitEnum $type)
|
||||
{
|
||||
return $this->lookahead !== null && $this->lookahead->isA($type);
|
||||
}
|
||||
@@ -194,7 +183,7 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function skipUntil($type)
|
||||
public function skipUntil(int|string|UnitEnum $type)
|
||||
{
|
||||
while ($this->lookahead !== null && ! $this->lookahead->isA($type)) {
|
||||
$this->moveNext();
|
||||
@@ -204,12 +193,9 @@ abstract class AbstractLexer
|
||||
/**
|
||||
* Checks if given value is identical to the given token.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int|string $token
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isA($value, $token)
|
||||
public function isA(string $value, int|string|UnitEnum $token)
|
||||
{
|
||||
return $this->getType($value) === $token;
|
||||
}
|
||||
@@ -250,14 +236,14 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function scan($input)
|
||||
protected function scan(string $input)
|
||||
{
|
||||
if (! isset($this->regex)) {
|
||||
$this->regex = sprintf(
|
||||
'/(%s)|%s/%s',
|
||||
implode(')|(', $this->getCatchablePatterns()),
|
||||
implode('|', $this->getNonCatchablePatterns()),
|
||||
$this->getModifiers()
|
||||
$this->getModifiers(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -277,7 +263,7 @@ abstract class AbstractLexer
|
||||
$this->tokens[] = new Token(
|
||||
$firstMatch,
|
||||
$type,
|
||||
$match[1]
|
||||
$match[1],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -289,10 +275,10 @@ abstract class AbstractLexer
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
public function getLiteral($token)
|
||||
public function getLiteral(int|string|UnitEnum $token)
|
||||
{
|
||||
if ($token instanceof UnitEnum) {
|
||||
return get_class($token) . '::' . $token->name;
|
||||
return $token::class . '::' . $token->name;
|
||||
}
|
||||
|
||||
$className = static::class;
|
||||
@@ -336,11 +322,9 @@ abstract class AbstractLexer
|
||||
/**
|
||||
* Retrieve token type. Also processes the token value if necessary.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return T|null
|
||||
*
|
||||
* @param-out V $value
|
||||
*/
|
||||
abstract protected function getType(&$value);
|
||||
abstract protected function getType(string &$value);
|
||||
}
|
||||
|
97
vendor/doctrine/lexer/src/Token.php
vendored
97
vendor/doctrine/lexer/src/Token.php
vendored
@@ -4,9 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Common\Lexer;
|
||||
|
||||
use ArrayAccess;
|
||||
use Doctrine\Deprecations\Deprecation;
|
||||
use ReturnTypeWillChange;
|
||||
use UnitEnum;
|
||||
|
||||
use function in_array;
|
||||
@@ -14,9 +11,8 @@ use function in_array;
|
||||
/**
|
||||
* @template T of UnitEnum|string|int
|
||||
* @template V of string|int
|
||||
* @implements ArrayAccess<string,mixed>
|
||||
*/
|
||||
final class Token implements ArrayAccess
|
||||
final class Token
|
||||
{
|
||||
/**
|
||||
* The string value of the token in the input string
|
||||
@@ -24,7 +20,7 @@ final class Token implements ArrayAccess
|
||||
* @readonly
|
||||
* @var V
|
||||
*/
|
||||
public $value;
|
||||
public string|int $value;
|
||||
|
||||
/**
|
||||
* The type of the token (identifier, numeric, string, input parameter, none)
|
||||
@@ -38,15 +34,14 @@ final class Token implements ArrayAccess
|
||||
* The position of the token in the input string
|
||||
*
|
||||
* @readonly
|
||||
* @var int
|
||||
*/
|
||||
public $position;
|
||||
public int $position;
|
||||
|
||||
/**
|
||||
* @param V $value
|
||||
* @param T|null $type
|
||||
*/
|
||||
public function __construct($value, $type, int $position)
|
||||
public function __construct(string|int $value, $type, int $position)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->type = $type;
|
||||
@@ -58,88 +53,4 @@ final class Token implements ArrayAccess
|
||||
{
|
||||
return in_array($this->type, $types, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the value, type or position property instead
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
Deprecation::trigger(
|
||||
'doctrine/lexer',
|
||||
'https://github.com/doctrine/lexer/pull/79',
|
||||
'Accessing %s properties via ArrayAccess is deprecated, use the value, type or position property instead',
|
||||
self::class
|
||||
);
|
||||
|
||||
return in_array($offset, ['value', 'type', 'position'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the value, type or position property instead
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param O $offset
|
||||
*
|
||||
* @return mixed
|
||||
* @psalm-return (
|
||||
* O is 'value'
|
||||
* ? V
|
||||
* : (
|
||||
* O is 'type'
|
||||
* ? T|null
|
||||
* : (
|
||||
* O is 'position'
|
||||
* ? int
|
||||
* : mixed
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @template O of array-key
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
Deprecation::trigger(
|
||||
'doctrine/lexer',
|
||||
'https://github.com/doctrine/lexer/pull/79',
|
||||
'Accessing %s properties via ArrayAccess is deprecated, use the value, type or position property instead',
|
||||
self::class
|
||||
);
|
||||
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated no replacement planned
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
Deprecation::trigger(
|
||||
'doctrine/lexer',
|
||||
'https://github.com/doctrine/lexer/pull/79',
|
||||
'Setting %s properties via ArrayAccess is deprecated',
|
||||
self::class
|
||||
);
|
||||
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated no replacement planned
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
Deprecation::trigger(
|
||||
'doctrine/lexer',
|
||||
'https://github.com/doctrine/lexer/pull/79',
|
||||
'Setting %s properties via ArrayAccess is deprecated',
|
||||
self::class
|
||||
);
|
||||
|
||||
$this->$offset = null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user