Dumplie\Metadata\Exception\InvalidArgumentException::expected PHP Метод

expected() публичный статический Метод

public static expected ( string $expectedType, $receivedValue ) : InvalidArgumentException
$expectedType string
$receivedValue
Результат InvalidArgumentException
    public static function expected(string $expectedType, $receivedValue) : InvalidArgumentException
    {
        return new static(sprintf("Expected \"%s\" type but got \"%s\"", $expectedType, (string) new StringConverter($receivedValue)));
    }

Usage Example

Пример #1
0
 /**
  * @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;
 }
All Usage Examples Of Dumplie\Metadata\Exception\InvalidArgumentException::expected