Refactor Parser and Statement #560
Annotations
1 error and 11 warnings
Mutation tests with PHP 8.1
Process completed with exit code 1.
|
Mutation tests with PHP 8.1:
src/Parser.php#L373
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
*/
public function __construct(string|UtfString|TokensList|null $list = null, bool $strict = false)
{
- if (Context::$keywords === []) {
+ if (Context::$keywords !== []) {
Context::load();
}
if (is_string($list) || $list instanceof UtfString) {
|
Mutation tests with PHP 8.1:
src/Parser.php#L377
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
if (Context::$keywords === []) {
Context::load();
}
- if (is_string($list) || $list instanceof UtfString) {
+ if (is_string($list) || false) {
$lexer = new Lexer($list, $strict);
$this->list = $lexer->list;
} elseif ($list instanceof TokensList) {
|
Mutation tests with PHP 8.1:
src/Parser.php#L380
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
if (is_string($list) || $list instanceof UtfString) {
$lexer = new Lexer($list, $strict);
$this->list = $lexer->list;
- } elseif ($list instanceof TokensList) {
+ } elseif (true) {
$this->list = $list;
}
$this->strict = $strict;
|
Mutation tests with PHP 8.1:
src/Parser.php#L433
Escaped Mutant for Mutator "UnwrapStrToUpper":
--- Original
+++ New
@@ @@
$token = $list->tokens[$list->idx];
// `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;
|
Mutation tests with PHP 8.1:
src/Parser.php#L530
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
$statement->last = $list->idx;
$prevLastIdx = $list->idx;
// Handles unions.
- if (!empty($unionType) && $lastStatement instanceof SelectStatement && $statement instanceof SelectStatement) {
+ if (!empty($unionType) && true && $statement instanceof SelectStatement) {
/*
* This SELECT statement.
*
|
Mutation tests with PHP 8.1:
src/Parser.php#L531
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
$statement->last = $list->idx;
$prevLastIdx = $list->idx;
// Handles unions.
- if (!empty($unionType) && $lastStatement instanceof SelectStatement && $statement instanceof SelectStatement) {
+ if (!empty($unionType) && $lastStatement instanceof SelectStatement && true) {
/*
* This SELECT statement.
*
|
Mutation tests with PHP 8.1:
src/Parser.php#L563
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
// union ends.
$lastStatement->last = $statement->last;
$unionType = false;
- // Validate clause order
- $statement->validateClauseOrder($this, $list);
+
continue;
}
// Handles transactions.
|
Mutation tests with PHP 8.1:
src/Parser.php#L589
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
}
$lastTransaction = null;
}
- // Validate clause order
- $statement->validateClauseOrder($this, $list);
+
continue;
}
// Validate clause order
|
Mutation tests with PHP 8.1:
src/Statement.php#L84
Escaped Mutant for Mutator "LogicalOr":
--- Original
+++ New
@@ @@
*/
public function __construct(Parser|null $parser = null, TokensList|null $list = null)
{
- if ($parser === null || $list === null) {
+ if ($parser === null && $list === null) {
return;
}
$this->parse($parser, $list);
|
Mutation tests with PHP 8.1:
src/Statement.php#L136
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
}
// Checking if the name of the clause should be added.
if ($type & self::ADD_KEYWORD) {
- $query = trim($query) . ' ' . $name;
+ $query = $query . ' ' . $name;
}
// Checking if the result of the builder should be added.
if (!($type & self::ADD_CLAUSE)) {
|
Mutation tests with PHP 8.1
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|