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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
- Enh #929: Implement lazy arrays for array, structured and JSON column types (@Tigrov)
- Bug #933: Explicitly mark nullable parameters (@vjik)
- Chg #911, #1113: Change supported PHP versions to `8.1 - 8.5` (@Tigrov, @vjik)
- Enh #911, #940: Minor refactoring (@Tigrov)
- Enh #911, #940, #1116: Minor refactoring (@Tigrov)
- Chg #938, #936, #937: Remove `ext-json`, `ext-ctype`, `ext-mbstring` from `require` section of `composer.json` (@Tigrov)
- Chg #936: Remove `hasLimit()` and `hasOffset()` methods from `AbstractDQLQueryBuilder` class (@Tigrov)
- Chg #937: Remove `baseName()` and `pascalCaseToId()` methods from `DbStringHelper` (@Tigrov)
Expand Down
21 changes: 12 additions & 9 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use function array_key_exists;
use function array_map;
use function array_merge;
use function array_push;
use function array_shift;
use function array_unshift;
use function count;
Expand Down Expand Up @@ -152,16 +153,18 @@ public function addParams(array $params): static

if (empty($this->params)) {
$this->params = $params;
} else {
foreach ($params as $name => $value) {
if (is_int($name)) {
$this->params[] = $value;
} else {
$this->params[$name] = $value;
}
}

return $this;
}

if (is_int(key($params))) {
array_push($this->params, ...$params);

return $this;
}

$this->params = [...$this->params, ...$params];

return $this;
}

Expand Down Expand Up @@ -1026,7 +1029,7 @@ private function normalizeSelect(array|bool|float|int|string|ExpressionInterface

if (is_string($columnDefinition)) {
if (
preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_.]+)$/', $columnDefinition, $matches)
preg_match('/^(.*?)\s+(?i:as\s+)?([\w\-_.]+)$/', $columnDefinition, $matches) === 1
&& !preg_match('/^\d+$/', $matches[2])
&& !str_contains($matches[2], '.')
) {
Expand Down
Loading