Passed
Pull Request — master (#142)
by Erik
05:15
created
src/Mutations/UpdateMutation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         return array_merge(
34 34
             parent::args(),
35
-            $this->modelSchema->getLookupFields()->map(function (Field $field) {
35
+            $this->modelSchema->getLookupFields()->map(function(Field $field) {
36 36
                 return $field->getType();
37 37
             })->toArray()
38 38
         );
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $input = $args->input->toArray();
50 50
         $model = $this->findOrFail($args);
51 51
 
52
-        return DB::transaction(function () use ($input, $model) {
52
+        return DB::transaction(function() use ($input, $model) {
53 53
             $modelSchema = $this->registry->getSchemaForModel($model);
54 54
 
55 55
             return $modelSchema->updateIfAuthorized($input);
Please login to merge, or discard this patch.
src/Mutations/AttachPivotMutation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         }
48 48
 
49 49
         return $this->modelSchema->getLookupFields()
50
-            ->map(function (Field $field) {
50
+            ->map(function(Field $field) {
51 51
                 return $field->getType();
52 52
             })
53 53
             ->merge(['input' => $type])
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $input = $args->input->toArray();
77 77
         $model = $this->findOrFail($args);
78 78
 
79
-        return DB::transaction(function () use ($input, $model) {
79
+        return DB::transaction(function() use ($input, $model) {
80 80
             $modelSchema = $this->registry->getSchemaForModel($model);
81 81
 
82 82
             $relation = $this->getRelation($model);
Please login to merge, or discard this patch.
src/Mutations/CreateMutation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $input = $args->input->toArray();
34 34
 
35
-        return DB::transaction(function () use ($input) {
35
+        return DB::transaction(function() use ($input) {
36 36
             return $this->getModelSchema()->createIfAuthorized($input);
37 37
         });
38 38
     }
Please login to merge, or discard this patch.
src/Mutations/DeleteMutation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function args(): array
43 43
     {
44
-        return $this->modelSchema->getLookupFields()->map(function (Field $field) {
44
+        return $this->modelSchema->getLookupFields()->map(function(Field $field) {
45 45
             return $field->getType();
46 46
         })->toArray();
47 47
     }
Please login to merge, or discard this patch.
src/Mutations/Concerns/QueriesModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     {
64 64
         $result = $this->find($args);
65 65
 
66
-        if (! $result) {
66
+        if (!$result) {
67 67
             throw (new ModelNotFoundException)->setModel(class_basename($this->model));
68 68
         }
69 69
 
Please login to merge, or discard this patch.
src/Support/RootQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     {
30 30
         $fields = collect($this->fields);
31 31
 
32
-        return $fields->map(function (RootField $field) {
32
+        return $fields->map(function(RootField $field) {
33 33
             return $field->toArray();
34 34
         });
35 35
     }
Please login to merge, or discard this patch.
src/Support/Schema.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     protected function getModelTypes(): Collection
193 193
     {
194
-        return $this->getModels()->reduce(function (Collection $types, string $class) {
194
+        return $this->getModels()->reduce(function(Collection $types, string $class) {
195 195
             $schema = $this->registry->getModelSchema($class);
196 196
 
197 197
             if ($schema->getModel() instanceof Pivot) {
@@ -218,26 +218,26 @@  discard block
 block discarded – undo
218 218
             }
219 219
 
220 220
             // Filter through the regular fields and get the polymorphic types.
221
-            $schema->getFields()->filter(function ($field) {
221
+            $schema->getFields()->filter(function($field) {
222 222
                 return $field instanceof PolymorphicField;
223
-            })->each(function ($field, $key) use ($schema, &$types) {
223
+            })->each(function($field, $key) use ($schema, &$types) {
224 224
                 $types = $types->merge($this->getPolymorphicFieldTypes($schema, $key, $field));
225 225
             });
226 226
 
227 227
             // Filter through the relations of the model and get the
228 228
             // belongsToMany relations and get the pivot input types
229 229
             // for that relation.
230
-            $schema->getRelations()->filter(function ($relation) {
230
+            $schema->getRelations()->filter(function($relation) {
231 231
                 return $relation instanceof BelongsToMany;
232
-            })->each(function ($relation) use (&$types) {
232
+            })->each(function($relation) use (&$types) {
233 233
                 $types = $types->merge($this->getPivotInputTypes($relation));
234 234
             });
235 235
 
236 236
             // Filter through the relation fields and get the the
237 237
             // polymorphic types for the relations.
238
-            $schema->getRelationFields()->filter(function ($field) {
238
+            $schema->getRelationFields()->filter(function($field) {
239 239
                 return $field instanceof PolymorphicField;
240
-            })->each(function ($field, $key) use ($schema, &$types) {
240
+            })->each(function($field, $key) use ($schema, &$types) {
241 241
                 $types = $types->merge($this->getPolymorphicRelationshipTypes($schema, $key, $field));
242 242
             });
243 243
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         foreach ($this->getModels() as $modelSchema) {
366 366
             $modelSchema = $this->registry->getModelSchema($modelSchema);
367 367
 
368
-            if (! $modelSchema->getModel() instanceof Pivot) {
368
+            if (!$modelSchema->getModel() instanceof Pivot) {
369 369
                 $entityQuery = new SingleEntityQuery($this->registry, $modelSchema);
370 370
                 $queries->put($entityQuery->getName(), $entityQuery);
371 371
 
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
         foreach ($this->getModels() as $class) {
411 411
             $modelSchema = $this->registry->getModelSchema($class);
412 412
 
413
-            $pivotRelations = $modelSchema->getRelations()->filter(function ($relation) {
413
+            $pivotRelations = $modelSchema->getRelations()->filter(function($relation) {
414 414
                 return $relation instanceof BelongsToMany;
415 415
             });
416 416
 
417
-            if ($modelSchema->isMutable() && ! $modelSchema->getModel() instanceof Pivot) {
417
+            if ($modelSchema->isMutable() && !$modelSchema->getModel() instanceof Pivot) {
418 418
                 $createMutation = new CreateMutation($this->registry, $modelSchema);
419 419
                 $mutations->put($createMutation->getName(), $createMutation);
420 420
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         $config->setDirectives(array_merge(Directive::getInternalDirectives(), $this->directives()));
516 516
 
517 517
         // Set the type loader
518
-        $config->setTypeLoader(function ($name) use ($query, $mutation) {
518
+        $config->setTypeLoader(function($name) use ($query, $mutation) {
519 519
             if ($name === $query->name) {
520 520
                 return $query;
521 521
             }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
                 $types = $types->merge($this->getPivotModelTypes($schema));
199 199
             } else {
200 200
                 $types->push(new Types\EntityType($this->registry, $schema))
201
-                      ->push(new Types\EntityLookupType($this->registry, $schema))
202
-                      ->push(new Types\CollectionFilterType($this->registry, $schema));
201
+                        ->push(new Types\EntityLookupType($this->registry, $schema))
202
+                        ->push(new Types\CollectionFilterType($this->registry, $schema));
203 203
 
204 204
                 if ($schema->isSortable()) {
205 205
                     $types->push(new types\CollectionOrderByType($this->registry, $schema));
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 
212 212
                 if ($schema->isIndexable()) {
213 213
                     $types->push(new Types\EntityCollectionType($this->registry, $schema))
214
-                          ->push(new Types\CollectionRootSearchType($this->registry, $schema));
214
+                            ->push(new Types\CollectionRootSearchType($this->registry, $schema));
215 215
                 }
216 216
 
217 217
                 if ($schema->isMutable()) {
218 218
                     $types->push(new Types\CreateInputType($this->registry, $schema))
219
-                          ->push(new Types\UpdateInputType($this->registry, $schema));
219
+                            ->push(new Types\UpdateInputType($this->registry, $schema));
220 220
                 }
221 221
             }
222 222
 
Please login to merge, or discard this patch.
src/Mutations/DetachPivotMutation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $type = $this->registry->ID()->list();
57 57
         }
58 58
 
59
-        return $this->modelSchema->getLookupFields()->map(function (Field $field) {
59
+        return $this->modelSchema->getLookupFields()->map(function(Field $field) {
60 60
             return $field->getType();
61 61
         })->merge(['input' => $type])->toArray();
62 62
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $pivotAccessor = $relation->getPivotAccessor();
78 78
         $pivotSchema = $this->getPivotModelSchema();
79 79
 
80
-        $input->map(function ($input) use ($pivotSchema, $relation, $pivotAccessor, $model) {
80
+        $input->map(function($input) use ($pivotSchema, $relation, $pivotAccessor, $model) {
81 81
             $key = $input[$model->getKeyName()] ?? $input;
82 82
             $pivotWhere = $input[$pivotAccessor] ?? [];
83 83
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
             $query->wherePivot($relation->getRelatedPivotKeyName(), $key);
96 96
 
97 97
             return $query;
98
-        })->map(function (Relations\BelongsToMany $query) use ($modelSchema) {
99
-            $query->each(function (Model $related) use ($modelSchema) {
98
+        })->map(function(Relations\BelongsToMany $query) use ($modelSchema) {
99
+            $query->each(function(Model $related) use ($modelSchema) {
100 100
                 $modelSchema->authorizeToDetach($related);
101 101
             });
102 102
 
103 103
             return $query;
104
-        })->each(function (Relations\BelongsToMany $query) {
104
+        })->each(function(Relations\BelongsToMany $query) {
105 105
             $query->detach();
106 106
         });
107 107
 
Please login to merge, or discard this patch.
src/Console/ModelSchemaCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
         if (is_null($model)) {
43 43
             $model = $this->rootNamespace().$this->argument('name');
44
-        } elseif (! Str::startsWith($model, [$this->rootNamespace(), '\\'])) {
44
+        } elseif (!Str::startsWith($model, [$this->rootNamespace(), '\\'])) {
45 45
             $model = $this->rootNamespace().$model;
46 46
         }
47 47
 
Please login to merge, or discard this patch.