static public 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)
        ));
    }
static public 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)
        ));
    }
static public 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 ) ) ) ; }
Thrown when the PHP value passed to the type converter was not of the
expected type.

@param mixed    $value
@param string   $toType
@param string[] $possibleTypes

@return ODMException
Thrown when the PHP value passed to the type converter was not of the expected type .