Improve array and JSON expression builders (#444) #1652
Annotations
10 warnings
PHP 8.4-ubuntu-latest:
src/SqlParser.php#L24
Escaped Mutant for Mutator "Ternary":
@@ @@
match ($this->sql[$pos]) {
':' => ($word = $this->parseWord()) === '' ? $this->skipChars(':') : $result = ':' . $word,
'"', "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]),
- 'e', 'E' => $this->sql[$this->position] === "'" ? ++$this->position && $this->skipQuotedWithEscape("'") : $this->skipIdentifier(),
+ 'e', 'E' => $this->sql[$this->position] === "'" ? $this->skipIdentifier() : ++$this->position && $this->skipQuotedWithEscape("'"),
'$' => $this->skipQuotedWithDollar(),
'-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null,
'/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null,
|
PHP 8.4-ubuntu-latest:
src/SqlParser.php#L24
Escaped Mutant for Mutator "Identical":
@@ @@
match ($this->sql[$pos]) {
':' => ($word = $this->parseWord()) === '' ? $this->skipChars(':') : $result = ':' . $word,
'"', "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]),
- 'e', 'E' => $this->sql[$this->position] === "'" ? ++$this->position && $this->skipQuotedWithEscape("'") : $this->skipIdentifier(),
+ 'e', 'E' => $this->sql[$this->position] !== "'" ? ++$this->position && $this->skipQuotedWithEscape("'") : $this->skipIdentifier(),
'$' => $this->skipQuotedWithDollar(),
'-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null,
'/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null,
|
PHP 8.4-ubuntu-latest:
src/Data/ArrayParser.php#L43
Escaped Mutant for Mutator "Increment":
@@ @@
private function parseArray(string $value, int &$i = 0): array
{
if ($value[++$i] === '}') {
- ++$i;
+ --$i;
return [];
}
for ($result = [];; ++$i) {
|
PHP 8.4-ubuntu-latest:
src/Connection.php#L35
Escaped Mutant for Mutator "MethodCallRemoval":
@@ @@
$command->setSql($sql);
}
if ($this->logger !== null) {
- $command->setLogger($this->logger);
+
}
if ($this->profiler !== null) {
$command->setProfiler($this->profiler);
|
PHP 8.4-ubuntu-latest:
src/Column/ColumnFactory.php#L165
Escaped Mutant for Mutator "UnwrapSubstr":
@@ @@
/** @var string $value */
$value = preg_replace("/::[^:']+\$/", '$1', $defaultValue);
if (str_starts_with($value, "B'") && $value[-1] === "'") {
- return $column->phpTypecast(substr($value, 2, -1));
+ return $column->phpTypecast($value);
}
$value = parent::normalizeNotNullDefaultValue($value, $column);
if ($value instanceof Expression) {
|
PHP 8.4-ubuntu-latest:
src/Column/ColumnFactory.php#L165
Escaped Mutant for Mutator "DecrementInteger":
@@ @@
/** @var string $value */
$value = preg_replace("/::[^:']+\$/", '$1', $defaultValue);
if (str_starts_with($value, "B'") && $value[-1] === "'") {
- return $column->phpTypecast(substr($value, 2, -1));
+ return $column->phpTypecast(substr($value, 1, -1));
}
$value = parent::normalizeNotNullDefaultValue($value, $column);
if ($value instanceof Expression) {
|
PHP 8.4-ubuntu-latest:
src/Builder/ArrayExpressionBuilder.php#L192
Escaped Mutant for Mutator "FalseValue":
@@ @@
private function dbTypecast(iterable $value, ColumnInterface $column): iterable
{
if (!is_array($value)) {
- $value = iterator_to_array($value, false);
+ $value = iterator_to_array($value, true);
}
return array_map($column->dbTypecast(...), $value);
}
}
|
PHP 8.4-ubuntu-latest:
src/Builder/ArrayExpressionBuilder.php#L49
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
{
$column = $this->getColumn($expression);
$dbType = $this->getColumnDbType($column);
- return $this->buildNestedSubquery($query, $dbType, $column?->getDimension() ?? 1, $params);
+ return $this->buildNestedSubquery($query, $dbType, $column?->getDimension() ?? 2, $params);
}
protected function buildValue(iterable $value, ArrayExpression $expression, array &$params): string
{
|
PHP 8.4-ubuntu-latest:
src/Builder/ArrayExpressionBuilder.php#L49
Escaped Mutant for Mutator "DecrementInteger":
@@ @@
{
$column = $this->getColumn($expression);
$dbType = $this->getColumnDbType($column);
- return $this->buildNestedSubquery($query, $dbType, $column?->getDimension() ?? 1, $params);
+ return $this->buildNestedSubquery($query, $dbType, $column?->getDimension() ?? 0, $params);
}
protected function buildValue(iterable $value, ArrayExpression $expression, array &$params): string
{
|
PHP 8.4-ubuntu-latest:
src/Builder/ArrayExpressionBuilder.php#L39
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
$param = new Param($value, DataType::STRING);
$column = $this->getColumn($expression);
$dbType = $this->getColumnDbType($column);
- $typeHint = $this->getTypeHint($dbType, $column?->getDimension() ?? 1);
+ $typeHint = $this->getTypeHint($dbType, $column?->getDimension() ?? 2);
return $this->queryBuilder->bindParam($param, $params) . $typeHint;
}
protected function buildSubquery(QueryInterface $query, ArrayExpression $expression, array &$params): string
|