Completed
Pull Request — master (#77)
by Sebastian
02:39
created
Tests/Library/Type/InputObjectTypeTest.php 2 patches
Unused Use Statements   -7 removed lines patch added patch discarded remove patch
@@ -9,13 +9,7 @@  discard block
 block discarded – undo
9 9
 namespace Youshido\Tests\Library\Type;
10 10
 
11 11
 
12
-use Youshido\GraphQL\Execution\Context\ExecutionContext;
13 12
 use Youshido\GraphQL\Execution\Processor;
14
-use Youshido\GraphQL\Execution\Request;
15
-use Youshido\GraphQL\Field\Field;
16
-use Youshido\GraphQL\Parser\Ast\Argument;
17
-use Youshido\GraphQL\Parser\Ast\ArgumentValue\Literal;
18
-use Youshido\GraphQL\Parser\Ast\Query;
19 13
 use Youshido\GraphQL\Schema\Schema;
20 14
 use Youshido\GraphQL\Type\InputObject\InputObjectType;
21 15
 use Youshido\GraphQL\Type\ListType\ListType;
@@ -24,7 +18,6 @@  discard block
 block discarded – undo
24 18
 use Youshido\GraphQL\Type\Scalar\BooleanType;
25 19
 use Youshido\GraphQL\Type\Scalar\StringType;
26 20
 use Youshido\GraphQL\Type\TypeMap;
27
-use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidator;
28 21
 use Youshido\Tests\DataProvider\TestInputObjectType;
29 22
 
30 23
 class InputObjectTypeTest extends \PHPUnit_Framework_TestCase
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 'fields' => [
61 61
                     'empty' => [
62 62
                         'type'    => new StringType(),
63
-                        'resolve' => function () {
63
+                        'resolve' => function() {
64 64
                             return null;
65 65
                         }
66 66
                     ]
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                             ]))
80 80
                         ],
81 81
                         'type'    => new BooleanType(),
82
-                        'resolve' => function ($object, $args) {
82
+                        'resolve' => function($object, $args) {
83 83
                             return true;
84 84
                         }
85 85
                     ]
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 'fields' => [
101 101
                     'empty' => [
102 102
                         'type'    => new StringType(),
103
-                        'resolve' => function () { }
103
+                        'resolve' => function() { }
104 104
                     ],
105 105
                 ]
106 106
             ]),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                                 ]
123 123
                             ])
124 124
                         ],
125
-                        'resolve' => function () { return 'success message'; }
125
+                        'resolve' => function() { return 'success message'; }
126 126
                     ]
127 127
                 ]
128 128
             ])
Please login to merge, or discard this patch.
src/Type/ListType/AbstractListType.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
         if ($isValid && $itemType->isInputType()) {
38 38
             foreach($value as $item) {
39 39
                 $isValid = $itemType->isValidValue($item);
40
-                if (!$isValid) return false;
40
+                if (!$isValid) {
41
+                    return false;
42
+                }
41 43
             }
42 44
         }
43 45
         return $isValid;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $isValid = is_null($value) || is_array($value) || $this->isIterableObject($value);
36 36
         $itemType = $this->config->get('itemType');
37 37
         if ($isValid && $itemType->isInputType()) {
38
-            foreach($value as $item) {
38
+            foreach ($value as $item) {
39 39
                 $isValid = $itemType->isValidValue($item);
40 40
                 if (!$isValid) return false;
41 41
             }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     private function isIterableObject($value)
47 47
     {
48
-        if(is_object($value)) {
48
+        if (is_object($value)) {
49 49
             $implements = class_implements($value);
50 50
             return isset($implements['Iterator']) || isset($implements['IteratorAggregate']);
51 51
         }
Please login to merge, or discard this patch.
src/Introspection/QueryType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($value && $value->getKind() == TypeMap::KIND_ENUM) {
59 59
             $data = [];
60 60
             foreach ($value->getValues() as $enumValue) {
61
-                if(!$args['includeDeprecated'] && (isset($enumValue['isDeprecated']) && $enumValue['isDeprecated'])) {
61
+                if (!$args['includeDeprecated'] && (isset($enumValue['isDeprecated']) && $enumValue['isDeprecated'])) {
62 62
                     continue;
63 63
                 }
64 64
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         }
92 92
 
93 93
         /** @var AbstractObjectType $value */
94
-        return array_filter($value->getConfig()->getFields(), function ($field) use ($args) {
94
+        return array_filter($value->getConfig()->getFields(), function($field) use ($args) {
95 95
             /** @var $field Field */
96 96
             if (in_array($field->getName(), ['__type', '__schema']) || (!$args['includeDeprecated'] && $field->isDeprecated())) {
97 97
                 return false;
Please login to merge, or discard this patch.
Tests/Schema/IntrospectionTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             'description'       => 'latest description',
137 137
             'deprecationReason' => 'for test',
138 138
             'isDeprecated'      => true,
139
-            'resolve'           => function () {
139
+            'resolve'           => function() {
140 140
                 return [
141 141
                     'id'   => 1,
142 142
                     'name' => 'Alex'
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
                                 ['name' => 'String', 'fields' => null],
202 202
                                 ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]],
203 203
                                 ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]],
204
-                                ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]],
204
+                                ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []], ]],
205 205
                                 ['name' => 'Boolean', 'fields' => null],
206
-                                ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]],
206
+                                ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ]],
207 207
                                 ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]],
208 208
                                 ['name' => '__Subscription', 'fields' => [['name' => 'name', 'args' => []]]],
209 209
                                 ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'onOperation', 'args' => []], ['name' => 'onFragment', 'args' => []], ['name' => 'onField', 'args' => []]]],
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 'id'   => ['type' => new IntType()],
292 292
                 'name' => ['type' => new IntType()],
293 293
             ],
294
-            'resolveType' => function ($type) {
294
+            'resolveType' => function($type) {
295 295
 
296 296
             }
297 297
         ]);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $unionType = new UnionType([
320 320
             'name'        => 'UnionType',
321 321
             'types'       => [$object1, $object2],
322
-            'resolveType' => function () {
322
+            'resolveType' => function() {
323 323
 
324 324
             }
325 325
         ]);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             'args'    => [
331 331
                 'id' => ['type' => TypeMap::TYPE_INT]
332 332
             ],
333
-            'resolve' => function () {
333
+            'resolve' => function() {
334 334
                 return [
335 335
                     'id'   => 1,
336 336
                     'name' => 'Alex'
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                     ]
357 357
                 ])
358 358
             ],
359
-            'resolve' => function () {
359
+            'resolve' => function() {
360 360
                 return null;
361 361
             }
362 362
         ]));
Please login to merge, or discard this patch.
src/Type/Object/AbstractObjectType.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -87,6 +87,9 @@
 block discarded – undo
87 87
         return $this->getConfigValue('interfaces', []);
88 88
     }
89 89
 
90
+    /**
91
+     * @param ObjectType|null $value
92
+     */
90 93
     public function isValidValue($value)
91 94
     {
92 95
         return is_array($value) || is_null($value) || is_object($value);
Please login to merge, or discard this patch.
src/Field/AbstractField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             $config['type'] = $this->getType();
35 35
             $config['name'] = $this->getName();
36 36
             if (empty($config['name'])) {
37
-                $config['name'] =$this->getAutoName();
37
+                $config['name'] = $this->getAutoName();
38 38
             }
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/Config/AbstractConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $validator = ConfigValidator::getInstance();
60 60
 
61 61
         if (!$validator->validate($this->data, $this->getContextRules(), $this->extraFieldsAllowed)) {
62
-            throw new ConfigurationException('Config is not valid for ' . ($this->contextObject ? get_class($this->contextObject) : null) . "\n" . implode("\n", $validator->getErrorsArray(false)));
62
+            throw new ConfigurationException('Config is not valid for '.($this->contextObject ? get_class($this->contextObject) : null)."\n".implode("\n", $validator->getErrorsArray(false)));
63 63
         }
64 64
     }
65 65
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         } elseif (substr($method, 0, 2) == 'is') {
152 152
             $propertyName = lcfirst(substr($method, 2));
153 153
         } else {
154
-            throw new \Exception('Call to undefined method ' . $method);
154
+            throw new \Exception('Call to undefined method '.$method);
155 155
         }
156 156
 
157 157
         return $this->get($propertyName);
Please login to merge, or discard this patch.
Tests/Library/Config/InterfaceTypeConfigTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function testConfigNoFields()
32 32
     {
33 33
         ConfigValidator::getInstance()->assertValidateConfig(
34
-            new InterfaceTypeConfig(['name' => 'Test', 'resolveType' => function () { }], null, true)
34
+            new InterfaceTypeConfig(['name' => 'Test', 'resolveType' => function() { }], null, true)
35 35
         );
36 36
     }
37 37
 
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
         $interfaceConfig = new InterfaceTypeConfig([
60 60
             'name'        => 'Test',
61 61
             'fields'      => ['id' => new IntType()],
62
-            'resolveType' => function ($object) {
62
+            'resolveType' => function($object) {
63 63
                 return $object->getType();
64 64
             }
65 65
         ], null, true);
66
-        $object          = new ObjectType(['name' => 'User', 'fields' => ['name' => new StringType()]]);
66
+        $object = new ObjectType(['name' => 'User', 'fields' => ['name' => new StringType()]]);
67 67
 
68 68
         $this->assertEquals($interfaceConfig->getName(), 'Test');
69 69
         $this->assertEquals($interfaceConfig->resolveType($object), $object->getType());
Please login to merge, or discard this patch.
Tests/Library/Config/ConfigTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             ]
79 79
         ]);
80 80
 
81
-        $finalConfig = new TestConfig(['name' => $name . 'final', 'resolve' => function () { return []; }], $object, true);
81
+        $finalConfig = new TestConfig(['name' => $name.'final', 'resolve' => function() { return []; }], $object, true);
82 82
         $this->assertEquals($finalConfig->getType(), null);
83 83
 
84 84
         $rules['resolve']['required'] = true;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function testFinalRule()
100 100
     {
101
-        ConfigValidator::getInstance()->assertValidateConfig(new TestConfig(['name' => 'Test' . 'final'], null, true));
101
+        ConfigValidator::getInstance()->assertValidateConfig(new TestConfig(['name' => 'Test'.'final'], null, true));
102 102
     }
103 103
 
104 104
     /**
Please login to merge, or discard this patch.