Skip to content

Commit

Permalink
add return types (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
eithed authored Jul 26, 2021
1 parent db56004 commit a7c2916
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public function __construct(string $class)
/**
* Cast the stored value to the configured DataTransferObject.
*/
public function get($model, $key, $value, $attributes)
public function get($model, $key, $value, $attributes) : mixed
{
if (is_null($value)) {
return;
return null;
}

return $this->serializer->deserialize($value, $this->class, 'json');
Expand All @@ -37,10 +37,10 @@ public function get($model, $key, $value, $attributes)
/**
* Prepare the given value for storage.
*/
public function set($model, $key, $value, $attributes)
public function set($model, $key, $value, $attributes) : ?string
{
if (is_null($value)) {
return;
return null;
}

$isCollection = Str::endsWith($this->class, '[]');
Expand Down

0 comments on commit a7c2916

Please sign in to comment.