Skip to content

Commit 2af2356

Browse files
committed
Perform code-quality fixes
- Update PHP-CS-Fixer to v2.16.4 - Remove redundant PHPDoc tags - Disable 'single_line_throw' rule - Fix invalid @param tags - Remove unused use statement - Remove redundant @param tag - Remove unmatched error patterns - Add @var tag with type-hints
1 parent 14bfefd commit 2af2356

File tree

73 files changed

+40
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+40
-626
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ return PhpCsFixer\Config::create()
2121
'general_phpdoc_annotation_remove' => ['author', 'category', 'copyright', 'created', 'license', 'package', 'since', 'subpackage', 'version'],
2222
'native_function_invocation' => true,
2323
'fully_qualified_strict_types' => true,
24+
'single_line_throw' => false,
2425
]
2526
)
2627
->setFinder($finder)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"test -f phpbench.phar || wget https://phpbench.github.io/phpbench/phpbench.phar https://phpbench.github.io/phpbench/phpbench.phar.pubkey",
8282
"@php phpbench.phar run -l dots --ansi -vvv --report='generator: \"table\", cols: [\"benchmark\", \"subject\", \"params\", \"best\", \"mean\", \"mode\", \"worst\", \"diff\"], break: [\"benchmark\"], sort: {mean: \"asc\"}'"
8383
],
84-
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.15.3/php-cs-fixer.phar -O php-cs-fixer.phar",
84+
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.4/php-cs-fixer.phar -O php-cs-fixer.phar",
8585
"fix-cs": [
8686
"@install-cs",
8787
"@php php-cs-fixer.phar fix --diff -v --allow-risky=yes --ansi",

phpstan-baseline.neon

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -765,26 +765,6 @@ parameters:
765765
count: 1
766766
path: src/Transformer/ArgumentsTransformer.php
767767

768-
-
769-
message: "#^Parameter \\#2 \\$type of method Overblog\\\\GraphQLBundle\\\\Validator\\\\InputValidator\\:\\:createCollectionNode\\(\\) expects GraphQL\\\\Type\\\\Definition\\\\InputObjectType\\|GraphQL\\\\Type\\\\Definition\\\\ObjectType, GraphQL\\\\Type\\\\Definition\\\\Type\\|null given\\.$#"
770-
count: 1
771-
path: src/Validator/InputValidator.php
772-
773-
-
774-
message: "#^Parameter \\#2 \\$type of method Overblog\\\\GraphQLBundle\\\\Validator\\\\InputValidator\\:\\:createObjectNode\\(\\) expects GraphQL\\\\Type\\\\Definition\\\\InputObjectType\\|GraphQL\\\\Type\\\\Definition\\\\ObjectType, GraphQL\\\\Type\\\\Definition\\\\Type\\|null given\\.$#"
775-
count: 1
776-
path: src/Validator/InputValidator.php
777-
778-
-
779-
message: "#^Array \\(array\\<Symfony\\\\Component\\\\Validator\\\\Mapping\\\\ClassMetadataInterface\\>\\) does not accept Symfony\\\\Component\\\\Validator\\\\Mapping\\\\MetadataInterface\\.$#"
780-
count: 1
781-
path: src/Validator/InputValidator.php
782-
783-
-
784-
message: "#^PHPDoc tag @param has invalid value \\(\\$parent\\)\\: Unexpected token \"\\$parent\", expected TOKEN_IDENTIFIER at offset 113$#"
785-
count: 1
786-
path: src/Validator/InputValidator.php
787-
788768
-
789769
message: "#^Array \\(array\\<Symfony\\\\Component\\\\Validator\\\\Mapping\\\\PropertyMetadata\\>\\) does not accept Overblog\\\\GraphQLBundle\\\\Validator\\\\Mapping\\\\PropertyMetadata\\.$#"
790770
count: 1
@@ -1060,26 +1040,6 @@ parameters:
10601040
count: 1
10611041
path: tests/Functional/Upload/UploadTest.php
10621042

1063-
-
1064-
message: "#^PHPDoc tag @param has invalid value \\(\\$payload\\)\\: Unexpected token \"\\$payload\", expected TOKEN_IDENTIFIER at offset 140$#"
1065-
count: 1
1066-
path: tests/Functional/Validator/StaticValidator.php
1067-
1068-
-
1069-
message: "#^PHPDoc tag @param has invalid value \\(\\$value\\)\\: Unexpected token \"\\$value\", expected TOKEN_IDENTIFIER at offset 44$#"
1070-
count: 1
1071-
path: tests/Functional/Validator/StaticValidator.php
1072-
1073-
-
1074-
message: "#^PHPDoc tag @param has invalid value \\(\\$object\\)\\: Unexpected token \"\\$object\", expected TOKEN_IDENTIFIER at offset 44$#"
1075-
count: 1
1076-
path: tests/Functional/Validator/StaticValidator.php
1077-
1078-
-
1079-
message: "#^PHPDoc tag @param has invalid value \\(\\$payload\\)\\: Unexpected token \"\\$payload\", expected TOKEN_IDENTIFIER at offset 141$#"
1080-
count: 1
1081-
path: tests/Functional/Validator/StaticValidator.php
1082-
10831043
-
10841044
message: "#^Cannot call method getCursor\\(\\) on Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Edge\\|false\\.$#"
10851045
count: 1
@@ -1310,4 +1270,7 @@ parameters:
13101270
count: 1
13111271
path: tests/Upload/Type/GraphQLUploadTypeTest.php
13121272

1313-
1273+
-
1274+
message: "#^Array \\(array<Symfony\\\\Component\\\\Validator\\\\Mapping\\\\ClassMetadataInterface>\\) does not accept Symfony\\\\Component\\\\Validator\\\\Mapping\\\\MetadataInterface\\.$#"
1275+
count: 1
1276+
path: src/Validator/InputValidator.php

src/CacheWarmer/CompileCacheWarmer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class CompileCacheWarmer implements CacheWarmerInterface
1616
/**
1717
* CompileCacheWarmer constructor.
1818
*
19-
* @param TypeGenerator $typeGenerator
20-
* @param bool $compiled
19+
* @param bool $compiled
2120
*/
2221
public function __construct(TypeGenerator $typeGenerator, $compiled = true)
2322
{

src/Command/DebugCommand.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8383
return 0;
8484
}
8585

86-
/**
87-
* @param FluentResolverInterface $resolver
88-
* @param array $tableHeaders
89-
* @param SymfonyStyle $io
90-
*/
9186
private function renderTable(FluentResolverInterface $resolver, array $tableHeaders, SymfonyStyle $io): void
9287
{
9388
$tableRows = [];

src/Config/ObjectTypeDefinition.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public function getDefinition()
4040

4141
/**
4242
* set empty fields.access with fieldsDefaultAccess values if is set?
43-
*
44-
* @param ArrayNodeDefinition $node
4543
*/
4644
private function treatFieldsDefaultAccess(ArrayNodeDefinition $node): void
4745
{
@@ -65,8 +63,6 @@ private function treatFieldsDefaultAccess(ArrayNodeDefinition $node): void
6563

6664
/**
6765
* set empty fields.public with fieldsDefaultPublic values if is set?
68-
*
69-
* @param ArrayNodeDefinition $node
7066
*/
7167
private function treatFieldsDefaultPublic(ArrayNodeDefinition $node): void
7268
{

src/Config/Parser/AnnotationParser.php

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ public static function reset(): void
7676
/**
7777
* Process a file.
7878
*
79-
* @param \SplFileInfo $file
80-
* @param ContainerBuilder $container
81-
* @param array $configs
82-
* @param bool $preProcess
83-
*
84-
* @return array
85-
*
8679
* @throws \ReflectionException
8780
* @throws InvalidArgumentException
8881
*/
@@ -119,16 +112,7 @@ private static function processFile(\SplFileInfo $file, ContainerBuilder $contai
119112
}
120113

121114
/**
122-
* @param \ReflectionClass $reflectionEntity
123-
* @param array $configs
124-
* @param object $classAnnotation
125-
* @param array $classAnnotations
126-
* @param array $properties
127-
* @param array $methods
128-
* @param array $gqlTypes
129-
* @param bool $preProcess
130-
*
131-
* @return array
115+
* @param object $classAnnotation
132116
*/
133117
private static function classAnnotationsToGQLConfiguration(
134118
\ReflectionClass $reflectionEntity,
@@ -367,12 +351,6 @@ private static function graphQLTypeConfigFromAnnotation(GQL\Type $typeAnnotation
367351
/**
368352
* Create a GraphQL Interface type configuration from annotations on properties.
369353
*
370-
* @param GQL\TypeInterface $interfaceAnnotation
371-
* @param array $classAnnotations
372-
* @param array $properties
373-
* @param array $methods
374-
* @param string $namespace
375-
*
376354
* @return array
377355
*/
378356
private static function typeInterfaceAnnotationToGQLConfiguration(GQL\TypeInterface $interfaceAnnotation, array $classAnnotations, array $properties, array $methods, string $namespace)
@@ -392,13 +370,6 @@ private static function typeInterfaceAnnotationToGQLConfiguration(GQL\TypeInterf
392370

393371
/**
394372
* Create a GraphQL Input type configuration from annotations on properties.
395-
*
396-
* @param GQL\Input $inputAnnotation
397-
* @param array $classAnnotations
398-
* @param array $properties
399-
* @param string $namespace
400-
*
401-
* @return array
402373
*/
403374
private static function inputAnnotationToGQLConfiguration(GQL\Input $inputAnnotation, array $classAnnotations, array $properties, string $namespace): array
404375
{
@@ -413,12 +384,6 @@ private static function inputAnnotationToGQLConfiguration(GQL\Input $inputAnnota
413384

414385
/**
415386
* Get a GraphQL scalar configuration from given scalar annotation.
416-
*
417-
* @param string $className
418-
* @param GQL\Scalar $scalarAnnotation
419-
* @param array $classAnnotations
420-
*
421-
* @return array
422387
*/
423388
private static function scalarAnnotationToGQLConfiguration(string $className, GQL\Scalar $scalarAnnotation, array $classAnnotations): array
424389
{
@@ -441,12 +406,6 @@ private static function scalarAnnotationToGQLConfiguration(string $className, GQ
441406

442407
/**
443408
* Get a GraphQL Enum configuration from given enum annotation.
444-
*
445-
* @param GQL\Enum $enumAnnotation
446-
* @param array $classAnnotations
447-
* @param array $constants
448-
*
449-
* @return array
450409
*/
451410
private static function enumAnnotationToGQLConfiguration(GQL\Enum $enumAnnotation, array $classAnnotations, array $constants): array
452411
{
@@ -480,13 +439,6 @@ private static function enumAnnotationToGQLConfiguration(GQL\Enum $enumAnnotatio
480439

481440
/**
482441
* Get a GraphQL Union configuration from given union annotation.
483-
*
484-
* @param string $className
485-
* @param GQL\Union $unionAnnotation
486-
* @param array $classAnnotations
487-
* @param array $methods
488-
*
489-
* @return array
490442
*/
491443
private static function unionAnnotationToGQLConfiguration(string $className, GQL\Union $unionAnnotation, array $classAnnotations, array $methods): array
492444
{
@@ -513,14 +465,6 @@ private static function unionAnnotationToGQLConfiguration(string $className, GQL
513465

514466
/**
515467
* Create GraphQL fields configuration based on annotations.
516-
*
517-
* @param string $namespace
518-
* @param array $propertiesOrMethods
519-
* @param bool $isInput
520-
* @param bool $isMethod
521-
* @param string $currentValue
522-
*
523-
* @return array
524468
*/
525469
private static function getGraphQLFieldsFromAnnotations(string $namespace, array $propertiesOrMethods, bool $isInput = false, bool $isMethod = false, string $currentValue = 'value', string $fieldAnnotationName = 'Field'): array
526470
{
@@ -649,11 +593,6 @@ private static function getGraphQLFieldsFromAnnotations(string $namespace, array
649593
/**
650594
* Return fields config from Provider methods.
651595
*
652-
* @param string $namespace
653-
* @param string $annotationName
654-
* @param string $targetType
655-
* @param bool $isRoot
656-
*
657596
* @return array
658597
*/
659598
private static function getGraphQLFieldsFromProviders(string $namespace, string $annotationName, string $targetType, bool $isRoot = false)
@@ -715,11 +654,6 @@ private static function getGraphQLFieldsFromProviders(string $namespace, string
715654

716655
/**
717656
* Get the config for description & deprecation reason.
718-
*
719-
* @param array $annotations
720-
* @param bool $withDeprecation
721-
*
722-
* @return array
723657
*/
724658
private static function getDescriptionConfiguration(array $annotations, bool $withDeprecation = false): array
725659
{
@@ -744,8 +678,6 @@ private static function getDescriptionConfiguration(array $annotations, bool $wi
744678
*
745679
* @param array $args
746680
* @param \ReflectionMethod $method
747-
*
748-
* @return array
749681
*/
750682
private static function getArgs(array $args = null, \ReflectionMethod $method = null): array
751683
{
@@ -765,10 +697,6 @@ private static function getArgs(array $args = null, \ReflectionMethod $method =
765697

766698
/**
767699
* Format an array of args to a list of arguments in an expression.
768-
*
769-
* @param array $args
770-
*
771-
* @return string
772700
*/
773701
private static function formatArgsForExpression(array $args): string
774702
{
@@ -782,10 +710,6 @@ private static function formatArgsForExpression(array $args): string
782710

783711
/**
784712
* Format a namespace to be used in an expression (double escape).
785-
*
786-
* @param string $namespace
787-
*
788-
* @return string
789713
*/
790714
private static function formatNamespaceForExpression(string $namespace): string
791715
{
@@ -795,7 +719,6 @@ private static function formatNamespaceForExpression(string $namespace): string
795719
/**
796720
* Get the first annotation matching given class.
797721
*
798-
* @param array $annotations
799722
* @param string|array $annotationClass
800723
*
801724
* @return mixed
@@ -820,8 +743,6 @@ private static function getFirstAnnotationMatching(array $annotations, $annotati
820743
/**
821744
* Format an expression (ie. add "@=" if not set).
822745
*
823-
* @param string $expression
824-
*
825746
* @return string
826747
*/
827748
private static function formatExpression(string $expression)
@@ -832,9 +753,6 @@ private static function formatExpression(string $expression)
832753
/**
833754
* Suffix a name if it is not already.
834755
*
835-
* @param string $name
836-
* @param string $suffix
837-
*
838756
* @return string
839757
*/
840758
private static function suffixName(string $name, string $suffix)
@@ -845,11 +763,6 @@ private static function suffixName(string $name, string $suffix)
845763
/**
846764
* Try to guess a field type base on is annotations.
847765
*
848-
* @param string $namespace
849-
* @param array $annotations
850-
*
851-
* @return string
852-
*
853766
* @throws \RuntimeException
854767
*/
855768
private static function guessType(string $namespace, array $annotations): string
@@ -901,11 +814,6 @@ private static function guessType(string $namespace, array $annotations): string
901814
/**
902815
* Resolve a FQN from classname and namespace.
903816
*
904-
* @param string $className
905-
* @param string $namespace
906-
*
907-
* @return string
908-
*
909817
* @internal
910818
*/
911819
public static function fullyQualifiedClassName(string $className, string $namespace): string
@@ -919,10 +827,6 @@ public static function fullyQualifiedClassName(string $className, string $namesp
919827

920828
/**
921829
* Resolve a GraphQLType from a doctrine type.
922-
*
923-
* @param string $doctrineType
924-
*
925-
* @return string|null
926830
*/
927831
private static function resolveTypeFromDoctrineType(string $doctrineType): ?string
928832
{
@@ -1000,10 +904,7 @@ private static function resolveGraphQLTypeFromReflectionType(\ReflectionType $ty
1000904
/**
1001905
* Resolve a GraphQL Type from a class name.
1002906
*
1003-
* @param string $className
1004-
* @param array $wantedTypes
1005-
*
1006-
* @return string|null
907+
* @param array $wantedTypes
1007908
*/
1008909
private static function resolveTypeFromClass(string $className, array $wantedTypes = null): ?string
1009910
{
@@ -1021,8 +922,6 @@ private static function resolveTypeFromClass(string $className, array $wantedTyp
1021922
/**
1022923
* Resolve a PHP class from a GraphQL type.
1023924
*
1024-
* @param string $type
1025-
*
1026925
* @return string|array|null
1027926
*/
1028927
private static function resolveClassFromType(string $type)
@@ -1032,10 +931,6 @@ private static function resolveClassFromType(string $type)
1032931

1033932
/**
1034933
* Convert a PHP Builtin type to a GraphQL type.
1035-
*
1036-
* @param string $phpType
1037-
*
1038-
* @return string|null
1039934
*/
1040935
private static function resolveTypeFromPhpType(string $phpType): ?string
1041936
{

src/Config/Parser/ParserInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,5 @@
88

99
interface ParserInterface
1010
{
11-
/**
12-
* @param \SplFileInfo $file
13-
* @param ContainerBuilder $container
14-
* @param array $configs
15-
*
16-
* @return array
17-
*/
1811
public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array;
1912
}

0 commit comments

Comments
 (0)