final protected function throwIfNotInputType(ReflectionParameter $param, AbstractAnnotation $annotation): void
    {
        $type = $annotation->getTypeInstance();
        $class = new ReflectionClass($annotation);
        $annotationName = $class->getShortName();

        if (!$type) {
            throw new Exception('Could not find type for parameter `$' . $param->name . '` for method ' . $this->getMethodFullName($param->getDeclaringFunction()) . '. Either type hint the parameter, or specify the type with `@API\\' . $annotationName . '` annotation.');
        }

        if ($type instanceof WrappingType) {
            $type = $type->getWrappedType(true);
        }

        if (!($type instanceof InputType)) {
            throw new Exception('Type for parameter `$' . $param->name . '` for method ' . $this->getMethodFullName($param->getDeclaringFunction()) . ' must be an instance of `' . InputType::class . '`, but was `' . get_class($type) . '`. Use `@API\\' . $annotationName . '` annotation to specify a custom InputType.');
        }
    }
final protected function throwIfNotInputType(ReflectionParameter $param, AbstractAnnotation $annotation): void
    {
        $type = $annotation->getTypeInstance();
        $class = new ReflectionClass($annotation);
        $annotationName = $class->getShortName();

        if (!$type) {
            throw new Exception('Could not find type for parameter `$' . $param->name . '` for method ' . $this->getMethodFullName($param->getDeclaringFunction()) . '. Either type hint the parameter, or specify the type with `@API\\' . $annotationName . '` annotation.');
        }

        if ($type instanceof WrappingType) {
            $type = $type->getWrappedType(true);
        }

        if (!($type instanceof InputType)) {
            throw new Exception('Type for parameter `$' . $param->name . '` for method ' . $this->getMethodFullName($param->getDeclaringFunction()) . ' must be an instance of `' . InputType::class . '`, but was `' . get_class($type) . '`. Use `@API\\' . $annotationName . '` annotation to specify a custom InputType.');
        }
    }
final protected function throwIfNotInputType ( ReflectionParameter $ param , AbstractAnnotation $ annotation ) : void { $ type = $ annotation -> getTypeInstance ( ) ; $ class = new ReflectionClass ( $ annotation ) ; $ annotationName = $ class -> getShortName ( ) ; if ( ! $ type ) { throw new Exception ( 'Could not find type for parameter `$' . $ param -> name . '` for method ' . $ this -> getMethodFullName ( $ param -> getDeclaringFunction ( ) ) . '. Either type hint the parameter, or specify the type with `@API\\' . $ annotationName . '` annotation.' ) ; } if ( $ type instanceof WrappingType ) { $ type = $ type -> getWrappedType ( true ) ; } if ( ! ( $ type instanceof InputType ) ) { throw new Exception ( 'Type for parameter `$' . $ param -> name . '` for method ' . $ this -> getMethodFullName ( $ param -> getDeclaringFunction ( ) ) . ' must be an instance of `' . InputType :: class . '`, but was `' . get_class ( $ type ) . '`. Use `@API\\' . $ annotationName . '` annotation to specify a custom InputType.' ) ; } }
Throws exception if argument type is invalid

@param ReflectionParameter $param
@param AbstractAnnotation $annotation

@throws Exception
Throws exception if argument type is invalid