Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdef committed Jan 29, 2024
1 parent 0e19464 commit 9801083
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Command/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Debug/CommandInterfaceProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/Query/QueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9801083

Please sign in to comment.