@@ -556,10 +556,6 @@ private static function getTypeFieldConfigurationFromReflector(ReflectionClass $
556556 /** @var Metadata\Arg[] $argAnnotations */
557557 $ argAnnotations = self ::getMetadataMatching ($ metadatas , Metadata \Arg::class);
558558
559- if ($ reflector instanceof ReflectionMethod) {
560- $ args = self ::guessArgs ($ reflectionClass , $ reflector );
561- }
562-
563559 foreach ($ argAnnotations as $ arg ) {
564560 $ args [$ arg ->name ] = ['type ' => $ arg ->type ];
565561
@@ -572,6 +568,10 @@ private static function getTypeFieldConfigurationFromReflector(ReflectionClass $
572568 }
573569 }
574570
571+ if ($ reflector instanceof ReflectionMethod) {
572+ $ args = self ::guessArgs ($ reflectionClass , $ reflector , $ args );
573+ }
574+
575575 if (!empty ($ args )) {
576576 $ fieldConfiguration ['args ' ] = $ args ;
577577 }
@@ -922,10 +922,16 @@ private static function guessType(ReflectionClass $reflectionClass, Reflector $r
922922 /**
923923 * Transform a method arguments from reflection to a list of GraphQL argument.
924924 */
925- private static function guessArgs (ReflectionClass $ reflectionClass , ReflectionMethod $ method ): array
926- {
927- $ arguments = [];
925+ private static function guessArgs (
926+ ReflectionClass $ reflectionClass ,
927+ ReflectionMethod $ method ,
928+ array $ arguments ,
929+ ): array {
928930 foreach ($ method ->getParameters () as $ index => $ parameter ) {
931+ if (array_key_exists ($ parameter ->getName (), $ arguments )) {
932+ continue ;
933+ }
934+
929935 try {
930936 $ gqlType = self ::guessType ($ reflectionClass , $ parameter , self ::VALID_INPUT_TYPES );
931937 } catch (TypeGuessingException $ exception ) {
0 commit comments