Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'EXPLAIN' => Statements\ExplainStatement::class,
'FLUSH' => '',
'GRANT' => '',
'REVOKE' => '',
'HELP' => '',
'SET PASSWORD' => '',
'STATUS' => '',
Expand Down Expand Up @@ -371,7 +372,7 @@
*/
public function __construct(string|UtfString|TokensList|null $list = null, bool $strict = false)
{
if (Context::$keywords === []) {

Check warning on line 375 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "Identical": @@ @@ */ public function __construct(string|UtfString|TokensList|null $list = null, bool $strict = false) { - if (Context::$keywords === []) { + if (Context::$keywords !== []) { Context::load(); }
Context::load();
}

Expand Down Expand Up @@ -431,7 +432,7 @@

// `DELIMITER` is not an actual statement and it requires
// special handling.
if (($token->type === TokenType::None) && (strtoupper($token->token) === 'DELIMITER')) {

Check warning on line 435 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "UnwrapStrToUpper": @@ @@ // `DELIMITER` is not an actual statement and it requires // special handling. - if (($token->type === TokenType::None) && (strtoupper($token->token) === 'DELIMITER')) { + if (($token->type === TokenType::None) && ($token->token === 'DELIMITER')) { // Skipping to the end of this statement. $list->getNextOfType(TokenType::Delimiter); $prevLastIdx = $list->idx;
// Skipping to the end of this statement.
$list->getNextOfType(TokenType::Delimiter);
$prevLastIdx = $list->idx;
Expand Down Expand Up @@ -460,7 +461,7 @@
}

if (
($token->keyword === 'UNION') ||

Check warning on line 464 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "LogicalOr": @@ @@ ($token->keyword === 'UNION') || ($token->keyword === 'UNION ALL') || ($token->keyword === 'UNION DISTINCT') || - ($token->keyword === 'EXCEPT') || - ($token->keyword === 'INTERSECT') + ($token->keyword === 'EXCEPT') && $token->keyword === 'INTERSECT' ) { $unionType = $token->keyword; continue;

Check warning on line 464 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "LogicalOr": @@ @@ if ( ($token->keyword === 'UNION') || ($token->keyword === 'UNION ALL') || - ($token->keyword === 'UNION DISTINCT') || - ($token->keyword === 'EXCEPT') || + ($token->keyword === 'UNION DISTINCT') && $token->keyword === 'EXCEPT' || ($token->keyword === 'INTERSECT') ) { $unionType = $token->keyword;
($token->keyword === 'UNION ALL') ||
($token->keyword === 'UNION DISTINCT') ||
($token->keyword === 'EXCEPT') ||
Expand Down Expand Up @@ -507,7 +508,7 @@
/**
* The name of the class that is used for parsing.
*/
$class = self::STATEMENT_PARSERS[$statementName ?? $token->keyword];

Check failure on line 511 in src/Parser.php

View workflow job for this annotation

GitHub Actions / analyse-php (8.2)

PossiblyNullArrayOffset

src/Parser.php:511:22: PossiblyNullArrayOffset: Cannot access value on variable PhpMyAdmin\SqlParser\Parser::STATEMENT_PARSERS using possibly null offset null|string (see https://psalm.dev/125)

/**
* Processed statement.
Expand Down Expand Up @@ -561,7 +562,7 @@
$unionType = false;

// Validate clause order
$statement->validateClauseOrder($this, $list);

Check warning on line 565 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "MethodCallRemoval": @@ @@ $unionType = false; - // Validate clause order - $statement->validateClauseOrder($this, $list); + continue; }
continue;
}

Expand All @@ -587,7 +588,7 @@
}

// Validate clause order
$statement->validateClauseOrder($this, $list);

Check warning on line 591 in src/Parser.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "MethodCallRemoval": @@ @@ $lastTransaction = null; } - // Validate clause order - $statement->validateClauseOrder($this, $list); + continue; }
continue;
}

Expand Down
Loading