Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated passing NULL as param type #31

Merged
merged 1 commit into from Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/DatabaseSelectBuilder.php
Expand Up @@ -4,7 +4,9 @@

use DateTimeImmutable;
use Dazet\TypeUtil\StringUtil;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use GW\Value\ArrayValue;
use GW\Value\Wrap;
Expand Down Expand Up @@ -325,17 +327,17 @@ public function startOffset(): int
return $this->startOffset;
}

private function paramType(mixed $object): int|string|null
private function paramType(mixed $object): int|string
{
if (is_array($object)) {
return Connection::PARAM_STR_ARRAY;
return ArrayParameterType::STRING;
}

if (!is_object($object)) {
return null;
return ParameterType::STRING;
}

return $this->types[get_class($object)] ?? null;
return $this->types[get_class($object)] ?? ParameterType::STRING;
}

private function assertCanJoin(): void
Expand Down