Skip to content

Commit

Permalink
refactor: changed types and annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
aliceComH authored and JoaoFerrazfs committed Oct 7, 2024
1 parent c45e0f2 commit 6fa4095
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/LegacyRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Mongolid;

use Illuminate\Contracts\Container\BindingResolutionException;
use MongoDB\BSON\Document;
use MongoDB\Collection;
use MongoDB\Driver\WriteConcern;
use MongoDB\Exception\BadMethodCallException;
Expand All @@ -17,6 +18,7 @@
use Mongolid\Schema\DynamicSchema;
use Mongolid\Schema\HasSchemaInterface;
use Mongolid\Schema\Schema;
use stdClass;

/**
* This class was created to keep v2 compatibility.
Expand Down Expand Up @@ -257,7 +259,7 @@ public function getCollection(): Collection
/**
* @throws BindingResolutionException
*/
public function bsonSerialize(): object|array
public function bsonSerialize(): array|Document|stdClass
{
return Container::make(ModelMapper::class)
->map(
Expand Down
4 changes: 3 additions & 1 deletion src/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Mongolid\Model;

use Illuminate\Contracts\Container\BindingResolutionException;
use MongoDB\BSON\Document;
use MongoDB\Collection;
use MongoDB\Driver\WriteConcern;
use Mongolid\Connection\Connection;
Expand All @@ -12,6 +13,7 @@
use Mongolid\Model\Exception\NoCollectionNameException;
use Mongolid\Query\Builder;
use Mongolid\Query\ModelMapper;
use stdClass;

/**
* The Mongolid\Model\Model base class will ensure to enable your model to
Expand Down Expand Up @@ -149,7 +151,7 @@ public function setWriteConcern(int $writeConcern): void
/**
* @throws BindingResolutionException
*/
public function bsonSerialize(): object|array
public function bsonSerialize(): array|Document|stdClass
{
return Container::make(ModelMapper::class)
->map(
Expand Down

0 comments on commit 6fa4095

Please sign in to comment.