Fix foreign keys #1070
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#L310
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
if ($offset + mb_strlen($string, 'UTF-8') > $this->length) {
return $this->length;
}
- $afterIndexOf = mb_strpos($this->sql, $string, $offset, 'UTF-8');
+ $afterIndexOf = strpos($this->sql, $string, $offset);
if ($afterIndexOf === false) {
$afterIndexOf = $this->length;
} else {
|
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#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-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L408
Escaped Mutant for Mutator "Plus":
--- 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) ? $content : $this->substring($length))->startOffset($this->offset)->endOffset($this->offset - $length);
break;
}
return true;
|
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#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.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#L236
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
return false;
}
if (!is_array(reset($with))) {
- usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
+ usort($with, static fn(string $string1, string $string2) => strlen($string2) - mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L236
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
return false;
}
if (!is_array(reset($with))) {
- usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
+ usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - strlen($string1));
$map = [];
foreach ($with as $string) {
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L236
Escaped Mutant for Mutator "Minus":
--- Original
+++ New
@@ @@
return false;
}
if (!is_array(reset($with))) {
- usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
+ usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') + mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L236
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
return false;
}
if (!is_array(reset($with))) {
- usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
+
$map = [];
foreach ($with as $string) {
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L241
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
- $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
+ $map[strlen($string)][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
}
$with = $map;
}
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L241
Escaped Mutant for Mutator "MBString":
--- Original
+++ New
@@ @@
usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
- $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
+ $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : strtoupper($string)] = true;
}
$with = $map;
}
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L241
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
- $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
+ $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? mb_strtoupper($string, 'UTF-8') : $string] = true;
}
$with = $map;
}
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L241
Escaped Mutant for Mutator "TrueValue":
--- Original
+++ New
@@ @@
usort($with, static fn(string $string1, string $string2) => mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8'));
$map = [];
foreach ($with as $string) {
- $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
+ $map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = false;
}
$with = $map;
}
|
PHP 8.1-sqlite-ubuntu-latest:
src/AbstractTokenizer.php#L275
Escaped Mutant for Mutator "Plus":
--- Original
+++ New
@@ @@
if ($offset === null) {
$offset = $this->offset;
}
- if ($offset + $length > $this->length) {
+ if ($offset - $length > $this->length) {
return '';
}
$cacheKey = $offset . ',' . $length;
|