private function completeFieldArguments(Field $field, ReflectionMethod $method, DocBlockReader $docBlock): void
    {
        $argsFromAnnotations = $field->args;
        $args = [];
        foreach ($method->getParameters() as $param) {
            // Either get existing, or create new argument
            $arg = $argsFromAnnotations[$param->getName()] ?? new Argument();
            $args[$param->getName()] = $arg;

            $this->completeArgumentFromTypeHint($arg, $method, $param, $docBlock);
        }

        $extraAnnotations = array_diff(array_keys($argsFromAnnotations), array_keys($args));
        if ($extraAnnotations) {
            throw new Exception('The following arguments were declared via `@API\Argument` annotation but do not match actual parameter names on method ' . $this->getMethodFullName($method) . '. Either rename or remove the annotations: ' . implode(', ', $extraAnnotations));
        }

        $field->args = $args;
    }
private function completeFieldArguments(Field $field, ReflectionMethod $method, DocBlockReader $docBlock): void
    {
        $argsFromAnnotations = $field->args;
        $args = [];
        foreach ($method->getParameters() as $param) {
            // Either get existing, or create new argument
            $arg = $argsFromAnnotations[$param->getName()] ?? new Argument();
            $args[$param->getName()] = $arg;

            $this->completeArgumentFromTypeHint($arg, $method, $param, $docBlock);
        }

        $extraAnnotations = array_diff(array_keys($argsFromAnnotations), array_keys($args));
        if ($extraAnnotations) {
            throw new Exception('The following arguments were declared via `@API\Argument` annotation but do not match actual parameter names on method ' . $this->getMethodFullName($method) . '. Either rename or remove the annotations: ' . implode(', ', $extraAnnotations));
        }

        $field->args = $args;
    }
private function completeFieldArguments ( Field $ field , ReflectionMethod $ method , DocBlockReader $ docBlock ) : void { $ argsFromAnnotations = $ field -> args ; $ args = [ ] ; foreach ( $ method -> getParameters ( ) as $ param ) { // Either get existing, or create new argument $ arg = $ argsFromAnnotations [ $ param -> getName ( ) ] ?? new Argument ( ) ; $ args [ $ param -> getName ( ) ] = $ arg ; $ this -> completeArgumentFromTypeHint ( $ arg , $ method , $ param , $ docBlock ) ; } $ extraAnnotations = array_diff ( array_keys ( $ argsFromAnnotations ) , array_keys ( $ args ) ) ; if ( $ extraAnnotations ) { throw new Exception ( 'The following arguments were declared via `@API\Argument` annotation but do not match actual parameter names on method ' . $ this -> getMethodFullName ( $ method ) . '. Either rename or remove the annotations: ' . implode ( ', ' , $ extraAnnotations ) ) ; } $ field -> args = $ args ; }
Complete arguments configuration from existing type hints

@param Field $field
@param ReflectionMethod $method
@param DocBlockReader $docBlock
Complete arguments configuration from existing type hints