Skip to content

Commit 7a0de89

Browse files
committed
wip
1 parent abeef6f commit 7a0de89

23 files changed

+67
-80
lines changed

packages/database/src/Builder/QueryBuilders/UpdateQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
);
3535
}
3636

37-
public function execute(mixed ...$bindings): Id|null
37+
public function execute(mixed ...$bindings): ?Id
3838
{
3939
return $this->build()->execute(...$bindings);
4040
}

packages/database/src/Config/DatabaseDialect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function tableNotFoundCode(): string
2323

2424
public function isTableNotFoundError(PDOException $exception): bool
2525
{
26-
return match($this) {
26+
return match ($this) {
2727
self::MYSQL => $exception->getCode() === '42S02' && str_contains($exception->getMessage(), 'table'),
2828
self::SQLITE => $exception->getCode() === 'HY000' && str_contains($exception->getMessage(), 'table'),
2929
self::POSTGRESQL => $exception->getCode() === '42P01' && str_contains($exception->getMessage(), 'relation'),

packages/database/src/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface Database
88
{
99
public function execute(Query $query): void;
1010

11-
public function getLastInsertId(): Id|null;
11+
public function getLastInsertId(): ?Id;
1212

1313
public function fetch(Query $query): array;
1414

packages/database/src/DatabaseDialectInitializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ public function initialize(Container $container): DatabaseDialect
1313
{
1414
return $container->get(DatabaseConfig::class)->dialect;
1515
}
16-
}
16+
}

packages/database/src/Exceptions/NoLastInsertIdAvailable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ final class NoLastInsertIdAvailable extends Exception
88
{
99
public function __construct()
1010
{
11-
parent::__construct("No last insert id available.");
11+
parent::__construct('No last insert id available.');
1212
}
13-
}
13+
}

packages/database/src/GenericDatabase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
final class GenericDatabase implements Database
1919
{
20-
private PDOStatement|null $lastStatement = null;
21-
private Query|null $lastQuery = null;
20+
private ?PDOStatement $lastStatement = null;
21+
private ?Query $lastQuery = null;
2222

2323
public function __construct(
2424
private(set) readonly Connection $connection,
@@ -48,7 +48,7 @@ public function execute(Query $query): void
4848
}
4949
}
5050

51-
public function getLastInsertId(): Id|null
51+
public function getLastInsertId(): ?Id
5252
{
5353
$sql = $this->lastQuery->toSql();
5454

packages/database/src/Id.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
public string|int $id;
1515

16-
public static function tryFrom(string|int|self|null $id): self|null
16+
public static function tryFrom(string|int|self|null $id): ?self
1717
{
1818
if ($id === null) {
1919
return null;

packages/database/src/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Tempest\Database;
66

77
use Tempest\Database\Config\DatabaseConfig;
8-
98
use Tempest\Database\Config\DatabaseDialect;
9+
1010
use function Tempest\get;
1111

1212
final class Query
@@ -18,7 +18,7 @@ public function __construct(
1818
public array $executeAfter = [],
1919
) {}
2020

21-
public function execute(mixed ...$bindings): Id|null
21+
public function execute(mixed ...$bindings): ?Id
2222
{
2323
$this->bindings = [...$this->bindings, ...$bindings];
2424

packages/database/src/QueryStatements/CanExecuteStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
trait CanExecuteStatement
1212
{
13-
public function execute(DatabaseDialect $dialect): Id|null
13+
public function execute(DatabaseDialect $dialect): ?Id
1414
{
1515
$sql = $this->compile($dialect);
1616

packages/database/src/QueryStatements/CountStatement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function compile(DatabaseDialect $dialect): string
3434

3535
if ($this->where->isNotEmpty()) {
3636
$query[] = 'WHERE ' . $this->where
37-
->map(fn (WhereStatement $where) => $where->compile($dialect))
38-
->implode(PHP_EOL);
37+
->map(fn (WhereStatement $where) => $where->compile($dialect))
38+
->implode(PHP_EOL);
3939
}
4040

4141
return $query->implode(PHP_EOL);

0 commit comments

Comments
 (0)