Skip to content

Add type-hints in annotation classes #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('Annotation')
->name('*.php')
->in([__DIR__.'/src', __DIR__.'/tests'])
;
Expand Down
25 changes: 0 additions & 25 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ parameters:
count: 1
path: src/Config/Parser/AnnotationParser.php

-
message: "#^Access to an undefined property object\\:\\:\\$name\\.$#"
count: 1
path: src/Config/Parser/AnnotationParser.php

-
message: "#^Offset 'type' does not exist on array\\|string\\.$#"
count: 2
path: src/Config/Parser/AnnotationParser.php

-
message: "#^Access to an undefined property GraphQL\\\\Language\\\\AST\\\\Node\\:\\:\\$description\\.$#"
count: 1
Expand Down Expand Up @@ -175,11 +165,6 @@ parameters:
count: 1
path: src/Relay/Connection/Output/Connection.php

-
message: "#^Cannot call method then\\(\\) on array\\|object\\.$#"
count: 1
path: src/Relay/Connection/Paginator.php

-
message: "#^Possibly invalid array key type \\(array\\|string\\|null\\)\\.$#"
count: 1
Expand All @@ -195,11 +180,6 @@ parameters:
count: 1
path: src/Relay/Mutation/PayloadDefinition.php

-
message: "#^Parameter \\#1 \\$schema of static method Overblog\\\\GraphQLBundle\\\\Event\\\\ExecutorArgumentsEvent\\:\\:create\\(\\) expects Overblog\\\\GraphQLBundle\\\\Definition\\\\Type\\\\ExtensibleSchema, GraphQL\\\\Type\\\\Schema given\\.$#"
count: 1
path: src/Request/Executor.php

-
message: "#^Parameter \\#1 \\$function of function call_user_func_array expects callable\\(\\)\\: mixed, array\\(mixed, mixed\\) given\\.$#"
count: 1
Expand All @@ -210,11 +190,6 @@ parameters:
count: 1
path: src/Resolver/TypeResolver.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/Transformer/ArgumentsTransformer.php

-
message: "#^Array \\(array\\<Symfony\\\\Component\\\\Validator\\\\Mapping\\\\PropertyMetadata\\>\\) does not accept Overblog\\\\GraphQLBundle\\\\Validator\\\\Mapping\\\\PropertyMetadata\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ final class Access implements Annotation
*
* @var string
*/
public $value;
public string $value;
}
6 changes: 3 additions & 3 deletions src/Annotation/Arg.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ final class Arg implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Argument description.
*
* @var string
*/
public $description;
public string $description;

/**
* Argument type.
Expand All @@ -35,7 +35,7 @@ final class Arg implements Annotation
*
* @var string
*/
public $type;
public string $type;

/**
* Default argument value.
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ final class Deprecated implements Annotation
*
* @var string
*/
public $value;
public string $value;
}
2 changes: 1 addition & 1 deletion src/Annotation/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ final class Description implements Annotation
*
* @var string
*/
public $value;
public string $value;
}
4 changes: 2 additions & 2 deletions src/Annotation/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ final class Enum implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* @var array<\Overblog\GraphQLBundle\Annotation\EnumValue>
*/
public $values;
public array $values;
}
6 changes: 3 additions & 3 deletions src/Annotation/EnumValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ final class EnumValue implements Annotation
/**
* @var string
*/
public $name;
public string $name;

/**
* @var string
*/
public $description;
public string $description;

/**
* @var string
*/
public $deprecationReason;
public string $deprecationReason;
}
8 changes: 4 additions & 4 deletions src/Annotation/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Field implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Field Type.
Expand All @@ -26,21 +26,21 @@ class Field implements Annotation
*
* @var string
*/
public $type;
public string $type;

/**
* Field arguments.
*
* @var array<\Overblog\GraphQLBundle\Annotation\Arg>
*/
public $args;
public array $args = [];

/**
* Resolver for this property.
*
* @var string
*/
public $resolve;
public string $resolve;

/**
* Args builder.
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class FieldsBuilder implements Annotation
*
* @var string
*/
public $builder;
public string $builder;

/**
* The builder config.
Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ final class Input implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Is the type a relay input.
*
* @var bool
*/
public $isRelay = false;
public bool $isRelay = false;
}
2 changes: 1 addition & 1 deletion src/Annotation/IsPublic.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ final class IsPublic implements Annotation
*
* @var string
*/
public $value;
public string $value;
}
2 changes: 1 addition & 1 deletion src/Annotation/Mutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ final class Mutation extends Field
*
* @var array<string>
*/
public $targetType;
public array $targetType;
}
2 changes: 1 addition & 1 deletion src/Annotation/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ final class Provider implements Annotation
*
* @var string
*/
public $prefix;
public string $prefix;
}
2 changes: 1 addition & 1 deletion src/Annotation/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ final class Query extends Field
*
* @var array<string>
*/
public $targetType;
public array $targetType;
}
4 changes: 2 additions & 2 deletions src/Annotation/Relay/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class Connection extends Type
*
* @var string
*/
public $edge;
public string $edge;

/**
* Connection Node type.
*
* @var string
*/
public $node;
public string $node;
}
2 changes: 1 addition & 1 deletion src/Annotation/Relay/Edge.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ final class Edge extends Type
*
* @var string
*/
public $node;
public string $node;
}
9 changes: 3 additions & 6 deletions src/Annotation/Scalar.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
final class Scalar implements Annotation
{
/**
* Scalar name.
*
* @var string
*/
public $name;
public string $name;


/**
* Scalar type.
*
* @var string
*/
public $scalarType;
public string $scalarType;
}
12 changes: 6 additions & 6 deletions src/Annotation/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@ class Type implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Type inherited interfaces.
*
* @var string[]
*/
public $interfaces;
public array $interfaces;

/**
* Is the type a relay payload.
*
* @var bool
*/
public $isRelay = false;
public bool $isRelay = false;

/**
* Expression to a target fields resolver.
*
* @var string
*/
public $resolveField;
public string $resolveField;

/**
* List of fields builder.
*
* @var array<\Overblog\GraphQLBundle\Annotation\FieldsBuilder>
*/
public $builders = [];
public array $builders = [];

/**
* Expression to resolve type for interfaces.
*
* @var string
*/
public $isTypeOf;
public string $isTypeOf;
}
4 changes: 2 additions & 2 deletions src/Annotation/TypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class TypeInterface implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Resolver type for interface.
Expand All @@ -26,5 +26,5 @@ final class TypeInterface implements Annotation
*
* @var string
*/
public $resolveType;
public string $resolveType;
}
6 changes: 3 additions & 3 deletions src/Annotation/Union.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ final class Union implements Annotation
*
* @var string
*/
public $name;
public string $name;

/**
* Union types.
*
* @var array<string>
*/
public $types;
public array $types;

/**
* Resolver type for union.
*
* @var string
*/
public $resolveType;
public string $resolveType;
}
Loading