Refactoring of Schema::normalizeDefaultValue()
method
#1036
This run and associated checks have been archived and are scheduled for deletion.
Learn more about checks retention
Annotations
20 warnings
PHP 8-sqlite-ubuntu-latest:
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]);
}
|
PHP 8-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L389
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
if ($this->currentToken instanceof SqlToken && !$this->currentToken->getHasChildren()) {
break;
}
- $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);
$this->tokenStack->pop();
$this->currentToken = $this->tokenStack->top();
$this->currentToken[] = (new SqlToken())->type(SqlToken::TYPE_STATEMENT);
|
PHP 8-sqlite-ubuntu-latest:
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 = '';
}
/**
|
PHP 8-sqlite-ubuntu-latest:
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 = '';
}
/**
|
PHP 8-sqlite-ubuntu-latest:
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;
|
PHP 8-sqlite-ubuntu-latest:
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;
}
}
|
PHP 8-sqlite-ubuntu-latest:
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}',
|
PHP 8-sqlite-ubuntu-latest:
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}',
};
|
PHP 8-sqlite-ubuntu-latest:
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);
}
}
|
PHP 8-sqlite-ubuntu-latest:
src/Connection.php#L46
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$command->setSql($sql);
}
if ($this->logger !== null) {
- $command->setLogger($this->logger);
+
}
if ($this->profiler !== null) {
$command->setProfiler($this->profiler);
|
PHP 8.1-sqlite-ubuntu-latest:
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]);
}
|
PHP 8.1-sqlite-ubuntu-latest:
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;
|
PHP 8.1-sqlite-ubuntu-latest:
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 = '';
}
/**
|
PHP 8.1-sqlite-ubuntu-latest:
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 = '';
}
/**
|
PHP 8.1-sqlite-ubuntu-latest:
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;
|
PHP 8.1-sqlite-ubuntu-latest:
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;
}
}
|
PHP 8.1-sqlite-ubuntu-latest:
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}',
|
PHP 8.1-sqlite-ubuntu-latest:
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}',
};
|
PHP 8.1-sqlite-ubuntu-latest:
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);
}
}
|
PHP 8.1-sqlite-ubuntu-latest:
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;
}
|