We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -9,80 +9,3 @@ |
||
9 | 9 | final class QueryMaxDepthTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $userFriendsWithoutViolationQuery = <<<'EOF' |
12 | - query { |
|
13 | - user { |
|
14 | - friends(first:1) { |
|
15 | - edges { |
|
16 | - node { |
|
17 | - name |
|
18 | - } |
|
19 | - } |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - EOF; |
|
24 | - |
|
25 | - private string $userFriendsWithViolationQuery = <<<'EOF' |
|
26 | - query { |
|
27 | - user { |
|
28 | - friends(first: 1) { |
|
29 | - edges { |
|
30 | - node { |
|
31 | - name |
|
32 | - friends { |
|
33 | - edges { |
|
34 | - node { |
|
35 | - name |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - EOF; |
|
45 | - |
|
46 | - public function testMaxDepthReachLimitation(): void |
|
47 | - { |
|
48 | - $expected = [ |
|
49 | - 'errors' => [ |
|
50 | - [ |
|
51 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
52 | - ], |
|
53 | - ], |
|
54 | - ]; |
|
55 | - |
|
56 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
57 | - } |
|
58 | - |
|
59 | - public function testMaxDepthReachLimitationEnv(): void |
|
60 | - { |
|
61 | - $expected = [ |
|
62 | - 'errors' => [ |
|
63 | - [ |
|
64 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
65 | - ], |
|
66 | - ], |
|
67 | - ]; |
|
68 | - |
|
69 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv'); |
|
70 | - } |
|
71 | - |
|
72 | - public function testComplexityUnderLimitation(): void |
|
73 | - { |
|
74 | - $expected = [ |
|
75 | - 'data' => [ |
|
76 | - 'user' => [ |
|
77 | - 'friends' => [ |
|
78 | - 'edges' => [ |
|
79 | - ['node' => ['name' => 'Nick']], |
|
80 | - ], |
|
81 | - ], |
|
82 | - ], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - |
|
86 | - $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
87 | - } |
|
88 | -} |
@@ -9,80 +9,3 @@ |
||
9 | 9 | final class QueryMaxDepthTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $userFriendsWithoutViolationQuery = <<<'EOF' |
12 | - query { |
|
13 | - user { |
|
14 | - friends(first:1) { |
|
15 | - edges { |
|
16 | - node { |
|
17 | - name |
|
18 | - } |
|
19 | - } |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - EOF; |
|
24 | - |
|
25 | - private string $userFriendsWithViolationQuery = <<<'EOF' |
|
26 | - query { |
|
27 | - user { |
|
28 | - friends(first: 1) { |
|
29 | - edges { |
|
30 | - node { |
|
31 | - name |
|
32 | - friends { |
|
33 | - edges { |
|
34 | - node { |
|
35 | - name |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - EOF; |
|
45 | - |
|
46 | - public function testMaxDepthReachLimitation(): void |
|
47 | - { |
|
48 | - $expected = [ |
|
49 | - 'errors' => [ |
|
50 | - [ |
|
51 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
52 | - ], |
|
53 | - ], |
|
54 | - ]; |
|
55 | - |
|
56 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
57 | - } |
|
58 | - |
|
59 | - public function testMaxDepthReachLimitationEnv(): void |
|
60 | - { |
|
61 | - $expected = [ |
|
62 | - 'errors' => [ |
|
63 | - [ |
|
64 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
65 | - ], |
|
66 | - ], |
|
67 | - ]; |
|
68 | - |
|
69 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv'); |
|
70 | - } |
|
71 | - |
|
72 | - public function testComplexityUnderLimitation(): void |
|
73 | - { |
|
74 | - $expected = [ |
|
75 | - 'data' => [ |
|
76 | - 'user' => [ |
|
77 | - 'friends' => [ |
|
78 | - 'edges' => [ |
|
79 | - ['node' => ['name' => 'Nick']], |
|
80 | - ], |
|
81 | - ], |
|
82 | - ], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - |
|
86 | - $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
87 | - } |
|
88 | -} |
@@ -9,80 +9,3 @@ |
||
9 | 9 | final class QueryMaxDepthTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $userFriendsWithoutViolationQuery = <<<'EOF' |
12 | - query { |
|
13 | - user { |
|
14 | - friends(first:1) { |
|
15 | - edges { |
|
16 | - node { |
|
17 | - name |
|
18 | - } |
|
19 | - } |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - EOF; |
|
24 | - |
|
25 | - private string $userFriendsWithViolationQuery = <<<'EOF' |
|
26 | - query { |
|
27 | - user { |
|
28 | - friends(first: 1) { |
|
29 | - edges { |
|
30 | - node { |
|
31 | - name |
|
32 | - friends { |
|
33 | - edges { |
|
34 | - node { |
|
35 | - name |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - EOF; |
|
45 | - |
|
46 | - public function testMaxDepthReachLimitation(): void |
|
47 | - { |
|
48 | - $expected = [ |
|
49 | - 'errors' => [ |
|
50 | - [ |
|
51 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
52 | - ], |
|
53 | - ], |
|
54 | - ]; |
|
55 | - |
|
56 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
57 | - } |
|
58 | - |
|
59 | - public function testMaxDepthReachLimitationEnv(): void |
|
60 | - { |
|
61 | - $expected = [ |
|
62 | - 'errors' => [ |
|
63 | - [ |
|
64 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
65 | - ], |
|
66 | - ], |
|
67 | - ]; |
|
68 | - |
|
69 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv'); |
|
70 | - } |
|
71 | - |
|
72 | - public function testComplexityUnderLimitation(): void |
|
73 | - { |
|
74 | - $expected = [ |
|
75 | - 'data' => [ |
|
76 | - 'user' => [ |
|
77 | - 'friends' => [ |
|
78 | - 'edges' => [ |
|
79 | - ['node' => ['name' => 'Nick']], |
|
80 | - ], |
|
81 | - ], |
|
82 | - ], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - |
|
86 | - $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
87 | - } |
|
88 | -} |
@@ -9,80 +9,3 @@ |
||
9 | 9 | final class QueryMaxDepthTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $userFriendsWithoutViolationQuery = <<<'EOF' |
12 | - query { |
|
13 | - user { |
|
14 | - friends(first:1) { |
|
15 | - edges { |
|
16 | - node { |
|
17 | - name |
|
18 | - } |
|
19 | - } |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - EOF; |
|
24 | - |
|
25 | - private string $userFriendsWithViolationQuery = <<<'EOF' |
|
26 | - query { |
|
27 | - user { |
|
28 | - friends(first: 1) { |
|
29 | - edges { |
|
30 | - node { |
|
31 | - name |
|
32 | - friends { |
|
33 | - edges { |
|
34 | - node { |
|
35 | - name |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - EOF; |
|
45 | - |
|
46 | - public function testMaxDepthReachLimitation(): void |
|
47 | - { |
|
48 | - $expected = [ |
|
49 | - 'errors' => [ |
|
50 | - [ |
|
51 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
52 | - ], |
|
53 | - ], |
|
54 | - ]; |
|
55 | - |
|
56 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
57 | - } |
|
58 | - |
|
59 | - public function testMaxDepthReachLimitationEnv(): void |
|
60 | - { |
|
61 | - $expected = [ |
|
62 | - 'errors' => [ |
|
63 | - [ |
|
64 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
65 | - ], |
|
66 | - ], |
|
67 | - ]; |
|
68 | - |
|
69 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv'); |
|
70 | - } |
|
71 | - |
|
72 | - public function testComplexityUnderLimitation(): void |
|
73 | - { |
|
74 | - $expected = [ |
|
75 | - 'data' => [ |
|
76 | - 'user' => [ |
|
77 | - 'friends' => [ |
|
78 | - 'edges' => [ |
|
79 | - ['node' => ['name' => 'Nick']], |
|
80 | - ], |
|
81 | - ], |
|
82 | - ], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - |
|
86 | - $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
87 | - } |
|
88 | -} |
@@ -9,80 +9,3 @@ |
||
9 | 9 | final class QueryMaxDepthTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $userFriendsWithoutViolationQuery = <<<'EOF' |
12 | - query { |
|
13 | - user { |
|
14 | - friends(first:1) { |
|
15 | - edges { |
|
16 | - node { |
|
17 | - name |
|
18 | - } |
|
19 | - } |
|
20 | - } |
|
21 | - } |
|
22 | - } |
|
23 | - EOF; |
|
24 | - |
|
25 | - private string $userFriendsWithViolationQuery = <<<'EOF' |
|
26 | - query { |
|
27 | - user { |
|
28 | - friends(first: 1) { |
|
29 | - edges { |
|
30 | - node { |
|
31 | - name |
|
32 | - friends { |
|
33 | - edges { |
|
34 | - node { |
|
35 | - name |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - EOF; |
|
45 | - |
|
46 | - public function testMaxDepthReachLimitation(): void |
|
47 | - { |
|
48 | - $expected = [ |
|
49 | - 'errors' => [ |
|
50 | - [ |
|
51 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
52 | - ], |
|
53 | - ], |
|
54 | - ]; |
|
55 | - |
|
56 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
57 | - } |
|
58 | - |
|
59 | - public function testMaxDepthReachLimitationEnv(): void |
|
60 | - { |
|
61 | - $expected = [ |
|
62 | - 'errors' => [ |
|
63 | - [ |
|
64 | - 'message' => 'Max query depth should be 3 but got 6.', |
|
65 | - ], |
|
66 | - ], |
|
67 | - ]; |
|
68 | - |
|
69 | - $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv'); |
|
70 | - } |
|
71 | - |
|
72 | - public function testComplexityUnderLimitation(): void |
|
73 | - { |
|
74 | - $expected = [ |
|
75 | - 'data' => [ |
|
76 | - 'user' => [ |
|
77 | - 'friends' => [ |
|
78 | - 'edges' => [ |
|
79 | - ['node' => ['name' => 'Nick']], |
|
80 | - ], |
|
81 | - ], |
|
82 | - ], |
|
83 | - ], |
|
84 | - ]; |
|
85 | - |
|
86 | - $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth'); |
|
87 | - } |
|
88 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -46,7 +46,7 @@ |
||
46 | 46 | private ?ResolverArgs $__resolverArgs; |
47 | 47 | |
48 | 48 | public function __construct( |
49 | - ObjectType|InputObjectType $type, |
|
49 | + ObjectType | InputObjectType $type, |
|
50 | 50 | string $field = null, |
51 | 51 | ?ValidationNode $parent = null, |
52 | 52 | ?ResolverArgs $resolverArgs = null |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->decorateObjectTypeFields($type, $fieldsResolved, $resolverMap); |
88 | 88 | } |
89 | 89 | |
90 | - private function decorateInterfaceOrUnionType(InterfaceType|UnionType $type, ResolverMapInterface $resolverMap): void |
|
90 | + private function decorateInterfaceOrUnionType(InterfaceType | UnionType $type, ResolverMapInterface $resolverMap): void |
|
91 | 91 | { |
92 | 92 | $this->configTypeMapping($type, ResolverMapInterface::RESOLVE_TYPE, $resolverMap); |
93 | 93 | $covered = $resolverMap->covered($type->name); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $type->config['fields'] = is_callable($fields) ? $decoratedFields : $decoratedFields(); |
189 | 189 | } |
190 | 190 | |
191 | - private function configTypeMapping(ObjectType|InterfaceType|UnionType|CustomScalarType $type, string $fieldName, ResolverMapInterface $resolverMap): void |
|
191 | + private function configTypeMapping(ObjectType | InterfaceType | UnionType | CustomScalarType $type, string $fieldName, ResolverMapInterface $resolverMap): void |
|
192 | 192 | { |
193 | 193 | if ($resolverMap->isResolvable($type->name, $fieldName)) { |
194 | 194 | $type->config[substr($fieldName, 2)] = $resolverMap->resolve($type->name, $fieldName); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @throws ArgumentsValidationException |
64 | 64 | */ |
65 | - public function validate(string|array|null $groups = null, bool $throw = true): ?ConstraintViolationListInterface |
|
65 | + public function validate(string | array | null $groups = null, bool $throw = true): ?ConstraintViolationListInterface |
|
66 | 66 | { |
67 | 67 | $rootNode = new ValidationNode( |
68 | 68 | $this->info->parentType, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return $rootObject; |
207 | 207 | } |
208 | 208 | |
209 | - private static function isListOfType(GeneratedTypeInterface|ListOfType|NonNull $type): bool |
|
209 | + private static function isListOfType(GeneratedTypeInterface | ListOfType | NonNull $type): bool |
|
210 | 210 | { |
211 | 211 | if ($type instanceof ListOfType || ($type instanceof NonNull && $type->getWrappedType() instanceof ListOfType)) { |
212 | 212 | return true; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - private function createCollectionNode(array $values, ObjectType|InputObjectType $type, ValidationNode $parent): array |
|
218 | + private function createCollectionNode(array $values, ObjectType | InputObjectType $type, ValidationNode $parent): array |
|
219 | 219 | { |
220 | 220 | $collection = []; |
221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $collection; |
227 | 227 | } |
228 | 228 | |
229 | - private function createObjectNode(array $value, ObjectType|InputObjectType $type, ValidationNode $parent): ValidationNode |
|
229 | + private function createObjectNode(array $value, ObjectType | InputObjectType $type, ValidationNode $parent): ValidationNode |
|
230 | 230 | { |
231 | 231 | /** @phpstan-ignore-next-line */ |
232 | 232 | $classValidation = static::normalizeConfig($type->config['validation'] ?? []); |
@@ -18,8 +18,8 @@ |
||
18 | 18 | protected function getResolverSolutionsMapping(): array |
19 | 19 | { |
20 | 20 | return [ |
21 | - 'Toto' => ['factory' => fn () => new ObjectType(['name' => 'Toto', 'fields' => []]), 'aliases' => ['foo']], |
|
22 | - 'Tata' => ['factory' => fn () => new ObjectType(['name' => 'Tata', 'fields' => []]), 'aliases' => ['bar']], |
|
21 | + 'Toto' => ['factory' => fn() => new ObjectType(['name' => 'Toto', 'fields' => []]), 'aliases' => ['foo']], |
|
22 | + 'Tata' => ['factory' => fn() => new ObjectType(['name' => 'Tata', 'fields' => []]), 'aliases' => ['bar']], |
|
23 | 23 | ]; |
24 | 24 | } |
25 | 25 |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @dataProvider specialTypeFieldProvider |
34 | 34 | */ |
35 | - public function testSpecialField($fieldName, ObjectType|UnionType|InterfaceType|CustomScalarType $typeWithSpecialField, callable $fieldValueRetriever = null, $strict = true): void |
|
35 | + public function testSpecialField($fieldName, ObjectType | UnionType | InterfaceType | CustomScalarType $typeWithSpecialField, callable $fieldValueRetriever = null, $strict = true): void |
|
36 | 36 | { |
37 | 37 | if (null === $fieldValueRetriever) { |
38 | - $fieldValueRetriever = fn (ObjectType|UnionType|InterfaceType|CustomScalarType $type, $fieldName) => $type->config[$fieldName]; |
|
38 | + $fieldValueRetriever = fn(ObjectType | UnionType | InterfaceType | CustomScalarType $type, $fieldName) => $type->config[$fieldName]; |
|
39 | 39 | } |
40 | 40 | $expected = static function (): void { |
41 | 41 | }; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | ]; |
69 | 69 | }, |
70 | 70 | ]); |
71 | - $barResolver = static fn () => 'bar'; |
|
72 | - $bazResolver = static fn () => 'baz'; |
|
71 | + $barResolver = static fn() => 'bar'; |
|
72 | + $bazResolver = static fn() => 'baz'; |
|
73 | 73 | |
74 | 74 | $this->decorate( |
75 | 75 | [$objectType->name => $objectType], |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | [$objectType->name => $objectType], |
105 | 105 | [ |
106 | 106 | $objectType->name => [ |
107 | - 'bar' => fn ($value, $args) => $args, |
|
107 | + 'bar' => fn($value, $args) => $args, |
|
108 | 108 | ], |
109 | 109 | ] |
110 | 110 | ); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | public function testCustomScalarTypeUnknownField(): void |
195 | 195 | { |
196 | - $customScalarType = new CustomScalarType(['name' => 'Foo', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '']); |
|
196 | + $customScalarType = new CustomScalarType(['name' => 'Foo', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '']); |
|
197 | 197 | $this->assertDecorateException( |
198 | 198 | [$customScalarType->name => $customScalarType], |
199 | 199 | [ |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | public function specialTypeFieldProvider(): array |
247 | 247 | { |
248 | - $objectWithResolveField = new ObjectType(['name' => 'Bar', 'fields' => [], 'resolveField' => fn () => '']); |
|
248 | + $objectWithResolveField = new ObjectType(['name' => 'Bar', 'fields' => [], 'resolveField' => fn() => '']); |
|
249 | 249 | |
250 | 250 | return [ |
251 | 251 | // isTypeOf |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | [ |
255 | 255 | ResolverMapInterface::RESOLVE_FIELD, |
256 | 256 | $objectWithResolveField, |
257 | - fn (ObjectType $type) => $type->resolveFieldFn, |
|
257 | + fn(ObjectType $type) => $type->resolveFieldFn, |
|
258 | 258 | false, |
259 | 259 | ], |
260 | 260 | [ResolverMapInterface::RESOLVE_FIELD, $objectWithResolveField, null, false], |
261 | 261 | // resolveType |
262 | - [ResolverMapInterface::RESOLVE_TYPE, new UnionType(['name' => 'Baz', 'resolveType' => fn () => '', 'types' => []])], |
|
263 | - [ResolverMapInterface::RESOLVE_TYPE, new InterfaceType(['name' => 'Baz', 'fields' => [], 'resolveType' => fn (mixed $objectValue, mixed $context, ResolveInfo $resolveInfo): string => ''])], |
|
262 | + [ResolverMapInterface::RESOLVE_TYPE, new UnionType(['name' => 'Baz', 'resolveType' => fn() => '', 'types' => []])], |
|
263 | + [ResolverMapInterface::RESOLVE_TYPE, new InterfaceType(['name' => 'Baz', 'fields' => [], 'resolveType' => fn(mixed $objectValue, mixed $context, ResolveInfo $resolveInfo): string => ''])], |
|
264 | 264 | // custom scalar |
265 | - [ResolverMapInterface::SERIALIZE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => ''])], |
|
266 | - [ResolverMapInterface::PARSE_VALUE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '', 'parseValue' => fn (mixed $input): mixed => ''])], |
|
267 | - [ResolverMapInterface::PARSE_LITERAL, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '', 'parseLiteral' => fn (Node $a, array|null $b): mixed => ''])], |
|
268 | - [ResolverMapInterface::SCALAR_TYPE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => ''])], |
|
265 | + [ResolverMapInterface::SERIALIZE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => ''])], |
|
266 | + [ResolverMapInterface::PARSE_VALUE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '', 'parseValue' => fn(mixed $input): mixed => ''])], |
|
267 | + [ResolverMapInterface::PARSE_LITERAL, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '', 'parseLiteral' => fn(Node $a, array | null $b): mixed => ''])], |
|
268 | + [ResolverMapInterface::SCALAR_TYPE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => ''])], |
|
269 | 269 | ]; |
270 | 270 | } |
271 | 271 |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | public function testScalarTypeConfig(): void |
23 | 23 | { |
24 | 24 | $this->assertScalarTypeConfig(new YearScalarType()); |
25 | - $this->assertScalarTypeConfig(fn () => new YearScalarType()); |
|
25 | + $this->assertScalarTypeConfig(fn() => new YearScalarType()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function testWithoutScalarTypeConfig(): void |
29 | 29 | { |
30 | - $genericFunc = fn ($value) => $value; |
|
30 | + $genericFunc = fn($value) => $value; |
|
31 | 31 | /** @phpstan-ignore-next-line */ |
32 | 32 | $type = new CustomScalarType([ |
33 | 33 | 'serialize' => $genericFunc, |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | ScalarType::class, |
58 | 58 | $got |
59 | 59 | )); |
60 | - $type = new CustomScalarType(['name' => $name, 'scalarType' => $scalarType, 'serialize' => fn (mixed $input): mixed => '']); |
|
60 | + $type = new CustomScalarType(['name' => $name, 'scalarType' => $scalarType, 'serialize' => fn(mixed $input): mixed => '']); |
|
61 | 61 | $type->assertValid(); |
62 | 62 | } |
63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | yield [false, 'false']; |
67 | 67 | yield [new stdClass(), 'instance of stdClass']; |
68 | 68 | yield [ |
69 | - fn () => false, |
|
69 | + fn() => false, |
|
70 | 70 | 'false', |
71 | 71 | ]; |
72 | 72 | yield [ |
73 | - fn () => new stdClass(), |
|
73 | + fn() => new stdClass(), |
|
74 | 74 | 'instance of stdClass', |
75 | 75 | ]; |
76 | 76 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | { |
85 | 85 | $type = new CustomScalarType([ |
86 | 86 | 'scalarType' => $scalarType, |
87 | - 'serialize' => fn () => 'serialize', |
|
88 | - 'parseValue' => fn () => 'parseValue', |
|
89 | - 'parseLiteral' => fn () => 'parseLiteral', |
|
87 | + 'serialize' => fn() => 'serialize', |
|
88 | + 'parseValue' => fn() => 'parseValue', |
|
89 | + 'parseLiteral' => fn() => 'parseLiteral', |
|
90 | 90 | ]); |
91 | 91 | |
92 | 92 | $this->assertSame('50 AC', $type->serialize(50)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return parent::$type($value); |
78 | 78 | } |
79 | 79 | |
80 | - $scalarType = match (true) { |
|
80 | + $scalarType = match(true) { |
|
81 | 81 | $this->config['scalarType'] instanceof ScalarType => $this->config['scalarType'], |
82 | 82 | is_callable($this->config['scalarType']) => $this->config['scalarType'](), |
83 | 83 | default => $this->config['scalarType'], |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - $scalarType = match (true) { |
|
97 | + $scalarType = match(true) { |
|
98 | 98 | $this->config['scalarType'] instanceof ScalarType => $this->config['scalarType'], |
99 | 99 | is_callable($this->config['scalarType']) => $this->config['scalarType'](), |
100 | 100 | default => $this->config['scalarType'], |