diff --git a/src/exceptions/SQLException.php b/src/exceptions/SQLException.php index a0e15cf..269efd0 100644 --- a/src/exceptions/SQLException.php +++ b/src/exceptions/SQLException.php @@ -23,7 +23,7 @@ public function __construct( array $params = [], string $message = 'SQL Error', int $code = 0, - Exception $previous = null + Exception|null $previous = null ) { parent::__construct( "{$message}\n" . QueryFormatter::formatQuery($sql, $params), diff --git a/src/framework/Connection.php b/src/framework/Connection.php index a771212..ae43177 100644 --- a/src/framework/Connection.php +++ b/src/framework/Connection.php @@ -72,7 +72,7 @@ public function transact(callable $func): bool; * * @return string|int|null the last auto-generated ID (usually an integer, could be a string for UUIDs, etc.) */ - public function lastInsertId(?string $sequence_name = null): string|int|null; + public function lastInsertId(string|null $sequence_name = null): string|int|null; /** * Add a `Logger` instance, which will be notified when a query is executed. diff --git a/src/framework/pdo/PDOConnection.php b/src/framework/pdo/PDOConnection.php index 1a9c667..6138271 100644 --- a/src/framework/pdo/PDOConnection.php +++ b/src/framework/pdo/PDOConnection.php @@ -217,7 +217,7 @@ private function expandPlaceholders(string $sql, array $params): string /** * @param $sequence_name auto-sequence name (or NULL for e.g. MySQL which supports only one auto-key) */ - public function lastInsertId(?string $sequence_name = null): string|int|null + public function lastInsertId(string|null $sequence_name = null): string|int|null { $id = $this->pdo->lastInsertId($sequence_name); diff --git a/src/framework/pdo/PDOProvider.php b/src/framework/pdo/PDOProvider.php index 609d949..91fb331 100644 --- a/src/framework/pdo/PDOProvider.php +++ b/src/framework/pdo/PDOProvider.php @@ -49,7 +49,7 @@ class PDOProvider * @param string|null $host optional hostname; defaults to "localhost" * @param int|null $port optional port-number; defaults to the standard port-number for the given $db type */ - public function __construct(string $protocol, string $dbname, string $username, string $password, array $options = null, string $host = null, int|null $port = null) + public function __construct(string $protocol, string $dbname, string $username, string $password, array|null $options = null, string|null $host = null, int|null $port = null) { static $default_port = [ self::PROTOCOL_MYSQL => 3306, diff --git a/src/model/Database.php b/src/model/Database.php index 0668a3a..900a921 100644 --- a/src/model/Database.php +++ b/src/model/Database.php @@ -18,7 +18,7 @@ abstract class Database * * @param DatabaseContainerFactory|null $factory custom factory instance (typically omitted) */ - public function __construct(DatabaseContainerFactory $factory = null) + public function __construct(DatabaseContainerFactory|null $factory = null) { if ($factory === null) { $factory = new DatabaseContainerFactory(); diff --git a/src/model/components/Returning.php b/src/model/components/Returning.php index 5af62a4..636d306 100644 --- a/src/model/components/Returning.php +++ b/src/model/components/Returning.php @@ -52,7 +52,7 @@ public function returningColumns($cols): static * * @return $this */ - public function returningValue($expr, $name = null, $type = null): static + public function returningValue(string $expr, string|null $name = null, Type|string|null $type = null): static { $this->return_vars->addValue($expr, $name, $type); diff --git a/src/model/query/SelectQuery.php b/src/model/query/SelectQuery.php index 77bfaee..2824b89 100644 --- a/src/model/query/SelectQuery.php +++ b/src/model/query/SelectQuery.php @@ -119,7 +119,7 @@ public function columns(Column|array $cols) * * @return $this */ - public function value($expr, $name = null, $type = null) + public function value(string $expr, string|null $name = null, Type|string|null $type = null) { $this->return_vars->addValue($expr, $name, $type); diff --git a/test/helpers.php b/test/helpers.php index 6beb60b..c8df055 100644 --- a/test/helpers.php +++ b/test/helpers.php @@ -22,7 +22,7 @@ function normalize_sql($sql) * @param string $expected_sql * @param string|null $why */ -function sql_eq(Statement $query, $expected_sql, $why = null) +function sql_eq(Statement $query, $expected_sql, string|null $why = null) { $actual = normalize_sql($query->getSQL()); $expected = normalize_sql($expected_sql);