Skip to content
Merged
29 changes: 12 additions & 17 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ parameters:

-
message: "#^Cannot access offset 'expr' on mixed\\.$#"
count: 4
count: 2
path: src/Components/OptionsArray.php

-
Expand All @@ -237,12 +237,12 @@ parameters:

-
message: "#^Cannot access offset 1 on mixed\\.$#"
count: 6
count: 2
path: src/Components/OptionsArray.php

-
message: "#^Cannot access offset 2 on mixed\\.$#"
count: 2
count: 1
path: src/Components/OptionsArray.php

-
Expand Down Expand Up @@ -370,11 +370,6 @@ parameters:
count: 1
path: src/Context.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/Core.php

-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Exceptions\\\\ParserException\\:\\:\\$token \\(PhpMyAdmin\\\\SqlParser\\\\Token\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Token\\|null\\.$#"
count: 1
Expand All @@ -391,22 +386,22 @@ parameters:
path: src/Lexer.php

-
message: "#^Parameter \\#1 \\$msg \\(string\\) of method PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:error\\(\\) should be compatible with parameter \\$error \\(Exception\\) of method PhpMyAdmin\\\\SqlParser\\\\Core\\:\\:error\\(\\)$#"
message: "#^Parameter \\#1 \\$token of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects string, null given\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Parameter \\#1 \\$token of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects string, null given\\.$#"
message: "#^Parameter \\#3 \\$flags of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects int, int\\|null given\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Parameter \\#3 \\$flags of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects int, int\\|null given\\.$#"
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#"
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\<non\\-empty\\-string, int\\> and array\\{\\} will always evaluate to false\\.$#"
count: 1
path: src/Lexer.php

Expand All @@ -430,11 +425,6 @@ parameters:
count: 4
path: src/Parser.php

-
message: "#^Parameter \\#1 \\$msg \\(string\\) of method PhpMyAdmin\\\\SqlParser\\\\Parser\\:\\:error\\(\\) should be compatible with parameter \\$error \\(Exception\\) of method PhpMyAdmin\\\\SqlParser\\\\Core\\:\\:error\\(\\)$#"
count: 1
path: src/Parser.php

-
message: "#^Parameter \\#2 \\$list of method PhpMyAdmin\\\\SqlParser\\\\Statement\\:\\:validateClauseOrder\\(\\) expects PhpMyAdmin\\\\SqlParser\\\\TokensList, PhpMyAdmin\\\\SqlParser\\\\TokensList\\|null given\\.$#"
count: 3
Expand All @@ -445,6 +435,11 @@ parameters:
count: 1
path: src/Parser.php

-
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\<non\\-empty\\-string, int\\> and array\\{\\} will always evaluate to false\\.$#"
count: 1
path: src/Parser.php

-
message: "#^Call to an undefined static method PhpMyAdmin\\\\SqlParser\\\\Component\\:\\:buildAll\\(\\)\\.$#"
count: 1
Expand Down
136 changes: 3 additions & 133 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<file src="src/Components/AlterOperation.php">
<PossiblyNullPropertyAssignmentValue>
<code>$options</code>
Expand Down Expand Up @@ -93,9 +93,6 @@
<DocblockTypeContradiction>
<code>$prev[0] === null</code>
</DocblockTypeContradiction>
<InvalidArgument>
<code><![CDATA[$options['breakOnParentheses']]]></code>
</InvalidArgument>
<MixedArrayOffset>
<code><![CDATA[Parser::STATEMENT_PARSERS[$token->keyword]]]></code>
<code><![CDATA[self::ALLOWED_KEYWORDS[$token->keyword]]]></code>
Expand All @@ -120,9 +117,6 @@
<code>$prev[1] !== null</code>
<code><![CDATA[empty($ret->function) && ($prev[1] !== null)]]></code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainType>
<code><![CDATA[empty($options['field'])]]></code>
</TypeDoesNotContainType>
</file>
<file src="src/Components/ExpressionArray.php">
<InvalidReturnStatement>
Expand Down Expand Up @@ -456,9 +450,6 @@
<MixedAssignment>
<code>self::$keywords</code>
</MixedAssignment>
<PossiblyUnusedMethod>
<code>getIdentifierQuote</code>
</PossiblyUnusedMethod>
</file>
<file src="src/Contexts/ContextMariaDb100000.php">
<UnusedClass>
Expand Down Expand Up @@ -570,12 +561,6 @@
<code>ContextMySql80100</code>
</UnusedClass>
</file>
<file src="src/Core.php">
<RedundantConditionGivenDocblockType>
<code>Context::$keywords !== []</code>
<code>Context::$keywords !== []</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Exceptions/ParserException.php">
<PossiblyNullPropertyAssignmentValue>
<code>$token</code>
Expand All @@ -595,9 +580,6 @@
<NullArgument>
<code>null</code>
</NullArgument>
<ParamNameMismatch>
<code>$msg</code>
</ParamNameMismatch>
<PossiblyNullArgument>
<code>$flags</code>
<code><![CDATA[$this->str[$this->last + 1]]]></code>
Expand Down Expand Up @@ -664,9 +646,6 @@
<code><![CDATA[self::STATEMENT_PARSERS[$statementName ?? $token->keyword]]]></code>
<code><![CDATA[self::STATEMENT_PARSERS[$token->keyword]]]></code>
</MixedArrayOffset>
<ParamNameMismatch>
<code>$msg</code>
</ParamNameMismatch>
<PossiblyNullArgument>
<code>$list</code>
<code>$list</code>
Expand Down Expand Up @@ -1013,16 +992,13 @@
</PossiblyNullArrayOffset>
</file>
<file src="src/Tools/ContextGenerator.php">
<PossiblyNullArgument>
<PossiblyInvalidArgument>
<code><![CDATA[$options['keywords']]]></code>
</PossiblyNullArgument>
</PossiblyInvalidArgument>
<RedundantCondition>
<code>++$i !== $count</code>
<code>++$i !== $count</code>
</RedundantCondition>
<UnnecessaryVarAnnotation>
<code>string</code>
</UnnecessaryVarAnnotation>
</file>
<file src="src/Tools/CustomJsonSerializer.php">
<MixedAssignment>
Expand Down Expand Up @@ -1220,9 +1196,6 @@
<code>has</code>
<code>has</code>
</PossiblyNullReference>
<RedundantCondition>
<code><![CDATA[$ret['select_tables'] === []]]></code>
</RedundantCondition>
</file>
<file src="src/Utils/Routine.php">
<MixedArgumentTypeCoercion>
Expand Down Expand Up @@ -1265,7 +1238,6 @@
<code>$ret</code>
<code>$ret</code>
<code>$ret</code>
<code>$ret</code>
</PossiblyNullArrayOffset>
<PossiblyNullReference>
<code>has</code>
Expand Down Expand Up @@ -1603,108 +1575,6 @@
<code><![CDATA[$parser->statements[0]]]></code>
<code><![CDATA[$parser->statements[0]]]></code>
</ArgumentTypeCoercion>
<InvalidReturnStatement>
<code><![CDATA[[
[
'CREATE USER test',
[],
],
[
'CREATE TABLE `address` (
`address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`address` varchar(50) NOT NULL,
`address2` varchar(50) DEFAULT NULL,
`district` varchar(20) NOT NULL,
`city_id` smallint(5) unsigned NOT NULL,
`postal_code` varchar(10) DEFAULT NULL,
`phone` varchar(20) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`address_id`),
KEY `idx_fk_city_id` (`city_id`),
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8',
[
'address_id' => [
'type' => 'SMALLINT',
'timestamp_not_null' => false,
],
'address' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
],
'address2' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'default_value' => 'NULL',
],
'district' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
],
'city_id' => [
'type' => 'SMALLINT',
'timestamp_not_null' => false,
],
'postal_code' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'default_value' => 'NULL',
],
'phone' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
],
'last_update' => [
'type' => 'TIMESTAMP',
'timestamp_not_null' => true,
'default_value' => 'CURRENT_TIMESTAMP',
'default_current_timestamp' => true,
'on_update_current_timestamp' => true,
],
],
],
[
'CREATE TABLE table1 (
a INT NOT NULL,
b VARCHAR(32),
c INT AS (a mod 10) VIRTUAL,
d VARCHAR(5) AS (left(b,5)) PERSISTENT
)',
[
'a' => [
'type' => 'INT',
'timestamp_not_null' => false,
],
'b' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
],
'c' => [
'type' => 'INT',
'timestamp_not_null' => false,
'generated' => true,
'expr' => '(a mod 10)',
],
'd' => [
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'generated' => true,
'expr' => '(left(b,5))',
],
],
],
]]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[list<array{string, array<string, array{
* type: string,
* timestamp_not_null: bool,
* default_value?: string,
* default_current_timestamp?: bool,
* on_update_current_timestamp?: bool,
* expr?: string
* }>}>]]></code>
</InvalidReturnType>
<PossiblyUnusedMethod>
<code>getFieldsProvider</code>
<code>getForeignKeysProvider</code>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/GroupKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/
final class GroupKeyword implements Component
{
/** @var mixed */
public $type;
/** @var 'ASC'|'DESC'|null */
public string|null $type = null;

/**
* The expression that is used for grouping.
Expand Down
10 changes: 0 additions & 10 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,16 +705,6 @@ public static function escapeAll(array $strings): array
return $strings;
}

/**
* Returns char used to quote identifiers based on currently set SQL Mode (ie. standard or ANSI_QUOTES)
*
* @return string either " (double quote, ansi_quotes mode) or ` (backtick, standard mode)
*/
public static function getIdentifierQuote(): string
{
return self::hasMode(self::SQL_MODE_ANSI_QUOTES) ? '"' : '`';
}

/**
* Function verifies that given SQL Mode constant is currently set
*
Expand Down
60 changes: 0 additions & 60 deletions src/Core.php

This file was deleted.

Loading