diff --git a/src/Command/AbstractCommand.php b/src/Command/AbstractCommand.php index 10ba47fb6..6348a800d 100644 --- a/src/Command/AbstractCommand.php +++ b/src/Command/AbstractCommand.php @@ -442,7 +442,7 @@ public function queryColumn(): array return is_array($results) ? $results : []; } - public function queryOne(): array|null + public function queryOne(): array|object|null { /** @psalm-var mixed $results */ $results = $this->queryInternal(self::QUERY_MODE_ROW); diff --git a/src/Command/CommandInterface.php b/src/Command/CommandInterface.php index 3caad60d2..9042a1d20 100644 --- a/src/Command/CommandInterface.php +++ b/src/Command/CommandInterface.php @@ -626,10 +626,10 @@ public function queryColumn(): array; * @throws Exception * @throws Throwable If execution failed. * - * @return array|null The first row (in terms of an array) of the query result. Null if the query + * @return array|object|null The first row (in terms of an array) of the query result. Null if the query * results in nothing. */ - public function queryOne(): array|null; + public function queryOne(): array|object|null; /** * Execute the SQL statement and returns the value of the first column in the first row of data. diff --git a/src/Debug/CommandInterfaceProxy.php b/src/Debug/CommandInterfaceProxy.php index 2ca7773c7..aa51eefd8 100644 --- a/src/Debug/CommandInterfaceProxy.php +++ b/src/Debug/CommandInterfaceProxy.php @@ -389,7 +389,7 @@ public function queryColumn(): array /** * @psalm-suppress PossiblyUndefinedArrayOffset */ - public function queryOne(): array|null + public function queryOne(): array|object|null { [$callStack] = debug_backtrace(); diff --git a/src/Query/Query.php b/src/Query/Query.php index 8aa9cc517..81e34c5c4 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -528,7 +528,7 @@ public function offset(ExpressionInterface|int|null $offset): static return $this; } - public function one(): array|null + public function one(): array|object|null { return match ($this->emulateExecution) { true => null, diff --git a/src/Query/QueryInterface.php b/src/Query/QueryInterface.php index d6b6d607c..1fe95a8e0 100644 --- a/src/Query/QueryInterface.php +++ b/src/Query/QueryInterface.php @@ -45,7 +45,8 @@ public function addParams(array $params): static; * @throws InvalidConfigException * @throws Throwable * - * @return array[] The query results. If the query results in nothing, it returns an empty array. + * @return array The query results. If the query results in nothing, it returns an empty array. + * @psalm-return array[]|object[] */ public function all(): array;