Skip to content

Commit 32b8fd4

Browse files
authored
Merge branch 'master' into feature/schema-compiled-event
2 parents 85a8329 + 22d48e9 commit 32b8fd4

32 files changed

+255
-180
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
!/benchmarks/
66
!/composer.json
77
!/phpunit.xml.*
8-
!/phpstan.neon.*
8+
!/phpstan*.neon
99
!/.php_cs.*
1010
!/phpbench.json

.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
;

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FROM scratch AS test_source
77
COPY benchmarks/ benchmarks/
88
COPY src/ /src/
99
COPY tests/ /tests/
10-
COPY phpunit.xml.* phpstan.neon.* .php_cs.* phpbench.json /
10+
COPY phpunit.xml.* phpstan*.neon .php_cs.* phpbench.json /
1111

1212
FROM alpine:3.9
1313

@@ -28,9 +28,13 @@ RUN set -eu; \
2828
php-xml \
2929
php-dom \
3030
php-pdo \
31+
php-curl \
3132
; ln -s /usr/bin/php7 /usr/bin/php
3233

3334
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
35+
# install Symfony Flex globally to speed up download of Composer packages (parallelized prefetching)
36+
RUN set -eux; \
37+
composer global require "symfony/flex" --prefer-dist --no-progress --no-suggest --classmap-authoritative;
3438

3539
WORKDIR /opt/test
3640

docs/annotations/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,27 @@ In the previous example, the generated `resolve` config of the `something` field
116116

117117
## Type & Args auto-guessing
118118

119+
### @Field type auto-guessing when defined on a property with a type hint
120+
121+
The type of the `@Field` annotation can be auto-guessed if it's defined on a property with a type hint.
122+
If the property has a usable type hint this is used and no futher guessing is done.
123+
124+
For example:
125+
126+
```php
127+
/**
128+
* @GQL\Type
129+
*/
130+
class MyType {
131+
/**
132+
* @GQL\Field
133+
*/
134+
protected string $property;
135+
}
136+
```
137+
138+
In this example, the type `String!` will be auto-guessed from the type hint of the property.
139+
119140
### @Field type auto-guessing from Doctrine ORM Annotations
120141

121142
Based on other Doctrine annotations on your fields, the corresponding GraphQL type can sometimes be guessed automatically.

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ final class Access implements Annotation
1515
/**
1616
* Field access.
1717
*
18-
* @required
18+
* @Required
1919
*
2020
* @var string
2121
*/
22-
public $value;
22+
public string $value;
2323
}

src/Annotation/Arg.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ final class Arg implements Annotation
1515
/**
1616
* Argument name.
1717
*
18-
* @required
18+
* @Required
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.
3333
*
34-
* @required
34+
* @Required
3535
*
3636
* @var string
3737
*/
38-
public $type;
38+
public string $type;
3939

4040
/**
4141
* Default argument value.

src/Annotation/Deprecated.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ final class Deprecated implements Annotation
1515
/**
1616
* The deprecation reason.
1717
*
18-
* @required
18+
* @Required
1919
*
2020
* @var string
2121
*/
22-
public $value;
22+
public string $value;
2323
}

src/Annotation/Description.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ final class Description implements Annotation
1515
/**
1616
* The object description.
1717
*
18-
* @required
18+
* @Required
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
}

0 commit comments

Comments
 (0)