We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -49,7 +49,7 @@ |
||
49 | 49 | $expectedData = [ |
50 | 50 | 'user' => [ |
51 | 51 | 'friends' => [ |
52 | - 'totalCount' => 4, |
|
52 | + 'totalCount' => 4, |
|
53 | 53 | 'edges' => [ |
54 | 54 | [ |
55 | 55 | 'friendshipTime' => 'Yesterday', |
@@ -13,6 +13,9 @@ |
||
13 | 13 | |
14 | 14 | trait DIContainerMockTrait |
15 | 15 | { |
16 | + /** |
|
17 | + * @return null|\Symfony\Component\DependencyInjection\ContainerInterface |
|
18 | + */ |
|
16 | 19 | private function getDIContainerMock(array $services = [], array $parameters = []) |
17 | 20 | { |
18 | 21 | $container = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', ['get', 'getParameter', 'has']); |
@@ -165,7 +165,7 @@ |
||
165 | 165 | $client->request('POST', '/?batch', [], [], ['CONTENT_TYPE' => 'application/json'], json_encode($data)); |
166 | 166 | $result = $client->getResponse()->getContent(); |
167 | 167 | |
168 | - $expected = [ |
|
168 | + $expected = [ |
|
169 | 169 | 'friends' => ['data' => $this->expectedData], |
170 | 170 | 'friendsTotalCount' => ['data' => ['user' => ['friends' => ['totalCount' => 4]]]], |
171 | 171 | ]; |
@@ -111,12 +111,12 @@ |
||
111 | 111 | $node |
112 | 112 | ->info('Disabled if equal to false.') |
113 | 113 | ->beforeNormalization() |
114 | - ->ifTrue(function ($v) { return false === $v; }) |
|
115 | - ->then(function () use ($disabledValue) { return $disabledValue; }) |
|
114 | + ->ifTrue(function($v) { return false === $v; }) |
|
115 | + ->then(function() use ($disabledValue) { return $disabledValue; }) |
|
116 | 116 | ->end() |
117 | 117 | ->defaultFalse() |
118 | 118 | ->validate() |
119 | - ->ifTrue(function ($v) { return $v < 0; }) |
|
119 | + ->ifTrue(function($v) { return $v < 0; }) |
|
120 | 120 | ->thenInvalid('"overblog_graphql.security.'.$name.'" must be greater or equal to 0.') |
121 | 121 | ->end() |
122 | 122 | ; |
@@ -127,9 +127,9 @@ |
||
127 | 127 | // from config |
128 | 128 | if (!empty($config['definitions']['mappings']['types'])) { |
129 | 129 | $typesMappings = array_filter(array_map( |
130 | - function (array $typeMapping) use ($container) { |
|
130 | + function(array $typeMapping) use ($container) { |
|
131 | 131 | |
132 | - $params = $this->detectConfigFiles($container, $typeMapping['dir'], $typeMapping['type']); |
|
132 | + $params = $this->detectConfigFiles($container, $typeMapping['dir'], $typeMapping['type']); |
|
133 | 133 | |
134 | 134 | return $params; |
135 | 135 | }, |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | private static $hasMutate = false; |
17 | 17 | |
18 | - public static function hasMutate($reset = false) |
|
18 | + public static function hasMutate($reset = false) |
|
19 | 19 | { |
20 | 20 | $hasMutate = self::$hasMutate; |
21 | 21 |
@@ -51,6 +51,9 @@ discard block |
||
51 | 51 | self::$fieldBuilderClassMap[$name] = $fieldBuilderClass; |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $type |
|
56 | + */ |
|
54 | 57 | protected static function checkBuilderClass($builderClass, $type) |
55 | 58 | { |
56 | 59 | $interface = 'Overblog\\GraphQLBundle\\Definition\\Builder\\MappingInterface'; |
@@ -113,6 +116,9 @@ discard block |
||
113 | 116 | } |
114 | 117 | } |
115 | 118 | |
119 | + /** |
|
120 | + * @param string $name |
|
121 | + */ |
|
116 | 122 | protected function outputFieldsSelection($name, $withAccess = false) |
117 | 123 | { |
118 | 124 | $builder = new TreeBuilder(); |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | $prototype |
128 | 128 | // build args if argsBuilder exists |
129 | 129 | ->beforeNormalization() |
130 | - ->ifTrue(function ($field) { |
|
130 | + ->ifTrue(function($field) { |
|
131 | 131 | return isset($field['argsBuilder']); |
132 | 132 | }) |
133 | - ->then(function ($field) { |
|
133 | + ->then(function($field) { |
|
134 | 134 | $argsBuilderName = null; |
135 | 135 | |
136 | 136 | if (is_string($field['argsBuilder'])) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | ->end() |
157 | 157 | // build field if builder exists |
158 | 158 | ->beforeNormalization() |
159 | - ->always(function ($field) { |
|
159 | + ->always(function($field) { |
|
160 | 160 | $fieldBuilderName = null; |
161 | 161 | |
162 | 162 | if (isset($field['builder']) && is_string($field['builder'])) { |
@@ -152,6 +152,10 @@ |
||
152 | 152 | ->end(); |
153 | 153 | } |
154 | 154 | |
155 | + /** |
|
156 | + * @param string $typeToTreat |
|
157 | + * @param string $definitionBuilderClass |
|
158 | + */ |
|
155 | 159 | private function relayNormalizer($typeToTreat, $definitionBuilderClass) |
156 | 160 | { |
157 | 161 | return function ($types) use ($typeToTreat, $definitionBuilderClass) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $rootNode = $treeBuilder->root('overblog_graphql_types'); |
37 | 37 | |
38 | 38 | $configTypeKeys = array_map( |
39 | - function ($type) { |
|
39 | + function($type) { |
|
40 | 40 | return $this->normalizedConfigTypeKey($type); |
41 | 41 | }, |
42 | 42 | static::$types |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ->prototype('array') |
50 | 50 | // config is the unique config entry allowed |
51 | 51 | ->beforeNormalization() |
52 | - ->ifTrue(function ($v) use ($configTypeKeys) { |
|
52 | + ->ifTrue(function($v) use ($configTypeKeys) { |
|
53 | 53 | if (!empty($v) && is_array($v)) { |
54 | 54 | $keys = array_keys($v); |
55 | 55 | foreach ($configTypeKeys as $configTypeKey) { |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | ->thenInvalid( |
65 | 65 | sprintf( |
66 | 66 | 'Don\'t use internal config keys %s, replace it by "config" instead.', |
67 | - implode(', ', $configTypeKeys) |
|
67 | + implode(', ', $configTypeKeys) |
|
68 | 68 | ) |
69 | 69 | ) |
70 | 70 | ->end() |
71 | 71 | // config is renamed _{TYPE}_config |
72 | 72 | ->beforeNormalization() |
73 | - ->ifTrue(function ($v) { |
|
73 | + ->ifTrue(function($v) { |
|
74 | 74 | return isset($v['type']) && is_string($v['type']); |
75 | 75 | }) |
76 | - ->then(function ($v) { |
|
76 | + ->then(function($v) { |
|
77 | 77 | $key = $this->normalizedConfigTypeKey($v['type']); |
78 | 78 | |
79 | 79 | if (empty($v[$key])) { |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | ->end() |
97 | 97 | // _{TYPE}_config is renamed config |
98 | 98 | ->validate() |
99 | - ->ifTrue(function ($v) { |
|
99 | + ->ifTrue(function($v) { |
|
100 | 100 | return isset($v[$this->normalizedConfigTypeKey($v['type'])]); |
101 | 101 | }) |
102 | - ->then(function ($v) { |
|
102 | + ->then(function($v) { |
|
103 | 103 | $key = $this->normalizedConfigTypeKey($v['type']); |
104 | 104 | $v['config'] = $v[$key]; |
105 | 105 | unset($v[$key]); |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | |
116 | 116 | private function addBeforeNormalization(ArrayNodeDefinition $node) |
117 | 117 | { |
118 | - $typeKeyExists = function ($types) { return !empty($types) && is_array($types); }; |
|
118 | + $typeKeyExists = function($types) { return !empty($types) && is_array($types); }; |
|
119 | 119 | |
120 | 120 | $node |
121 | 121 | // set type config.name |
122 | 122 | ->beforeNormalization() |
123 | 123 | ->ifTrue($typeKeyExists) |
124 | - ->then(function ($types) { |
|
124 | + ->then(function($types) { |
|
125 | 125 | foreach ($types as $name => &$type) { |
126 | 126 | $type['config'] = isset($type['config']) && is_array($type['config']) ? $type['config'] : []; |
127 | 127 | $type['config']['name'] = $name; |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | ->end() |
148 | 148 | // normalized relay-mutation-payload |
149 | 149 | ->beforeNormalization() |
150 | - ->ifTrue(function ($types) { return !empty($types) && is_array($types); }) |
|
150 | + ->ifTrue(function($types) { return !empty($types) && is_array($types); }) |
|
151 | 151 | ->then($this->relayNormalizer('relay-mutation-payload', 'Overblog\GraphQLBundle\Relay\Mutation\PayloadDefinition')) |
152 | 152 | ->end(); |
153 | 153 | } |
154 | 154 | |
155 | 155 | private function relayNormalizer($typeToTreat, $definitionBuilderClass) |
156 | 156 | { |
157 | - return function ($types) use ($typeToTreat, $definitionBuilderClass) { |
|
157 | + return function($types) use ($typeToTreat, $definitionBuilderClass) { |
|
158 | 158 | foreach ($types as $name => $type) { |
159 | 159 | if (isset($type['type']) && is_string($type['type']) && $typeToTreat === $type['type']) { |
160 | 160 | $config = isset($type['config']) && is_array($type['config']) ? $type['config'] : []; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $node = $builder->root('name', 'scalar'); |
44 | 44 | $node->isRequired(); |
45 | 45 | $node->validate() |
46 | - ->ifTrue(function ($name) { |
|
46 | + ->ifTrue(function($name) { |
|
47 | 47 | return !preg_match('/^[_a-z][_0-9a-z]*$/i', $name); |
48 | 48 | }) |
49 | 49 | ->thenInvalid('Invalid type name "%s". (see https://facebook.github.io/graphql/#Name)') |