We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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 | self::$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,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | private function addBeforeNormalization(ArrayNodeDefinition $node) |
117 | 117 | { |
118 | - $typeKeyExists = function ($types) { |
|
118 | + $typeKeyExists = function($types) { |
|
119 | 119 | return !empty($types) && is_array($types); |
120 | 120 | }; |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // set type config.name |
124 | 124 | ->beforeNormalization() |
125 | 125 | ->ifTrue($typeKeyExists) |
126 | - ->then(function ($types) { |
|
126 | + ->then(function($types) { |
|
127 | 127 | foreach ($types as $name => &$type) { |
128 | 128 | $type['config'] = isset($type['config']) && is_array($type['config']) ? $type['config'] : []; |
129 | 129 | $type['config']['name'] = $name; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ->end() |
150 | 150 | // normalized relay-mutation-payload |
151 | 151 | ->beforeNormalization() |
152 | - ->ifTrue(function ($types) { |
|
152 | + ->ifTrue(function($types) { |
|
153 | 153 | return !empty($types) && is_array($types); |
154 | 154 | }) |
155 | 155 | ->then($this->relayNormalizer('relay-mutation-payload', 'Overblog\GraphQLBundle\Relay\Mutation\PayloadDefinition')) |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | private function relayNormalizer($typeToTreat, $definitionBuilderClass) |
160 | 160 | { |
161 | - return function ($types) use ($typeToTreat, $definitionBuilderClass) { |
|
161 | + return function($types) use ($typeToTreat, $definitionBuilderClass) { |
|
162 | 162 | foreach ($types as $name => $type) { |
163 | 163 | if (isset($type['type']) && is_string($type['type']) && $typeToTreat === $type['type']) { |
164 | 164 | $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)') |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function getPrivatePropertyWithoutGetterUsingCallBack() |
42 | 42 | { |
43 | - return function () { |
|
43 | + return function() { |
|
44 | 44 | return $this->privatePropertyWithoutGetter; |
45 | 45 | }; |
46 | 46 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | private function processConfig(array $configs) |
41 | 41 | { |
42 | 42 | return array_map( |
43 | - function ($v) { |
|
43 | + function($v) { |
|
44 | 44 | if (is_array($v)) { |
45 | 45 | return call_user_func([$this, 'processConfig'], $v); |
46 | 46 | } elseif (is_string($v) && 0 === strpos($v, '@=')) { |
@@ -104,8 +104,8 @@ |
||
104 | 104 | // from config |
105 | 105 | if (!empty($config['definitions']['mappings']['types'])) { |
106 | 106 | $typesMappings = array_filter(array_map( |
107 | - function (array $typeMapping) use ($container) { |
|
108 | - $params = $this->detectConfigFiles($container, $typeMapping['dir'], $typeMapping['type']); |
|
107 | + function(array $typeMapping) use ($container) { |
|
108 | + $params = $this->detectConfigFiles($container, $typeMapping['dir'], $typeMapping['type']); |
|
109 | 109 | |
110 | 110 | return $params; |
111 | 111 | }, |
@@ -60,7 +60,7 @@ |
||
60 | 60 | 'fields' => [ |
61 | 61 | 'myField' => [ |
62 | 62 | 'type' => Type::boolean(), |
63 | - 'resolve' => function () { |
|
63 | + 'resolve' => function() { |
|
64 | 64 | return false; |
65 | 65 | }, |
66 | 66 | ], |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | $prototype |
133 | 133 | // build args if argsBuilder exists |
134 | 134 | ->beforeNormalization() |
135 | - ->ifTrue(function ($field) { |
|
135 | + ->ifTrue(function($field) { |
|
136 | 136 | return isset($field['argsBuilder']); |
137 | 137 | }) |
138 | - ->then(function ($field) { |
|
138 | + ->then(function($field) { |
|
139 | 139 | $argsBuilderName = null; |
140 | 140 | |
141 | 141 | 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'])) { |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | ->prototype('array') |
198 | 198 | // Allow arg type short syntax (Arg: Type => Arg: {type: Type}) |
199 | 199 | ->beforeNormalization() |
200 | - ->ifTrue(function ($options) { |
|
200 | + ->ifTrue(function($options) { |
|
201 | 201 | return is_string($options); |
202 | 202 | }) |
203 | - ->then(function ($options) { |
|
203 | + ->then(function($options) { |
|
204 | 204 | return ['type' => $options]; |
205 | 205 | }) |
206 | 206 | ->end() |
@@ -54,6 +54,9 @@ discard block |
||
54 | 54 | self::$fieldBuilderClassMap[$name] = $fieldBuilderClass; |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $type |
|
59 | + */ |
|
57 | 60 | protected static function checkBuilderClass($builderClass, $type) |
58 | 61 | { |
59 | 62 | $interface = 'Overblog\\GraphQLBundle\\Definition\\Builder\\MappingInterface'; |
@@ -116,6 +119,9 @@ discard block |
||
116 | 119 | throw new InvalidConfigurationException(sprintf('%s builder "%s" not found.', ucfirst($type), $name)); |
117 | 120 | } |
118 | 121 | |
122 | + /** |
|
123 | + * @param string $name |
|
124 | + */ |
|
119 | 125 | protected function outputFieldsSelection($name) |
120 | 126 | { |
121 | 127 | $builder = new TreeBuilder(); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $entities = call_user_func($this->fetcher, $offset, $limit); |
60 | 60 | |
61 | - return $this->handleEntities($entities, function ($entities) use ($args, $offset, $total) { |
|
61 | + return $this->handleEntities($entities, function($entities) use ($args, $offset, $total) { |
|
62 | 62 | return ConnectionBuilder::connectionFromArraySlice($entities, $args, [ |
63 | 63 | 'sliceStart' => $offset, |
64 | 64 | 'arrayLength' => $total, |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | if (!is_numeric(ConnectionBuilder::cursorToOffset($args['after'])) || !$args['after']) { |
82 | 82 | $entities = call_user_func($this->fetcher, $offset, $limit + 1); |
83 | 83 | |
84 | - return $this->handleEntities($entities, function ($entities) use ($args) { |
|
84 | + return $this->handleEntities($entities, function($entities) use ($args) { |
|
85 | 85 | return ConnectionBuilder::connectionFromArray($entities, $args); |
86 | 86 | }); |
87 | 87 | } else { |
88 | 88 | $entities = call_user_func($this->fetcher, $offset, $limit + 2); |
89 | 89 | |
90 | - return $this->handleEntities($entities, function ($entities) use ($args, $offset) { |
|
90 | + return $this->handleEntities($entities, function($entities) use ($args, $offset) { |
|
91 | 91 | return ConnectionBuilder::connectionFromArraySlice($entities, $args, [ |
92 | 92 | 'sliceStart' => $offset, |
93 | 93 | 'arrayLength' => $offset + count($entities), |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testForward() |
57 | 57 | { |
58 | - $paginator = new Paginator(function ($offset, $limit) { |
|
58 | + $paginator = new Paginator(function($offset, $limit) { |
|
59 | 59 | $this->assertSame(0, $offset); |
60 | 60 | $this->assertSame(5, $limit); // Includes the extra element to check if next page is available |
61 | 61 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function testForwardAfterInMiddle() |
73 | 73 | { |
74 | - $paginator = new Paginator(function ($offset, $limit) { |
|
74 | + $paginator = new Paginator(function($offset, $limit) { |
|
75 | 75 | $this->assertSame(2, $offset); |
76 | 76 | $this->assertSame(3, $limit); // Includes the extra element to check if next page is available |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function testForwardAfterAtTheEnd() |
89 | 89 | { |
90 | - $paginator = new Paginator(function ($offset, $limit) { |
|
90 | + $paginator = new Paginator(function($offset, $limit) { |
|
91 | 91 | $this->assertSame(2, $offset); |
92 | 92 | $this->assertSame(4, $limit); // Includes the extra element to check if next page is available |
93 | 93 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | public function testForwardAfterLast() |
105 | 105 | { |
106 | - $paginator = new Paginator(function ($offset, $limit) { |
|
106 | + $paginator = new Paginator(function($offset, $limit) { |
|
107 | 107 | $this->assertSame(4, $offset); |
108 | 108 | $this->assertSame(7, $limit); // Includes the extra element to check if next page is available |
109 | 109 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | public function testForwardAfterWithUnvalidCursorAndSlice() |
121 | 121 | { |
122 | - $paginator = new Paginator(function ($offset, $limit) { |
|
122 | + $paginator = new Paginator(function($offset, $limit) { |
|
123 | 123 | $this->assertSame(0, $offset); |
124 | 124 | $this->assertSame(5, $limit); // Includes the extra element to check if next page is available |
125 | 125 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | public function testBackward() |
138 | 138 | { |
139 | - $paginator = new Paginator(function ($offset, $limit) { |
|
139 | + $paginator = new Paginator(function($offset, $limit) { |
|
140 | 140 | $this->assertSame(2, $offset); |
141 | 141 | $this->assertSame(3, $limit); |
142 | 142 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | public function testBackwardWithLimitEqualsToTotal() |
155 | 155 | { |
156 | - $paginator = new Paginator(function ($offset, $limit) { |
|
156 | + $paginator = new Paginator(function($offset, $limit) { |
|
157 | 157 | $this->assertSame(0, $offset); |
158 | 158 | $this->assertSame(5, $limit); |
159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function testBackwardBeforeLast() |
172 | 172 | { |
173 | - $paginator = new Paginator(function ($offset, $limit) { |
|
173 | + $paginator = new Paginator(function($offset, $limit) { |
|
174 | 174 | $this->assertSame(4, $limit); |
175 | 175 | |
176 | 176 | return $this->getData($offset); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | public function testBackwardPartialBeforeInMiddle() |
187 | 187 | { |
188 | - $paginator = new Paginator(function ($offset, $limit) { |
|
188 | + $paginator = new Paginator(function($offset, $limit) { |
|
189 | 189 | $this->assertSame(1, $offset); |
190 | 190 | $this->assertSame(2, $limit); |
191 | 191 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | public function testAutoBackward() |
203 | 203 | { |
204 | - $paginator = new Paginator(function ($offset, $limit) { |
|
204 | + $paginator = new Paginator(function($offset, $limit) { |
|
205 | 205 | $this->assertSame(1, $offset); |
206 | 206 | $this->assertSame(4, $limit); |
207 | 207 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | public function testAutoForward() |
220 | 220 | { |
221 | - $paginator = new Paginator(function ($offset, $limit) { |
|
221 | + $paginator = new Paginator(function($offset, $limit) { |
|
222 | 222 | $this->assertSame(0, $offset); |
223 | 223 | $this->assertSame(5, $limit); // Includes the extra element to check if next page is available |
224 | 224 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | public function testAutoBackwardWithCallable() |
236 | 236 | { |
237 | - $paginator = new Paginator(function ($offset, $limit) { |
|
237 | + $paginator = new Paginator(function($offset, $limit) { |
|
238 | 238 | $this->assertSame(1, $offset); |
239 | 239 | $this->assertSame(4, $limit); |
240 | 240 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | }); |
243 | 243 | |
244 | 244 | $countCalled = false; |
245 | - $result = $paginator->auto(new Argument(['last' => 4]), function () use (&$countCalled) { |
|
245 | + $result = $paginator->auto(new Argument(['last' => 4]), function() use (&$countCalled) { |
|
246 | 246 | $countCalled = true; |
247 | 247 | |
248 | 248 | return 5; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | $this->assertSame(5, call_user_func_array($callable, ['array' => $this->data])); |
267 | 267 | |
268 | - $paginator = new Paginator(function ($offset, $limit) { |
|
268 | + $paginator = new Paginator(function($offset, $limit) { |
|
269 | 269 | $this->assertSame(1, $offset); |
270 | 270 | $this->assertSame(4, $limit); |
271 | 271 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | $promise->expects($this->once())->method('then'); |
294 | 294 | |
295 | - $paginator = new Paginator(function ($offset, $limit) use ($promise) { |
|
295 | + $paginator = new Paginator(function($offset, $limit) use ($promise) { |
|
296 | 296 | $this->assertSame(0, $offset); |
297 | 297 | $this->assertSame(5, $limit); |
298 | 298 |