Passed
Push — master ( 520bbe...0c2dd0 )
by Bruno
03:09
created
Modelarium/Laravel/Directives/MigrationIndexDirective.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         if (!count($indexFields)) {
20 20
             throw new Exception("You must provide at least one field to an index");
21 21
         }
22
-        $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) .'"]);';
22
+        $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) . '"]);';
23 23
     }
24 24
 
25 25
     public static function processMigrationFieldDirective(
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/MigrationUniqueIndexDirective.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         if (!count($indexFields)) {
57 57
             throw new Exception("You must provide at least one field to an index on a model");
58 58
         }
59
-        $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) .'"]);';
59
+        $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) . '"]);';
60 60
     }
61 61
 
62 62
     public static function processMigrationFieldDirective(
Please login to merge, or discard this patch.
Modelarium/Util.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
      */
48 48
     public static function scalars(array $datatypes, string $ns): array
49 49
     {
50
-        $graphql = [ '# File automatically generated by Modelarium' ];
50
+        $graphql = ['# File automatically generated by Modelarium'];
51 51
 
52 52
         foreach ($datatypes as $name) {
53 53
             $typeName = Str::studly($name);
Please login to merge, or discard this patch.
Modelarium/Frontend/FrontendGenerator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
     public function buildTemplateParameters(): void
143 143
     {
144 144
         $this->titleFields = $this->fModel->filterField(
145
-            function (Field $field) {
145
+            function(Field $field) {
146 146
                 return $field->getRenderable('title', false);
147 147
             }
148 148
         );
149 149
         $this->cardFields = $this->fModel->filterField(
150
-            function (Field $field) {
150
+            function(Field $field) {
151 151
                 return $field->getRenderable('card', false);
152 152
             }
153 153
         );
154 154
         $this->tableFields = $this->fModel->filterField(
155
-            function (Field $field) {
155
+            function(Field $field) {
156 156
                 return $field->getRenderable('table', false);
157 157
             }
158 158
         );
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             'Table',
209 209
             [
210 210
                 Table::ROW_NAMES => array_map(
211
-                    function (Field $field) {
211
+                    function(Field $field) {
212 212
                         return $field->getRenderable(Renderable::LABEL, $field->getName());
213 213
                     },
214 214
                     $this->tableFields
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             true
227 227
         );
228 228
         $titleFields = $this->fModel->filterField(
229
-            function (Field $field) {
229
+            function(Field $field) {
230 230
                 return $field->getRenderable('title', false);
231 231
             }
232 232
         );
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             'keyAttribute' => $this->keyAttribute,
253 253
             'spinner' => $spinner,
254 254
             'tablelist' => $table->getRenderHTML(),
255
-            'tableItemFields' => array_keys(array_map(function (Field $f) {
255
+            'tableItemFields' => array_keys(array_map(function(Field $f) {
256 256
                 return $f->getName();
257 257
             }, $this->tableFields)),
258 258
             'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName),
@@ -330,13 +330,13 @@  discard block
 block discarded – undo
330 330
                     $filters[] = [
331 331
                         'name' => $arg->name,
332 332
                         'type' => $typename,
333
-                        'graphqlType' =>  $arg->name  . ': ' .
333
+                        'graphqlType' =>  $arg->name . ': ' .
334 334
                             ($isArray ? '[' : '') .
335 335
                             $typename .
336 336
                             $isInternalRequiredString . // TODO: phpstan complains, issue with graphqlphp ($isInternalRequired ? '!' : '') .
337 337
                             ($isArray ? ']' : '') .
338 338
                             ($isRequired ? '!' : ''),
339
-                        'required' => (bool)$isRequired,
339
+                        'required' => (bool) $isRequired,
340 340
                         'requiredJSBoolean' => $isRequired ? 'true' : 'false'
341 341
                     ];
342 342
                 }
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
          * card
353 353
          */
354 354
         $cardFieldNames = array_map(
355
-            function (Field $field) {
355
+            function(Field $field) {
356 356
                 return $field->getName();
357 357
             },
358 358
             $this->cardFields
359 359
         );
360 360
         $graphqlQuery = $this->fModel->mapFields(
361
-            function (Field $f) use ($cardFieldNames) {
361
+            function(Field $f) use ($cardFieldNames) {
362 362
                 if (in_array($f->getName(), $cardFieldNames)) {
363 363
                     // TODO: filter subfields in relationships
364 364
                     return $f->toGraphqlQuery();
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             $filtersQuery = ', ' . join(
375 375
                 ', ',
376 376
                 array_map(
377
-                    function ($item) {
377
+                    function($item) {
378 378
                         // TODO: still buggy, misses the internal ! in [Xyz!]!
379 379
                         return '$' . $item['graphqlType'];
380 380
                     },
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             $filtersParams = ', ' . join(
385 385
                 ', ',
386 386
                 array_map(
387
-                    function ($item) {
387
+                    function($item) {
388 388
                         return $item['name'] . ': $' . $item['name'];
389 389
                     },
390 390
                     $filters
@@ -423,14 +423,14 @@  discard block
 block discarded – undo
423 423
          * table
424 424
          */
425 425
         $tableFieldNames = array_map(
426
-            function (Field $field) {
426
+            function(Field $field) {
427 427
                 return $field->getName();
428 428
             },
429 429
             $this->tableFields
430 430
         );
431 431
 
432 432
         $graphqlQuery = $this->fModel->mapFields(
433
-            function (Field $f) use ($tableFieldNames) {
433
+            function(Field $f) use ($tableFieldNames) {
434 434
                 if (in_array($f->getName(), $tableFieldNames)) {
435 435
                     // TODO: filter subfields in relationships
436 436
                     return $f->toGraphqlQuery();
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
          * item
471 471
          */
472 472
         $graphqlQuery = $this->fModel->mapFields(
473
-            function (Field $f) {
473
+            function(Field $f) {
474 474
                 return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null;
475 475
             }
476 476
         );
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/MigrationForeignDirective.php 1 patch
Switch Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
             $name = $directive->name->value;
42 42
 
43 43
             switch ($name) {
44
-                case 'belongToMany':
45
-                case 'morphedByMany':
46
-                    throw new DirectiveException("Foreign keys cannot be used with many-to-many-relationships. Check field: " . $field->name);
44
+            case 'belongToMany':
45
+            case 'morphedByMany':
46
+                throw new DirectiveException("Foreign keys cannot be used with many-to-many-relationships. Check field: " . $field->name);
47 47
             }
48 48
         }
49 49
 
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/MigrationFulltextIndexDirective.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         }
25 25
         $generator->postCreateCode[] =
26 26
             "if (!App::environment('testing')) {
27
-            DB::statement('ALTER TABLE " . $generator->getTableName()  .
27
+            DB::statement('ALTER TABLE " . $generator->getTableName() .
28 28
                 " ADD FULLTEXT fulltext_index (`" . implode('`, `', $indexFields) . "`)');
29 29
         }";
30 30
     }
Please login to merge, or discard this patch.
Modelarium/Laravel/Console/Commands/ModelariumFrontendCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
         $writtenFiles = $this->writeFiles(
157 157
             $collection,
158 158
             $basepath,
159
-            function (GeneratedItem $i) use ($match) {
160
-                if ((bool)$this->option('overwrite') === true) {
159
+            function(GeneratedItem $i) use ($match) {
160
+                if ((bool) $this->option('overwrite') === true) {
161 161
                     return true;
162 162
                 }
163
-                if ((bool)$this->option('overwrite-graphql') === true) {
163
+                if ((bool) $this->option('overwrite-graphql') === true) {
164 164
                     if (
165 165
                         StringUtil::endsWith($i->filename, '.graphql')
166 166
                     ) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             // this runs all prettier commands in parallel.
190 190
             $run = array_reduce(
191 191
                 $writtenFiles,
192
-                function ($carry, $f) use ($command) {
192
+                function($carry, $f) use ($command) {
193 193
                     return $carry . '(' . $command . $f . ') & ';
194 194
                 }
195 195
             );
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             // this runs all prettier commands in parallel.
209 209
             $run = array_reduce(
210 210
                 $writtenFiles,
211
-                function ($carry, $f) use ($command) {
211
+                function($carry, $f) use ($command) {
212 212
                     return $carry . '(' . $command . $f . ') & ';
213 213
                 }
214 214
             );
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/CanDirective.php 1 patch
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@
 block discarded – undo
34 34
 
35 35
         foreach ($directive->arguments as $arg) {
36 36
             switch ($arg->name->value) {
37
-                case 'ability':
38
-                    // @phpstan-ignore-next-line
39
-                    $ability = $arg->value->value;
40
-                break;
41
-                case 'find':
42
-                    // @phpstan-ignore-next-line
43
-                    $find = $arg->value->value;
44
-                break;
45
-                case 'model':
46
-                    // @phpstan-ignore-next-line
47
-                    $modelName = $arg->value->value;
48
-                break;
49
-                case 'injectArgs':
50
-                    $injected = true;
51
-                break;
52
-                case 'args':
53
-                    $args = true;
54
-                break;
37
+            case 'ability':
38
+                // @phpstan-ignore-next-line
39
+                $ability = $arg->value->value;
40
+            break;
41
+            case 'find':
42
+                // @phpstan-ignore-next-line
43
+                $find = $arg->value->value;
44
+            break;
45
+            case 'model':
46
+                // @phpstan-ignore-next-line
47
+                $modelName = $arg->value->value;
48
+            break;
49
+            case 'injectArgs':
50
+                $injected = true;
51
+            break;
52
+            case 'args':
53
+                $args = true;
54
+            break;
55 55
             }
56 56
         }
57 57
 
Please login to merge, or discard this patch.
Modelarium/Frontend/FrontendVueGenerator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'),
129 129
                 Button::ATTRIBUTES => [
130 130
                     $targetAttribute => "/{$routeBase}/edit",
131
-                ] + ($hasCan ? [ "v-if" => 'can(\'create\')' ]: []),
131
+                ] + ($hasCan ? ["v-if" => 'can(\'create\')'] : []),
132 132
             ]
133 133
         )->setContent(
134 134
             '<i class="fa fa-plus"></i> Add new',
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'),
143 143
                 Button::ATTRIBUTES => [
144 144
                     $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'",
145
-                ] + ($hasCan ? [ "v-if" => 'can(\'edit\')' ]: []),
145
+                ] + ($hasCan ? ["v-if" => 'can(\'edit\')'] : []),
146 146
             ]
147 147
         )->setContent(
148 148
             '<i class="fa fa-pencil"></i> Edit',
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 Button::ATTRIBUTES => [
159 159
                     'href' => '#',
160 160
                     '@click.prevent' => 'remove',
161
-                ] + ($hasCan ? [ "v-if" => 'can(\'delete\')' ]: []),
161
+                ] + ($hasCan ? ["v-if" => 'can(\'delete\')'] : []),
162 162
             ]
163 163
         )->setContent(
164 164
             '<i class="fa fa-trash"></i> Delete',
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->generator->templateParameters['options'] = $this->options->getSection('vue');
179 179
 
180 180
         $this->generator->templateParameters['tableItemFields'] =
181
-            array_values(array_map(function (Field $f) {
181
+            array_values(array_map(function(Field $f) {
182 182
                 if ($f->getDatatype()->getBasetype() === 'relationship') {
183 183
                     $name = $f->getName();
184 184
                     return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>";
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 'required' => true
274 274
             ]
275 275
         ];
276
-        $cardFieldNames = array_map(function (Field $f) {
276
+        $cardFieldNames = array_map(function(Field $f) {
277 277
             return $f->getName();
278 278
         }, $this->generator->getCardFields());
279 279
         $vueCode->setExtraProps($extraprops);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         $vueCode = $vue->getVueCode();
300 300
         // set basic data for vue
301 301
         $vueCode->setExtraProps([]);
302
-        $cardFieldNames = array_map(function (Field $f) {
302
+        $cardFieldNames = array_map(function(Field $f) {
303 303
             return $f->getName();
304 304
         }, $this->generator->getCardFields());
305 305
         foreach ($this->generator->getCardFields() as $f) {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     public function vueTableItem(FrameworkVue $vue): void
325 325
     {
326 326
         $vueCode = $vue->getVueCode();
327
-        $tableFieldNames = array_map(function (Field $f) {
327
+        $tableFieldNames = array_map(function(Field $f) {
328 328
             return $f->getName();
329 329
         }, $this->generator->getTableFields());
330 330
         $extraprops = [
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $vue,
357 357
             'Form',
358 358
             'editable',
359
-            function (Field $f) {
359
+            function(Field $f) {
360 360
                 if (!$f->getExtradata('modelFillable')) {
361 361
                     return false;
362 362
                 }
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
         if ($mode == 'editable') {
383 383
             $vue->setEditableTemplate(
384
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
384
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
385 385
                     return $this->generator->templateCallback($stub, $vue, $data, $m);
386 386
                 }
387 387
             );
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             );
396 396
         } else {
397 397
             $vue->setViewableTemplate(
398
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
398
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
399 399
                     return $this->generator->templateCallback($stub, $vue, $data, $m);
400 400
                 }
401 401
             );
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         $path = $this->generator->getModel()->getName() . '/index.js';
418 418
         $name = $this->generator->getStudlyName();
419 419
 
420
-        $contents = function ($basepath, $element) use ($name) {
420
+        $contents = function($basepath, $element) use ($name) {
421 421
             $dir = $basepath . '/' . $name;
422 422
             $import = [];
423 423
             $export = [];
Please login to merge, or discard this patch.