public static function conversionFailedInvalidType($value, $toType, array $possibleTypes)
{
$actualType = is_object($value) ? get_class($value) : gettype($value);
if (is_scalar($value)) {
return new self(sprintf("Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of the following types: %s", $value, $actualType, $toType, implode(', ', $possibleTypes)));
}
return new self(sprintf("Could not convert PHP value of type '%s' to type '%s'. Expected one of the following types: %s", $actualType, $toType, implode(', ', $possibleTypes)));
}