Refactoring of Schema::normalizeDefaultValue()
method
#1036
Annotations
10 warnings
src/AbstractTokenizer.php#L127
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$this->buffer .= $this->substring(1);
$this->advance(1);
}
- $this->addTokenFromBuffer();
+
if ($token->getHasChildren() && $token[-1] instanceof SqlToken && !$token[-1]->getHasChildren()) {
unset($token[-1]);
}
|
src/AbstractTokenizer.php#L406
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
$this->currentToken = $this->tokenStack->top();
break;
default:
- $this->currentToken[] = (new SqlToken())->type(SqlToken::TYPE_OPERATOR)->content(is_string($content) ? $content : $this->substring($length))->startOffset($this->offset)->endOffset($this->offset + $length);
+ $this->currentToken[] = (new SqlToken())->type(SqlToken::TYPE_OPERATOR)->content(is_string($content) ? $this->substring($length) : $content)->startOffset($this->offset)->endOffset($this->offset + $length);
break;
}
return true;
|
src/AbstractTokenizer.php#L428
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
return;
}
$isKeyword = $this->isKeyword($this->buffer, $content);
- $this->currentToken[] = (new SqlToken())->type($isKeyword ? SqlToken::TYPE_KEYWORD : SqlToken::TYPE_TOKEN)->content(is_string($content) ? $content : $this->buffer)->startOffset($this->offset - mb_strlen($this->buffer, 'UTF-8'))->endOffset($this->offset);
+ $this->currentToken[] = (new SqlToken())->type($isKeyword ? SqlToken::TYPE_TOKEN : SqlToken::TYPE_KEYWORD)->content(is_string($content) ? $content : $this->buffer)->startOffset($this->offset - mb_strlen($this->buffer, 'UTF-8'))->endOffset($this->offset);
$this->buffer = '';
}
/**
|
src/AbstractTokenizer.php#L430
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
return;
}
$isKeyword = $this->isKeyword($this->buffer, $content);
- $this->currentToken[] = (new SqlToken())->type($isKeyword ? SqlToken::TYPE_KEYWORD : SqlToken::TYPE_TOKEN)->content(is_string($content) ? $content : $this->buffer)->startOffset($this->offset - mb_strlen($this->buffer, 'UTF-8'))->endOffset($this->offset);
+ $this->currentToken[] = (new SqlToken())->type($isKeyword ? SqlToken::TYPE_KEYWORD : SqlToken::TYPE_TOKEN)->content(is_string($content) ? $content : $this->buffer)->startOffset($this->offset - strlen($this->buffer))->endOffset($this->offset);
$this->buffer = '';
}
/**
|
src/AbstractTokenizer.php#L443
Escaped Mutant for Mutator "LessThanOrEqualTo":
--- Original
+++ New
@@ @@
*/
private function advance(int $length) : void
{
- if ($length <= 0) {
+ if ($length < 0) {
throw new InvalidArgumentException('Length must be greater than 0.');
}
$this->offset += $length;
|
src/AbstractTokenizer.php#L456
Escaped Mutant for Mutator "GreaterThanOrEqualTo":
--- Original
+++ New
@@ @@
*/
private function isEof() : bool
{
- return $this->offset >= $this->length;
+ return $this->offset > $this->length;
}
}
|
src/Column.php#L38
Escaped Mutant for Mutator "MatchArmRemoval":
--- Original
+++ New
@@ @@
public function asString() : string
{
$format = match ($this->getTypeCategory()) {
- self::TYPE_CATEGORY_PK => '{type}{check}{append}',
self::TYPE_CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}',
self::TYPE_CATEGORY_UUID => '{type}{notnull}{unique}{default}{check}{comment}{append}',
self::TYPE_CATEGORY_UUID_PK => '{type}{notnull}{default}{check}{comment}{append}',
|
src/Column.php#L38
Escaped Mutant for Mutator "MatchArmRemoval":
--- Original
+++ New
@@ @@
$format = match ($this->getTypeCategory()) {
self::TYPE_CATEGORY_PK => '{type}{check}{append}',
self::TYPE_CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}',
- self::TYPE_CATEGORY_UUID => '{type}{notnull}{unique}{default}{check}{comment}{append}',
self::TYPE_CATEGORY_UUID_PK => '{type}{notnull}{default}{check}{comment}{append}',
default => '{type}{length}{notnull}{unique}{check}{default}{append}',
};
|
src/Column.php#L38
Escaped Mutant for Mutator "MatchArmRemoval":
--- Original
+++ New
@@ @@
self::TYPE_CATEGORY_PK => '{type}{check}{append}',
self::TYPE_CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}',
self::TYPE_CATEGORY_UUID => '{type}{notnull}{unique}{default}{check}{comment}{append}',
- self::TYPE_CATEGORY_UUID_PK => '{type}{notnull}{default}{check}{comment}{append}',
default => '{type}{length}{notnull}{unique}{check}{default}{append}',
};
return $this->buildCompleteString($format);
}
}
|
src/Command.php#L43
Escaped Mutant for Mutator "NullSafeMethodCall":
--- Original
+++ New
@@ @@
$tablePrimaryKeys = $tableSchema?->getPrimaryKey() ?? [];
$result = [];
foreach ($tablePrimaryKeys as $name) {
- if ($tableSchema?->getColumn($name)?->isAutoIncrement()) {
+ if ($tableSchema?->getColumn($name)->isAutoIncrement()) {
$result[$name] = $this->db->getLastInsertID((string) $tableSchema?->getSequenceName());
continue;
}
|
The logs for this run have expired and are no longer available.
Loading