Completed
Pull Request — master (#75)
by
unknown
04:51
created
examples/01_sandbox/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Youshido\GraphQL\Type\Object\ObjectType;
7 7
 use Youshido\GraphQL\Type\Scalar\StringType;
8 8
 
9
-require_once __DIR__ . '/../../../../../vendor/autoload.php';
9
+require_once __DIR__.'/../../../../../vendor/autoload.php';
10 10
 
11 11
 $processor = new Processor(new Schema([
12 12
     'query' => new ObjectType([
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         'fields' => [
15 15
             'currentTime' => [
16 16
                 'type'    => new StringType(),
17
-                'resolve' => function () {
17
+                'resolve' => function() {
18 18
                     return date('Y-m-d H:ia');
19 19
                 }
20 20
             ]
@@ -23,4 +23,4 @@  discard block
 block discarded – undo
23 23
 ]));
24 24
 
25 25
 $processor->processPayload('{ currentTime }');
26
-echo json_encode($processor->getResponseData()) . "\n";
26
+echo json_encode($processor->getResponseData())."\n";
Please login to merge, or discard this patch.
src/Config/Schema/SchemaConfig.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@  discard block
 block discarded – undo
23 23
      */
24 24
     private $typesList;
25 25
 
26
+    /**
27
+     * @param \Youshido\GraphQL\Schema\AbstractSchema $contextObject
28
+     */
26 29
     public function __construct(array $configData, $contextObject = null, $finalClass = false)
27 30
     {
28 31
         $this->typesList = new SchemaTypesList();
@@ -58,7 +61,7 @@  discard block
 block discarded – undo
58 61
     }
59 62
 
60 63
     /**
61
-     * @param $query AbstractObjectType
64
+     * @param \Youshido\Tests\StarWars\Schema\StarWarsQueryType $query AbstractObjectType
62 65
      *
63 66
      * @return SchemaConfig
64 67
      */
Please login to merge, or discard this patch.
Tests/Schema/SchemaTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'fields' => [
30 30
                 'currentTime' => [
31 31
                     'type'    => new StringType(),
32
-                    'resolve' => function ($value, $args, $type) {
32
+                    'resolve' => function($value, $args, $type) {
33 33
                         return 'May 5, 9:00am';
34 34
                     },
35 35
                     'args'    => [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         $this->assertEquals(1, count($schema->getMutationType()->getFields()));
60 60
 
61
-        $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function () { }]);
61
+        $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function() { }]);
62 62
         $this->assertEquals(2, count($schema->getMutationType()->getFields()));
63 63
 
64 64
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             'fields'      => [
90 90
                 'name' => new StringType(),
91 91
             ],
92
-            'resolveType' => function () use ($authorType) {
92
+            'resolveType' => function() use ($authorType) {
93 93
                 return $authorType;
94 94
             }
95 95
         ]);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
             'interfaces' => [$userInterface]
103 103
         ]);
104 104
 
105
-        $schema    = new Schema([
105
+        $schema = new Schema([
106 106
             'query' => new ObjectType([
107 107
                 'name'   => 'QueryType',
108 108
                 'fields' => [
109 109
                     'user' => [
110 110
                         'type'    => $userInterface,
111
-                        'resolve' => function () {
111
+                        'resolve' => function() {
112 112
                             return [
113 113
                                 'name' => 'Alex'
114 114
                             ];
Please login to merge, or discard this patch.
src/Execution/Request.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -45,6 +45,9 @@
 block discarded – undo
45 45
     {
46 46
     }
47 47
 
48
+    /**
49
+     * @param string $name
50
+     */
48 51
     public function addQuery($name, AbstractObjectType $query)
49 52
     {
50 53
         $this->getQueryType()->getConfig()->addField($name, $query);
Please login to merge, or discard this patch.
src/Execution/Visitor/MaxComplexityQueryVisitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
         $this->memo += $cost;
54 54
 
55 55
         if ($this->memo > $this->maxScore) {
56
-            throw new \Exception('query exceeded max allowed complexity of ' . $this->maxScore);
56
+            throw new \Exception('query exceeded max allowed complexity of '.$this->maxScore);
57 57
         }
58 58
 
59 59
         return $cost;
Please login to merge, or discard this patch.
src/Parser/Tokenizer.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -182,6 +182,9 @@  discard block
 block discarded – undo
182 182
         return new Token($this->getKeyword($value), $value);
183 183
     }
184 184
 
185
+    /**
186
+     * @param string $name
187
+     */
185 188
     protected function getKeyword($name)
186 189
     {
187 190
         switch ($name) {
@@ -261,6 +264,9 @@  discard block
 block discarded – undo
261 264
         }
262 265
     }
263 266
 
267
+    /**
268
+     * @param string $message
269
+     */
264 270
     protected function createException($message)
265 271
     {
266 272
         return new SyntaxErrorException(sprintf('%s at (%s:%s)', $message, $this->line, $this->getColumn()));
Please login to merge, or discard this patch.
src/Validator/Exception/DatableResolveException.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
     /** @var  array */
14 14
     protected $data;
15 15
 
16
+    /**
17
+     * @param string $message
18
+     */
16 19
     public function __construct($message, $code = 0, $data = [])
17 20
     {
18 21
         parent::__construct($message, $code);
Please login to merge, or discard this patch.
Tests/Library/Validator/ResolveValidatorTest.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@
 block discarded – undo
27 27
 use Youshido\GraphQL\Type\Scalar\StringType;
28 28
 use Youshido\GraphQL\Type\Union\UnionType;
29 29
 use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidator;
30
-use Youshido\Tests\DataProvider\TestEnumType;
31 30
 use Youshido\Tests\DataProvider\TestInterfaceType;
32 31
 use Youshido\Tests\DataProvider\TestObjectType;
33 32
 use Youshido\Tests\DataProvider\TestUnionType;
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -67,36 +67,36 @@
 block discarded – undo
67 67
 
68 68
     public function testValidFragmentTypeWithComposite()
69 69
     {
70
-      $validator = new ResolveValidator(new ExecutionContext(new TestSchema()));
71
-      $userType = new ObjectType([
70
+        $validator = new ResolveValidator(new ExecutionContext(new TestSchema()));
71
+        $userType = new ObjectType([
72 72
         'name'       => 'User',
73 73
         'fields'     => [
74
-          'name' => new StringType(),
74
+            'name' => new StringType(),
75 75
         ],
76 76
         'interfaces' => [new TestInterfaceType()]
77
-      ]);
77
+        ]);
78 78
 
79
-      $fragment          = new Fragment('name', 'User', []);
80
-      $fragmentReference = new FragmentReference('name');
81
-      $validator->assertValidFragmentForField($fragment, $fragmentReference, new NonNullType($userType));
79
+        $fragment          = new Fragment('name', 'User', []);
80
+        $fragmentReference = new FragmentReference('name');
81
+        $validator->assertValidFragmentForField($fragment, $fragmentReference, new NonNullType($userType));
82 82
     }
83 83
 
84 84
     public function testValidFragmentTypeWithUnion()
85 85
     {
86
-      $validator = new ResolveValidator(new ExecutionContext(new TestSchema()));
86
+        $validator = new ResolveValidator(new ExecutionContext(new TestSchema()));
87 87
 
88
-      $unionType = new ObjectType([
88
+        $unionType = new ObjectType([
89 89
         'name' => 'Mammals',
90 90
         'type'    => new TestUnionType(),
91 91
         'resolve' => function ($value, $args, ResolveInfo $info) {
92
-          $testObject = new TestObjectType();
93
-          return [$testObject->getData()];
92
+            $testObject = new TestObjectType();
93
+            return [$testObject->getData()];
94 94
         }
95
-      ]);
95
+        ]);
96 96
 
97
-      $fragment          = new Fragment('name', 'TestObject', ['name']);
98
-      $fragmentReference = new FragmentReference('name');
99
-      $validator->assertValidFragmentForField($fragment, $fragmentReference, $unionType);
97
+        $fragment          = new Fragment('name', 'TestObject', ['name']);
98
+        $fragmentReference = new FragmentReference('name');
99
+        $validator->assertValidFragmentForField($fragment, $fragmentReference, $unionType);
100 100
     }
101 101
 
102 102
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
       $unionType = new ObjectType([
89 89
         'name' => 'Mammals',
90 90
         'type'    => new TestUnionType(),
91
-        'resolve' => function ($value, $args, ResolveInfo $info) {
91
+        'resolve' => function($value, $args, ResolveInfo $info) {
92 92
           $testObject = new TestObjectType();
93 93
           return [$testObject->getData()];
94 94
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function testInvalidFragmentType()
106 106
     {
107
-        $userType          = new ObjectType([
107
+        $userType = new ObjectType([
108 108
             'name'   => 'User',
109 109
             'fields' => [
110 110
                 'name' => new StringType(),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $union = new UnionType([
142 142
             'name'        => 'TestUnion',
143 143
             'types'       => [new TestObjectType()],
144
-            'resolveType' => function () {
144
+            'resolveType' => function() {
145 145
                 return new BooleanType();
146 146
             }
147 147
         ]);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $union = new UnionType([
156 156
             'name'        => 'TestUnion',
157 157
             'types'       => [new TestObjectType()],
158
-            'resolveType' => function () {
158
+            'resolveType' => function() {
159 159
                 return new TestObjectType();
160 160
             }
161 161
         ]);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $variableWrongTypeReference = new VariableReference('year', $variableWrongType);
181 181
 
182 182
 
183
-        $field     = new Field([
183
+        $field = new Field([
184 184
             'name' => 'hero',
185 185
             'type' => new ObjectType([
186 186
                 'name'   => 'User',
Please login to merge, or discard this patch.