Skip to content

Commit 3988c93

Browse files
committed
fix(db): allow PDOStatement::$options to be nullable
1 parent 8dac1ac commit 3988c93

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/PDO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public static function getAvailableDrivers(): array
251251
* @param array|null $options
252252
* @return static
253253
*/
254-
public static function connect(string $dsn, ?string $username = null, ?string $password = null, ?array $options = null): static
254+
public static function connect(string $dsn, ?string $username = null, ?string $password = null, ?array $options = []): static
255255
{
256256
return new static($dsn, $username, $password, $options);
257257
}

src/PDOPool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function __construct(
9191
private readonly string $dsn,
9292
private readonly ?string $username = null,
9393
private readonly ?string $password = null,
94-
private ?array $options = null
94+
private ?array $options = []
9595
) {
9696
$options = $options ?? [];
9797

@@ -530,7 +530,7 @@ public static function getAvailableDrivers(): array
530530
* @param array|null $options PDO选项, 包含连接池配置
531531
* @return static 连接池实例
532532
*/
533-
public static function connect(string $dsn, ?string $username = null, ?string $password = null, ?array $options = null): static
533+
public static function connect(string $dsn, ?string $username = null, ?string $password = null, ?array $options = []): static
534534
{
535535
return new static($dsn, $username, $password, $options);
536536
}

0 commit comments

Comments
 (0)