Simplify WithStatement::build() #639
Annotations
12 warnings
|
Mutation tests with PHP 8.2
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
|
Mutation tests with PHP 8.2
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/
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L99
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
// parse any options if provided
$this->options = OptionsArrays::parse($parser, $list, static::$statementOptions);
++$list->idx;
- for (; $list->idx < $list->count; ++$list->idx) {
+ for (; $list->idx <= $list->count; ++$list->idx) {
/**
* Token parsed at this moment.
*/
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L111
Escaped Mutant for Mutator "PregMatchRemoveCaret":
--- Original
+++ New
@@ @@
continue;
}
if ($state === 0) {
- if ($token->type !== TokenType::None || !preg_match('/^[a-zA-Z0-9_$]+$/', $token->token)) {
+ if ($token->type !== TokenType::None || !preg_match('/[a-zA-Z0-9_$]+$/', $token->token)) {
$parser->error('The name of the CTE was expected.', $token);
break;
}
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L120
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$this->withers[$wither] = new WithKeyword($wither);
$state = 1;
} elseif ($state === 1) {
- if ($token->type === TokenType::Operator && $token->value === '(') {
+ if ($token->type === TokenType::Operator || $token->value === '(') {
$columns = Array2d::parse($parser, $list);
if ($parser->errors !== []) {
break;
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L128
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
}
$this->withers[$wither]->columns = $columns;
$state = 2;
- } elseif ($token->type === TokenType::Keyword && $token->keyword === 'AS') {
+ } elseif ($token->type === TokenType::Keyword || $token->keyword === 'AS') {
$state = 3;
} else {
$parser->error('Unexpected token.', $token);
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L135
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
break;
}
} elseif ($state === 2) {
- if (!($token->type === TokenType::Keyword && $token->keyword === 'AS')) {
+ if (!($token->type === TokenType::Keyword || $token->keyword === 'AS')) {
$parser->error('AS keyword was expected.', $token);
break;
}
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L225
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$dubplicateToken = $list->getNext();
$keyToken = $list->getNext();
$updateToken = $list->getNext();
- if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
+ if (($dubplicateToken || $dubplicateToken->keyword === 'DUPLICATE') && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
// Index of the last parsed token will be the token before the ON Keyword
$idxOfLastParsedToken = $idxOfOn - 1;
// The length of the expression tokens would be the difference
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L225
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$dubplicateToken = $list->getNext();
$keyToken = $list->getNext();
$updateToken = $list->getNext();
- if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
+ if (($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' || $keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
// Index of the last parsed token will be the token before the ON Keyword
$idxOfLastParsedToken = $idxOfOn - 1;
// The length of the expression tokens would be the difference
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L225
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$dubplicateToken = $list->getNext();
$keyToken = $list->getNext();
$updateToken = $list->getNext();
- if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
+ if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') || $updateToken && $updateToken->keyword === 'UPDATE') {
// Index of the last parsed token will be the token before the ON Keyword
$idxOfLastParsedToken = $idxOfOn - 1;
// The length of the expression tokens would be the difference
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L226
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$dubplicateToken = $list->getNext();
$keyToken = $list->getNext();
$updateToken = $list->getNext();
- if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
+ if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken || $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
// Index of the last parsed token will be the token before the ON Keyword
$idxOfLastParsedToken = $idxOfOn - 1;
// The length of the expression tokens would be the difference
|
|
Mutation tests with PHP 8.2:
src/Statements/WithStatement.php#L227
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$dubplicateToken = $list->getNext();
$keyToken = $list->getNext();
$updateToken = $list->getNext();
- if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken && $updateToken->keyword === 'UPDATE')) {
+ if ($dubplicateToken && $dubplicateToken->keyword === 'DUPLICATE' && ($keyToken && $keyToken->keyword === 'KEY') && ($updateToken || $updateToken->keyword === 'UPDATE')) {
// Index of the last parsed token will be the token before the ON Keyword
$idxOfLastParsedToken = $idxOfOn - 1;
// The length of the expression tokens would be the difference
|