Skip to content

Commit

Permalink
[serializer] AsSerializable::get()/AsSerializable::set() signatur…
Browse files Browse the repository at this point in the history
…e fix for Laravel v9.

Part of 8b370e1
  • Loading branch information
LastDragon-ru committed Nov 1, 2023
1 parent 6e9b0e4 commit 18f64bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/serializer/src/Casts/AsSerializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use Illuminate\Container\Container;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
use LastDragon_ru\LaraASP\Serializer\Contracts\Serializer;
use LastDragon_ru\LaraASP\Serializer\Exceptions\FailedToCast;

use function is_string;

// todo(laravel): [update] Update methods signatures after remove v9.x support.

/**
* @template TType of object
*
Expand All @@ -33,7 +34,7 @@ public function __construct(
/**
* @inheritDoc
*/
public function get(Model $model, string $key, mixed $value, array $attributes): ?object {
public function get(mixed $model, string $key, mixed $value, array $attributes): ?object {
if ($value === null || $value instanceof $this->class) {
// no action
} elseif (is_string($value)) {
Expand All @@ -53,7 +54,7 @@ public function get(Model $model, string $key, mixed $value, array $attributes):
/**
* @inheritDoc
*/
public function set(Model $model, string $key, mixed $value, array $attributes): mixed {
public function set(mixed $model, string $key, mixed $value, array $attributes): mixed {
if ($value !== null) {
$value = Container::getInstance()->make(Serializer::class)->serialize(
$value,
Expand Down

0 comments on commit 18f64bb

Please sign in to comment.