Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions analyzer-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1788,12 +1788,6 @@ code = "overly-wide-return-type"
message = "Declared return type `null|string` for `processexpressionparametername` has unused branches: `null`."
count = 1

[[issues]]
file = "src/Sql/AbstractSql.php"
code = "possibly-false-argument"
message = 'Argument #1 of method `PhpDb\Adapter\Platform\PlatformInterface::quoteIdentifier` is possibly `false`, but parameter type `string` does not accept it.'
count = 1

[[issues]]
file = "src/Sql/AbstractSql.php"
code = "possibly-invalid-argument"
Expand Down Expand Up @@ -1860,6 +1854,12 @@ code = "possibly-null-argument"
message = 'Argument #4 of method `PhpDb\Sql\AbstractSql::processExpressionParameterName` is possibly `null`, but parameter type `PhpDb\Adapter\Driver\DriverInterface` does not accept it.'
count = 1

[[issues]]
file = "src/Sql/AbstractSql.php"
code = "possibly-undefined-string-array-index"
message = 'Possibly undefined array key `string` accessed on `non-empty-array<string, PhpDb\Sql\Expression|PhpDb\Sql\Select|PhpDb\Sql\TableIdentifier|string>`.'
count = 1

[[issues]]
file = "src/Sql/AbstractSql.php"
code = "redundant-cast"
Expand Down Expand Up @@ -3582,12 +3582,6 @@ code = "possible-method-access-on-null"
message = "Attempting to call a method on `null`."
count = 2

[[issues]]
file = "src/Sql/Select.php"
code = "possibly-false-argument"
message = 'Argument #1 of method `PhpDb\Sql\AbstractSql::resolveTable` is possibly `false`, but parameter type `PhpDb\Sql\Select|PhpDb\Sql\TableIdentifier|null|string` does not accept it.'
count = 1

[[issues]]
file = "src/Sql/Select.php"
code = "possibly-false-iterator"
Expand Down Expand Up @@ -3636,6 +3630,12 @@ code = "possibly-null-argument"
message = 'Argument #1 of method `PhpDb\Sql\AbstractSql::renderTable` is possibly `null`, but parameter type `string` does not accept it.'
count = 1

[[issues]]
file = "src/Sql/Select.php"
code = "possibly-null-array-index"
message = "Possibly using `null` as an array index to access elementof variable $table."
count = 1

[[issues]]
file = "src/Sql/Select.php"
code = "possibly-null-operand"
Expand Down Expand Up @@ -3672,6 +3672,12 @@ code = "possibly-undefined-string-array-index"
message = '''Possibly undefined array key 'type' accessed on `array{'modifier'?: truthy-string, 'select'?: PhpDb\Sql\Select, 'type'?: string}`.'''
count = 1

[[issues]]
file = "src/Sql/Select.php"
code = "possibly-undefined-string-array-index"
message = 'Possibly undefined array key `null|string` accessed on `array<string, PhpDb\Sql\Select|PhpDb\Sql\TableIdentifier|string>`.'
count = 1

[[issues]]
file = "src/Sql/Select.php"
code = "redundant-comparison"
Expand Down
8 changes: 4 additions & 4 deletions src/Sql/AbstractSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
use PhpDb\Sql\Argument\Values;
use PhpDb\Sql\Platform\PlatformDecoratorInterface;

use function array_key_first;
use function count;
use function current;
use function get_object_vars;
use function implode;
use function is_array;
use function is_string;
use function key;
use function rtrim;
use function str_replace;
use function strtoupper;
Expand Down Expand Up @@ -343,8 +342,9 @@ protected function processJoin(
$joinAs = null;
$joinNameValue = $join['name'];
if (is_array($joinNameValue)) {
$joinName = current($joinNameValue);
$joinAs = $platform->quoteIdentifier(key($joinNameValue));
$alias = array_key_first($joinNameValue);
$joinName = $joinNameValue[$alias];
$joinAs = $platform->quoteIdentifier($alias);
} else {
$joinName = $joinNameValue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use PhpDb\Sql\Predicate\PredicateInterface;

use function array_key_exists;
use function array_key_first;
use function count;
use function current;
use function explode;
use function gettype;
use function is_array;
Expand Down Expand Up @@ -650,7 +650,7 @@ protected function processSelect(
}

foreach ($this->getJoins()->getJoins() as $join) {
$joinName = is_array($join['name']) ? key($join['name']) : $join['name'];
$joinName = is_array($join['name']) ? array_key_first($join['name']) : $join['name'];
$joinName = parent::resolveTable($joinName, $platform, $driver, $parameterContainer);

foreach ($join['columns'] as $jKey => $jColumn) {
Expand Down Expand Up @@ -746,8 +746,8 @@ protected function resolveTable(
$alias = null;

if (is_array($table)) {
$alias = key($table);
$table = current($table);
$alias = array_key_first($table);
$table = $table[$alias];
}

$table = parent::resolveTable($table, $platform, $driver, $parameterContainer);
Expand Down
Loading