diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f1d7c7e4..d87f00d9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -380,11 +380,6 @@ parameters: count: 3 path: src/Lexer.php - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#" - count: 1 - path: src/Lexer.php - - message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\ and array\\{\\} will always evaluate to false\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index e8b7f399..774675ab 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -585,7 +585,6 @@ $token - delimiter]]> str[$this->last++]]]> str[$this->last++]]]> str[$this->last]]]> @@ -611,9 +610,6 @@ str[++$this->last]]]> str[++$this->last]]]> - - null - type]]> value]]> diff --git a/src/Lexer.php b/src/Lexer.php index d6dab82d..ab033a57 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -66,49 +66,37 @@ class Lexer /** * The string to be parsed. - * - * @var string|UtfString */ - public $str = ''; + public string|UtfString $str = ''; /** * The length of `$str`. * * By storing its length, a lot of time is saved, because parsing methods * would call `strlen` everytime. - * - * @var int */ - public $len = 0; + public int $len = 0; /** * The index of the last parsed character. - * - * @var int */ - public $last = 0; + public int $last = 0; /** * Tokens extracted from given strings. - * - * @var TokensList */ - public $list; + public TokensList $list; /** * The default delimiter. This is used, by default, in all new instances. - * - * @var string */ - public static $defaultDelimiter = ';'; + public static string $defaultDelimiter = ';'; /** * Statements delimiter. * This may change during lexing. - * - * @var string */ - public $delimiter; + public string $delimiter; /** * The length of the delimiter. @@ -116,10 +104,8 @@ class Lexer * Because `parseDelimiter` can be called a lot, it would perform a lot of * calls to `strlen`, which might affect performance when the delimiter is * big. - * - * @var int */ - public $delimiterLen; + public int $delimiterLen; /** * @param string|UtfString $str the query to be lexed @@ -253,7 +239,7 @@ public function lex(): void $pos = $this->last + 1; // Parsing the delimiter. - $this->delimiter = null; + $this->delimiter = ''; $delimiterLen = 0; while ( ++$this->last < $this->len @@ -264,7 +250,7 @@ public function lex(): void ++$delimiterLen; } - if (empty($this->delimiter)) { + if ($this->delimiter === '') { $this->error('Expected delimiter.', '', $this->last); $this->delimiter = ';'; }