4444
4545abstract class MetadataParser implements PreParserInterface
4646{
47- const ANNOTATION_NAMESPACE = 'Overblog\GraphQLBundle\Annotation \\' ;
48- const METADATA_FORMAT = '%s ' ;
47+ public const ANNOTATION_NAMESPACE = 'Overblog\GraphQLBundle\Annotation \\' ;
48+ public const METADATA_FORMAT = '%s ' ;
4949
5050 private static ClassesTypesMap $ map ;
5151 private static array $ typeGuessers = [];
@@ -233,7 +233,7 @@ private static function classMetadatasToGQLConfiguration(
233233
234234 if (null !== $ gqlType ) {
235235 if (!$ gqlName ) {
236- $ gqlName = isset ($ classMetadata ->name ) ? $ classMetadata ->name : $ reflectionClass ->getShortName ();
236+ $ gqlName = ! empty ($ classMetadata ->name ) ? $ classMetadata ->name : $ reflectionClass ->getShortName ();
237237 }
238238
239239 if ($ preProcess ) {
@@ -346,9 +346,7 @@ private static function graphQLTypeConfigFromAnnotation(ReflectionClass $reflect
346346
347347 $ buildersAnnotations = array_merge (self ::getMetadataMatching ($ metadatas , Metadata \FieldsBuilder::class), $ typeAnnotation ->builders );
348348 if (!empty ($ buildersAnnotations )) {
349- $ typeConfiguration ['builders ' ] = array_map (function ($ fieldsBuilderAnnotation ) {
350- return ['builder ' => $ fieldsBuilderAnnotation ->name , 'builderConfig ' => $ fieldsBuilderAnnotation ->config ];
351- }, $ buildersAnnotations );
349+ $ typeConfiguration ['builders ' ] = array_map (fn ($ fieldsBuilderAnnotation ) => ['builder ' => $ fieldsBuilderAnnotation ->name , 'builderConfig ' => $ fieldsBuilderAnnotation ->config ], $ buildersAnnotations );
352350 }
353351
354352 if (isset ($ typeAnnotation ->isTypeOf )) {
@@ -593,7 +591,7 @@ private static function getTypeFieldConfigurationFromReflector(ReflectionClass $
593591 if (is_string ($ fieldMetadata ->argsBuilder )) {
594592 $ fieldConfiguration ['argsBuilder ' ] = ['builder ' => $ fieldMetadata ->argsBuilder , 'config ' => []];
595593 } elseif (is_array ($ fieldMetadata ->argsBuilder )) {
596- list ( $ builder , $ builderConfig) = $ fieldMetadata ->argsBuilder ;
594+ [ $ builder , $ builderConfig] = $ fieldMetadata ->argsBuilder ;
597595 $ fieldConfiguration ['argsBuilder ' ] = ['builder ' => $ builder , 'config ' => $ builderConfig ];
598596 } else {
599597 throw new InvalidArgumentException (sprintf ('The attribute "argsBuilder" on metadata %s defined on "%s" must be a string or an array where first index is the builder name and the second is the config. ' , static ::formatMetadata ($ fieldMetadataName ), $ reflector ->getName ()));
@@ -608,7 +606,7 @@ private static function getTypeFieldConfigurationFromReflector(ReflectionClass $
608606 $ fieldConfiguration ['builder ' ] = $ fieldMetadata ->fieldBuilder ;
609607 $ fieldConfiguration ['builderConfig ' ] = [];
610608 } elseif (is_array ($ fieldMetadata ->fieldBuilder )) {
611- list ( $ builder , $ builderConfig) = $ fieldMetadata ->fieldBuilder ;
609+ [ $ builder , $ builderConfig] = $ fieldMetadata ->fieldBuilder ;
612610 $ fieldConfiguration ['builder ' ] = $ builder ;
613611 $ fieldConfiguration ['builderConfig ' ] = $ builderConfig ?: [];
614612 } else {
@@ -929,7 +927,7 @@ private static function guessType(ReflectionClass $reflectionClass, Reflector $r
929927 }
930928 }
931929
932- throw new TypeGuessingException (join ("\n" , $ errors ));
930+ throw new TypeGuessingException (implode ("\n" , $ errors ));
933931 }
934932
935933 /**
0 commit comments