/** * @param $serializedValue * * @return float * @throws InvalidArgumentException */ public function deserialize($serializedValue) { if (null === $serializedValue && $this->isNullable()) { return $this->default === null ? null : $this->default; } if (!is_string($serializedValue)) { throw InvalidArgumentException::expected('string', $serializedValue); } return (double) $serializedValue; }
/** * @param string $serializedValue * * @return null|Association * @throws InvalidArgumentException */ public function deserialize($serializedValue) { if (null === $serializedValue && $this->isNullable()) { return null; } if (!is_string($serializedValue)) { throw InvalidArgumentException::expected('string', $serializedValue); } return new Association($this->schema, $this->typeSchema, ['id' => $serializedValue]); }