diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a49f1b368..0bf84818a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -320,11 +320,6 @@ parameters: count: 8 path: src/Components/OptionsArray.php - - - message: "#^Right side of && is always true\\.$#" - count: 1 - path: src/Components/OptionsArray.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\OrderKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" count: 2 @@ -535,11 +530,6 @@ parameters: count: 1 path: src/Statement.php - - - message: "#^Strict comparison using \\=\\=\\= between class\\-string\\\\|PhpMyAdmin\\\\SqlParser\\\\Component and null will always evaluate to false\\.$#" - count: 1 - path: src/Statement.php - - message: "#^Argument of an invalid type array\\\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -825,6 +815,11 @@ parameters: count: 1 path: src/Utils/Formatter.php + - + message: "#^Binary operation \"&\" between int and int\\|string results in an error\\.$#" + count: 1 + path: src/Utils/Formatter.php + - message: "#^Binary operation \"&\\=\" between array\\\\>\\|bool\\|string\\|null and array\\\\>\\|bool\\|string\\|null results in an error\\.$#" count: 1 @@ -851,12 +846,12 @@ parameters: path: src/Utils/Formatter.php - - message: "#^Access to an undefined property object\\:\\:\\$alias\\.$#" + message: "#^Trying to invoke int\\\\|int\\<1, max\\>\\|non\\-falsy\\-string but it might not be a callable\\.$#" count: 1 - path: src/Utils/Query.php + path: src/Utils/Formatter.php - - message: "#^Access to an undefined property object\\:\\:\\$expr\\.$#" + message: "#^Argument of an invalid type array\\\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 path: src/Utils/Query.php @@ -865,11 +860,6 @@ parameters: count: 1 path: src/Utils/Query.php - - - message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/Utils/Query.php - - message: "#^Cannot access property \\$dest on PhpMyAdmin\\\\SqlParser\\\\Components\\\\IntoKeyword\\|null\\.$#" count: 1 @@ -890,11 +880,6 @@ parameters: count: 1 path: src/Utils/Query.php - - - message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\:\\:build\\(\\) expects array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression, object given\\.$#" - count: 1 - path: src/Utils/Query.php - - message: "#^Cannot access offset 'value' on mixed\\.$#" count: 3 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 303b23a37..a47659099 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -213,8 +213,6 @@ expr]]> - ! $isExpr - $isExpr $prev[1] !== null function) && ($prev[1] !== null)]]> @@ -470,10 +468,6 @@ options[$lastOptionId]['expr']->expr]]> - - - - @@ -904,9 +898,6 @@ - - $class === null - $built[$field] value]]]> @@ -940,9 +931,6 @@ bool - - $class !== null - $index @@ -1379,9 +1367,6 @@ options['formats']]]> - - type === Token::TYPE_KEYWORD]]> - @@ -1436,7 +1421,7 @@ has - + diff --git a/src/Components/Expression.php b/src/Components/Expression.php index d6f9bb437..efd1eba43 100644 --- a/src/Components/Expression.php +++ b/src/Components/Expression.php @@ -392,7 +392,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = $ret->expr .= $token->token; } - } elseif (! $isExpr) { + } else { if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '.')) { // Found a `.` which means we expect a column name and // the column name we parsed is actually the table name diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php index e3d6603d4..17c067437 100644 --- a/src/Components/OptionsArray.php +++ b/src/Components/OptionsArray.php @@ -281,7 +281,7 @@ public static function build($component): string $options[] = $option; } else { $options[] = $option['name'] - . (! empty($option['equals']) && $option['equals'] ? '=' : ' ') + . (! empty($option['equals']) ? '=' : ' ') . (! empty($option['expr']) ? $option['expr'] : $option['value']); } } diff --git a/src/Statement.php b/src/Statement.php index 42f92b1be..b53a31c40 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -298,7 +298,7 @@ public function parse(Parser $parser, TokensList $list): void /** * The name of the class that is used for parsing. * - * @var Component + * @var Component|null */ $class = null; diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index ffd202f5d..3f1238383 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -440,10 +440,7 @@ public function formatList($list) && empty(self::$inlineClauses[$lastClause]) && ( $curr->type !== Token::TYPE_KEYWORD - || ( - $curr->type === Token::TYPE_KEYWORD - && $curr->flags & Token::FLAG_KEYWORD_FUNCTION - ) + || ($curr->flags & Token::FLAG_KEYWORD_FUNCTION) ) ) { $formattedOptions = true; diff --git a/src/Utils/Query.php b/src/Utils/Query.php index 22ca14adf..6268f0238 100644 --- a/src/Utils/Query.php +++ b/src/Utils/Query.php @@ -528,7 +528,7 @@ public static function getAll($query) // If no tables names were found in the SELECT clause or if there // are expressions like * or COUNT(*), etc. tables names should be // extracted from the FROM clause. - if (empty($ret['select_tables'])) { + if ($ret['select_tables'] === []) { foreach ($statement->from as $expr) { if (! isset($expr->table) || ($expr->table === '')) { continue;