Skip to content

Commit aa8609a

Browse files
committed
Add type-hints in annotation classes
1 parent e0cfa21 commit aa8609a

23 files changed

+138
-151
lines changed

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
$finder = PhpCsFixer\Finder::create()
4-
->exclude('vendor')
4+
->exclude('Annotation')
55
->name('*.php')
66
->in([__DIR__.'/src', __DIR__.'/tests'])
77
;

phpstan-baseline.neon

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ parameters:
4545
count: 1
4646
path: src/Config/Parser/AnnotationParser.php
4747

48-
-
49-
message: "#^Access to an undefined property object\\:\\:\\$name\\.$#"
50-
count: 1
51-
path: src/Config/Parser/AnnotationParser.php
52-
53-
-
54-
message: "#^Offset 'type' does not exist on array\\|string\\.$#"
55-
count: 2
56-
path: src/Config/Parser/AnnotationParser.php
57-
5848
-
5949
message: "#^Access to an undefined property GraphQL\\\\Language\\\\AST\\\\Node\\:\\:\\$description\\.$#"
6050
count: 1
@@ -175,11 +165,6 @@ parameters:
175165
count: 1
176166
path: src/Relay/Connection/Output/Connection.php
177167

178-
-
179-
message: "#^Cannot call method then\\(\\) on array\\|object\\.$#"
180-
count: 1
181-
path: src/Relay/Connection/Paginator.php
182-
183168
-
184169
message: "#^Possibly invalid array key type \\(array\\|string\\|null\\)\\.$#"
185170
count: 1
@@ -195,11 +180,6 @@ parameters:
195180
count: 1
196181
path: src/Relay/Mutation/PayloadDefinition.php
197182

198-
-
199-
message: "#^Parameter \\#1 \\$schema of static method Overblog\\\\GraphQLBundle\\\\Event\\\\ExecutorArgumentsEvent\\:\\:create\\(\\) expects Overblog\\\\GraphQLBundle\\\\Definition\\\\Type\\\\ExtensibleSchema, GraphQL\\\\Type\\\\Schema given\\.$#"
200-
count: 1
201-
path: src/Request/Executor.php
202-
203183
-
204184
message: "#^Parameter \\#1 \\$function of function call_user_func_array expects callable\\(\\)\\: mixed, array\\(mixed, mixed\\) given\\.$#"
205185
count: 1
@@ -210,11 +190,6 @@ parameters:
210190
count: 1
211191
path: src/Resolver/TypeResolver.php
212192

213-
-
214-
message: "#^If condition is always true\\.$#"
215-
count: 1
216-
path: src/Transformer/ArgumentsTransformer.php
217-
218193
-
219194
message: "#^Array \\(array\\<Symfony\\\\Component\\\\Validator\\\\Mapping\\\\PropertyMetadata\\>\\) does not accept Overblog\\\\GraphQLBundle\\\\Validator\\\\Mapping\\\\PropertyMetadata\\.$#"
220195
count: 1

src/Annotation/Access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ final class Access implements Annotation
1919
*
2020
* @var string
2121
*/
22-
public $value;
22+
public string $value;
2323
}

src/Annotation/Arg.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ final class Arg implements Annotation
1919
*
2020
* @var string
2121
*/
22-
public $name;
22+
public string $name;
2323

2424
/**
2525
* Argument description.
2626
*
2727
* @var string
2828
*/
29-
public $description;
29+
public string $description;
3030

3131
/**
3232
* Argument type.
@@ -35,7 +35,7 @@ final class Arg implements Annotation
3535
*
3636
* @var string
3737
*/
38-
public $type;
38+
public string $type;
3939

4040
/**
4141
* Default argument value.

src/Annotation/Deprecated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ final class Deprecated implements Annotation
1919
*
2020
* @var string
2121
*/
22-
public $value;
22+
public string $value;
2323
}

src/Annotation/Description.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ final class Description implements Annotation
1919
*
2020
* @var string
2121
*/
22-
public $value;
22+
public string $value;
2323
}

src/Annotation/Enum.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ final class Enum implements Annotation
1717
*
1818
* @var string
1919
*/
20-
public $name;
20+
public string $name;
2121

2222
/**
2323
* @var array<\Overblog\GraphQLBundle\Annotation\EnumValue>
2424
*/
25-
public $values;
25+
public array $values;
2626
}

src/Annotation/EnumValue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ final class EnumValue implements Annotation
1515
/**
1616
* @var string
1717
*/
18-
public $name;
18+
public string $name;
1919

2020
/**
2121
* @var string
2222
*/
23-
public $description;
23+
public string $description;
2424

2525
/**
2626
* @var string
2727
*/
28-
public $deprecationReason;
28+
public string $deprecationReason;
2929
}

src/Annotation/Field.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Field implements Annotation
1717
*
1818
* @var string
1919
*/
20-
public $name;
20+
public string $name;
2121

2222
/**
2323
* Field Type.
@@ -26,21 +26,21 @@ class Field implements Annotation
2626
*
2727
* @var string
2828
*/
29-
public $type;
29+
public string $type;
3030

3131
/**
3232
* Field arguments.
3333
*
3434
* @var array<\Overblog\GraphQLBundle\Annotation\Arg>
3535
*/
36-
public $args;
36+
public array $args = [];
3737

3838
/**
3939
* Resolver for this property.
4040
*
4141
* @var string
4242
*/
43-
public $resolve;
43+
public string $resolve;
4444

4545
/**
4646
* Args builder.

src/Annotation/FieldsBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class FieldsBuilder implements Annotation
1919
*
2020
* @var string
2121
*/
22-
public $builder;
22+
public string $builder;
2323

2424
/**
2525
* The builder config.

0 commit comments

Comments
 (0)