protected function decodeArrayOrVariadicConstructorParamValue(
        ReflectionParameter $constructorParam,
        $constructorParamValue,
        EncodingContext $context
    ) {
        if (!is_array($constructorParamValue)) {
            throw new EncodingException('Value must be an array');
        }

        if (count($constructorParamValue) === 0) {
            return [];
        }

        if ($constructorParam->isVariadic() && $constructorParam->hasType()) {
            $type = $constructorParam->getType() . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        if (is_object($constructorParamValue[0])) {
            $type = get_class($constructorParamValue[0]) . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        $type = gettype($constructorParamValue[0]) . '[]';

        return $this->encoders->getEncoderForType($type)
            ->decode($constructorParamValue, $type, $context);
    }
protected function decodeArrayOrVariadicConstructorParamValue(
        ReflectionParameter $constructorParam,
        $constructorParamValue,
        EncodingContext $context
    ) {
        if (!is_array($constructorParamValue)) {
            throw new EncodingException('Value must be an array');
        }

        if (count($constructorParamValue) === 0) {
            return [];
        }

        if ($constructorParam->isVariadic() && $constructorParam->hasType()) {
            $type = $constructorParam->getType() . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        if (is_object($constructorParamValue[0])) {
            $type = get_class($constructorParamValue[0]) . '[]';

            return $this->encoders->getEncoderForType($type)
                ->decode($constructorParamValue, $type, $context);
        }

        $type = gettype($constructorParamValue[0]) . '[]';

        return $this->encoders->getEncoderForType($type)
            ->decode($constructorParamValue, $type, $context);
    }
protected function decodeArrayOrVariadicConstructorParamValue ( ReflectionParameter $ constructorParam , $ constructorParamValue , EncodingContext $ context ) { if ( ! is_array ( $ constructorParamValue ) ) { throw new EncodingException ( 'Value must be an array' ) ; } if ( count ( $ constructorParamValue ) === 0 ) { return [ ] ; } if ( $ constructorParam -> isVariadic ( ) && $ constructorParam -> hasType ( ) ) { $ type = $ constructorParam -> getType ( ) . '[]' ; return $ this -> encoders -> getEncoderForType ( $ type ) -> decode ( $ constructorParamValue , $ type , $ context ) ; } if ( is_object ( $ constructorParamValue [ 0 ] ) ) { $ type = get_class ( $ constructorParamValue [ 0 ] ) . '[]' ; return $ this -> encoders -> getEncoderForType ( $ type ) -> decode ( $ constructorParamValue , $ type , $ context ) ; } $ type = gettype ( $ constructorParamValue [ 0 ] ) . '[]' ; return $ this -> encoders -> getEncoderForType ( $ type ) -> decode ( $ constructorParamValue , $ type , $ context ) ; }
Decodes a variadic constructor parameter value

@param ReflectionParameter $constructorParam The constructor parameter to decode
@param mixed $constructorParamValue The encoded constructor parameter value
@param EncodingContext $context The encoding context
@return mixed The decoded value
@throws EncodingException Thrown if the value was not an array
Decodes a variadic constructor parameter value