From a7c2916df4fe03b620fa0d57ee07cd62e6d09f90 Mon Sep 17 00:00:00 2001 From: Pawel Trauth Date: Mon, 26 Jul 2021 16:00:51 +0100 Subject: [PATCH] add return types (#3) --- src/Serializer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Serializer.php b/src/Serializer.php index 975490c..bfccd6a 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -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'); @@ -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, '[]');