Skip to content

Commit

Permalink
Adopt to yiisoft/db (#190)
Browse files Browse the repository at this point in the history
* Adopt to `yiisoft/db`

* fix
  • Loading branch information
vjik committed Jul 16, 2022
1 parent 60d87da commit cd8c72a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions composer.json
Expand Up @@ -36,12 +36,11 @@
"yiisoft/db-mysql": "dev-master",
"yiisoft/db-oracle": "dev-master",
"yiisoft/db-pgsql": "dev-master",
"yiisoft/db-redis": "dev-master",
"yiisoft/db-sqlite": "dev-master",
"yiisoft/di": "^1.0",
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/json": "^1.0",
"yiisoft/log": "^1.0"
"yiisoft/log": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions src/ActiveQuery.php
Expand Up @@ -362,15 +362,15 @@ private function removeDuplicatedModels(array $models): array
* @throws Exception|InvalidArgumentException|InvalidConfigException|NotSupportedException|ReflectionException
* @throws Throwable
*
* @return mixed a single row of query result. Depending on the setting of {@see asArray}, the
* @return array|object|null A single row of query result. Depending on the setting of {@see asArray}, the
* query result may be either an array or an ActiveRecord object. `null` will be returned if the query results in
* nothing.
*/
public function one(): mixed
public function one(): array|object|null
{
$row = parent::one();

if ($row !== false) {
if ($row !== null) {
$models = $this->populate([$row]);

return reset($models) ?: null;
Expand Down
4 changes: 2 additions & 2 deletions src/ActiveQueryInterface.php
Expand Up @@ -29,11 +29,11 @@ public function asArray(?bool $value = true): self;
/**
* Executes query and returns a single row of result.
*
* @return mixed a single row of query result. Depending on the setting of {@see asArray}
* @return mixed A single row of query result. Depending on the setting of {@see asArray}
* the query result may be either an array or an ActiveRecord object. `null` will be returned if the query results
* in nothing.
*/
public function one(): mixed;
public function one(): array|object|null;

/**
* Sets the {@see indexBy} property.
Expand Down

0 comments on commit cd8c72a

Please sign in to comment.