public static function expected(string $expectedType, $receivedValue) : InvalidArgumentException { return new static(sprintf("Expected \"%s\" type but got \"%s\"", $expectedType, (string) new StringConverter($receivedValue))); }
/** * @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; }