We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -61,6 +61,9 @@ discard block |
||
| 61 | 61 | self::$fieldBuilderClassMap[$name] = $fieldBuilderClass; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + /** |
|
| 65 | + * @param string $type |
|
| 66 | + */ |
|
| 64 | 67 | protected static function checkBuilderClass($builderClass, $type) |
| 65 | 68 | { |
| 66 | 69 | $interface = MappingInterface::class; |
@@ -123,6 +126,9 @@ discard block |
||
| 123 | 126 | throw new InvalidConfigurationException(sprintf('%s builder "%s" not found.', ucfirst($type), $name)); |
| 124 | 127 | } |
| 125 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $name |
|
| 131 | + */ |
|
| 126 | 132 | protected function outputFieldsSelection($name) |
| 127 | 133 | { |
| 128 | 134 | $builder = new TreeBuilder(); |
@@ -64,7 +64,13 @@ |
||
| 64 | 64 | |
| 65 | 65 | abstract protected function getTagName(); |
| 66 | 66 | |
| 67 | + /** |
|
| 68 | + * @return string |
|
| 69 | + */ |
|
| 67 | 70 | abstract protected function getResolverServiceID(); |
| 68 | 71 | |
| 72 | + /** |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 69 | 75 | abstract protected function getParameterName(); |
| 70 | 76 | } |
@@ -162,6 +162,9 @@ |
||
| 162 | 162 | ->end(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $typeToTreat |
|
| 167 | + */ |
|
| 165 | 168 | private function relayNormalizer($typeToTreat, $definitionBuilderClass) |
| 166 | 169 | { |
| 167 | 170 | return function ($types) use ($typeToTreat, $definitionBuilderClass) { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $rootNode = $treeBuilder->root('overblog_graphql_types'); |
| 42 | 42 | |
| 43 | 43 | $configTypeKeys = array_map( |
| 44 | - function ($type) { |
|
| 44 | + function($type) { |
|
| 45 | 45 | return $this->normalizedConfigTypeKey($type); |
| 46 | 46 | }, |
| 47 | 47 | self::$types |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ->prototype('array') |
| 55 | 55 | // config is the unique config entry allowed |
| 56 | 56 | ->beforeNormalization() |
| 57 | - ->ifTrue(function ($v) use ($configTypeKeys) { |
|
| 57 | + ->ifTrue(function($v) use ($configTypeKeys) { |
|
| 58 | 58 | if (!empty($v) && is_array($v)) { |
| 59 | 59 | $keys = array_keys($v); |
| 60 | 60 | foreach ($configTypeKeys as $configTypeKey) { |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | ->thenInvalid( |
| 70 | 70 | sprintf( |
| 71 | 71 | 'Don\'t use internal config keys %s, replace it by "config" instead.', |
| 72 | - implode(', ', $configTypeKeys) |
|
| 72 | + implode(', ', $configTypeKeys) |
|
| 73 | 73 | ) |
| 74 | 74 | ) |
| 75 | 75 | ->end() |
| 76 | 76 | // config is renamed _{TYPE}_config |
| 77 | 77 | ->beforeNormalization() |
| 78 | - ->ifTrue(function ($v) { |
|
| 78 | + ->ifTrue(function($v) { |
|
| 79 | 79 | return isset($v['type']) && is_string($v['type']); |
| 80 | 80 | }) |
| 81 | - ->then(function ($v) { |
|
| 81 | + ->then(function($v) { |
|
| 82 | 82 | $key = $this->normalizedConfigTypeKey($v['type']); |
| 83 | 83 | |
| 84 | 84 | if (empty($v[$key])) { |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | ->end() |
| 103 | 103 | // _{TYPE}_config is renamed config |
| 104 | 104 | ->validate() |
| 105 | - ->ifTrue(function ($v) { |
|
| 105 | + ->ifTrue(function($v) { |
|
| 106 | 106 | return isset($v[$this->normalizedConfigTypeKey($v['type'])]); |
| 107 | 107 | }) |
| 108 | - ->then(function ($v) { |
|
| 108 | + ->then(function($v) { |
|
| 109 | 109 | $key = $this->normalizedConfigTypeKey($v['type']); |
| 110 | 110 | $v['config'] = $v[$key]; |
| 111 | 111 | unset($v[$key]); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | private function addBeforeNormalization(ArrayNodeDefinition $node) |
| 123 | 123 | { |
| 124 | - $typeKeyExists = function ($types) { |
|
| 124 | + $typeKeyExists = function($types) { |
|
| 125 | 125 | return !empty($types) && is_array($types); |
| 126 | 126 | }; |
| 127 | 127 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | // set type config.name |
| 130 | 130 | ->beforeNormalization() |
| 131 | 131 | ->ifTrue($typeKeyExists) |
| 132 | - ->then(function ($types) { |
|
| 132 | + ->then(function($types) { |
|
| 133 | 133 | foreach ($types as $name => &$type) { |
| 134 | 134 | $type['config'] = isset($type['config']) && is_array($type['config']) ? $type['config'] : []; |
| 135 | 135 | $type['config']['name'] = $name; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ->end() |
| 156 | 156 | // normalized relay-mutation-payload |
| 157 | 157 | ->beforeNormalization() |
| 158 | - ->ifTrue(function ($types) { |
|
| 158 | + ->ifTrue(function($types) { |
|
| 159 | 159 | return !empty($types) && is_array($types); |
| 160 | 160 | }) |
| 161 | 161 | ->then($this->relayNormalizer('relay-mutation-payload', PayloadDefinition::class)) |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | private function relayNormalizer($typeToTreat, $definitionBuilderClass) |
| 166 | 166 | { |
| 167 | - return function ($types) use ($typeToTreat, $definitionBuilderClass) { |
|
| 167 | + return function($types) use ($typeToTreat, $definitionBuilderClass) { |
|
| 168 | 168 | foreach ($types as $name => $type) { |
| 169 | 169 | if (isset($type['type']) && is_string($type['type']) && $typeToTreat === $type['type']) { |
| 170 | 170 | $config = isset($type['config']) && is_array($type['config']) ? $type['config'] : []; |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | trait DIContainerMockTrait |
| 22 | 22 | { |
| 23 | + /** |
|
| 24 | + * @return null|\Symfony\Component\DependencyInjection\ContainerInterface |
|
| 25 | + */ |
|
| 23 | 26 | private function getDIContainerMock(array $services = [], array $parameters = []) |
| 24 | 27 | { |
| 25 | 28 | $container = $this->getMockBuilder(Container::class) |
@@ -22,35 +22,35 @@ discard block |
||
| 22 | 22 | return [ |
| 23 | 23 | new ExpressionFunction( |
| 24 | 24 | 'service', |
| 25 | - function ($value) { |
|
| 25 | + function($value) { |
|
| 26 | 26 | return sprintf('$container->get(%s)', $value); |
| 27 | 27 | } |
| 28 | 28 | ), |
| 29 | 29 | |
| 30 | 30 | new ExpressionFunction( |
| 31 | 31 | 'parameter', |
| 32 | - function ($value) { |
|
| 32 | + function($value) { |
|
| 33 | 33 | return sprintf('$container->getParameter(%s)', $value); |
| 34 | 34 | } |
| 35 | 35 | ), |
| 36 | 36 | |
| 37 | 37 | new ExpressionFunction( |
| 38 | 38 | 'isTypeOf', |
| 39 | - function ($className) { |
|
| 39 | + function($className) { |
|
| 40 | 40 | return sprintf('($className = %s) && $value instanceof $className', $className); |
| 41 | 41 | } |
| 42 | 42 | ), |
| 43 | 43 | |
| 44 | 44 | new ExpressionFunction( |
| 45 | 45 | 'resolver', |
| 46 | - function ($alias, $args = '[]') { |
|
| 46 | + function($alias, $args = '[]') { |
|
| 47 | 47 | return sprintf('$container->get(\'overblog_graphql.resolver_resolver\')->resolve([%s, %s])', $alias, $args); |
| 48 | 48 | } |
| 49 | 49 | ), |
| 50 | 50 | |
| 51 | 51 | new ExpressionFunction( |
| 52 | 52 | 'mutateAndGetPayloadCallback', |
| 53 | - function ($mutateAndGetPayload) { |
|
| 53 | + function($mutateAndGetPayload) { |
|
| 54 | 54 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $context, $info) { '; |
| 55 | 55 | $code .= 'return '.$mutateAndGetPayload.'; }'; |
| 56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | new ExpressionFunction( |
| 62 | 62 | 'idFetcherCallback', |
| 63 | - function ($idFetcher) { |
|
| 63 | + function($idFetcher) { |
|
| 64 | 64 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $context, $info) { '; |
| 65 | 65 | $code .= 'return '.$idFetcher.'; }'; |
| 66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | new ExpressionFunction( |
| 72 | 72 | 'resolveSingleInputCallback', |
| 73 | - function ($resolveSingleInput) { |
|
| 73 | + function($resolveSingleInput) { |
|
| 74 | 74 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $context, $info) { '; |
| 75 | 75 | $code .= 'return '.$resolveSingleInput.'; }'; |
| 76 | 76 | |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | new ExpressionFunction( |
| 82 | 82 | 'mutation', |
| 83 | - function ($alias, $args = '[]') { |
|
| 83 | + function($alias, $args = '[]') { |
|
| 84 | 84 | return sprintf('$container->get(\'overblog_graphql.mutation_resolver\')->resolve([%s, %s])', $alias, $args); |
| 85 | 85 | } |
| 86 | 86 | ), |
| 87 | 87 | |
| 88 | 88 | new ExpressionFunction( |
| 89 | 89 | 'globalId', |
| 90 | - function ($id, $typeName = null) { |
|
| 90 | + function($id, $typeName = null) { |
|
| 91 | 91 | $typeNameEmpty = null === $typeName || '""' === $typeName || 'null' === $typeName || 'false' === $typeName; |
| 92 | 92 | |
| 93 | 93 | return sprintf( |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | new ExpressionFunction( |
| 103 | 103 | 'fromGlobalId', |
| 104 | - function ($globalId) { |
|
| 104 | + function($globalId) { |
|
| 105 | 105 | return sprintf( |
| 106 | 106 | '%s::fromGlobalId(%s)', |
| 107 | 107 | GlobalId::class, |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | new ExpressionFunction( |
| 114 | 114 | 'newObject', |
| 115 | - function ($className, $args = '[]') { |
|
| 115 | + function($className, $args = '[]') { |
|
| 116 | 116 | return sprintf('(new \ReflectionClass(%s))->newInstanceArgs(%s)', $className, $args); |
| 117 | 117 | } |
| 118 | 118 | ), |