Dumplie\Metadata\Schema\Field\DateTimeField::deserialize PHP Method

deserialize() public method

public deserialize ( $serializedValue ) : DateTimeInterface
$serializedValue
return DateTimeInterface
    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 new \DateTimeImmutable($serializedValue);
    }