Passed
Push — master ( 1dbc05...713241 )
by Bruno
03:36
created
Modelarium/Laravel/ServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,13 +72,13 @@
 block discarded – undo
72 72
          */
73 73
         Event::listen(
74 74
             RegisterDirectiveNamespaces::class,
75
-            function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string {
75
+            function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string {
76 76
                 return 'Modelarium\\Laravel\\Lighthouse\\Directives';
77 77
             }
78 78
         );
79 79
         Event::listen(
80 80
             RegisterDirectiveNamespaces::class,
81
-            function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string {
81
+            function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string {
82 82
                 return 'App\\Datatypes\\Types';
83 83
             }
84 84
         );
Please login to merge, or discard this patch.
Modelarium/Frontend/FrontendVueGenerator.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'),
100 100
                 Button::ATTRIBUTES => [
101 101
                     $targetAttribute => "/{$routeBase}/edit",
102
-                ] + ($hasCan ? [ "v-if" => 'can(\'create\')' ]: []),
102
+                ] + ($hasCan ? ["v-if" => 'can(\'create\')'] : []),
103 103
             ]
104 104
         )->setContent(
105 105
             '<i class="fa fa-plus"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['addNew'],
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'),
114 114
                 Button::ATTRIBUTES => [
115 115
                     $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'",
116
-                ] + ($hasCan ? [ "v-if" => 'can(\'edit\')' ]: []),
116
+                ] + ($hasCan ? ["v-if" => 'can(\'edit\')'] : []),
117 117
             ]
118 118
         )->setContent(
119 119
             '<i class="fa fa-pencil"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['edit'],
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 Button::ATTRIBUTES => [
130 130
                     'href' => '#',
131 131
                     '@click.prevent' => 'remove(model.id)',
132
-                ] + ($hasCan ? [ "v-if" => 'can(\'delete\')' ]: []),
132
+                ] + ($hasCan ? ["v-if" => 'can(\'delete\')'] : []),
133 133
             ]
134 134
         )->setContent(
135 135
             '<i class="fa fa-trash"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['delete'],
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $this->generator->templateParameters['options'] = $this->getOptions()->options;
150 150
 
151 151
         $this->generator->templateParameters['tableItemFields'] =
152
-            array_values(array_map(function (Field $f) {
152
+            array_values(array_map(function(Field $f) {
153 153
                 $required = $f->getValidator('required', false);
154 154
                 if ($f->getDatatype()->getBasetype() === 'relationship') {
155 155
                     $name = $f->getName();
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 'required' => true
246 246
             ]
247 247
         ];
248
-        $cardFieldNames = array_map(function (Field $f) {
248
+        $cardFieldNames = array_map(function(Field $f) {
249 249
             return $f->getName();
250 250
         }, $this->generator->getCardFields());
251 251
         $vueCode->setExtraProps($extraprops);
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $vueCode = $vue->getVueCode();
272 272
         // set basic data for vue
273 273
         $vueCode->setExtraProps([]);
274
-        $cardFieldNames = array_map(function (Field $f) {
274
+        $cardFieldNames = array_map(function(Field $f) {
275 275
             return $f->getName();
276 276
         }, $this->generator->getCardFields());
277 277
         foreach ($this->generator->getCardFields() as $f) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     public function vueTableItem(FrameworkVue $vue): void
305 305
     {
306 306
         $vueCode = $vue->getVueCode();
307
-        $tableFieldNames = array_map(function (Field $f) {
307
+        $tableFieldNames = array_map(function(Field $f) {
308 308
             return $f->getName();
309 309
         }, $this->generator->getTableFields());
310 310
         $vueCode->setExtraProps([]);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $vueCode->setExtraProps([]);
352 352
 
353 353
         $createGraphqlVariables = $this->generator->getModel()->mapFields(
354
-            function (Field $f) {
354
+            function(Field $f) {
355 355
                 if (!$f->getRenderable('form', true)) {
356 356
                     return null;
357 357
                 }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             $vue,
373 373
             'Form',
374 374
             'editable',
375
-            function (Field $f) {
375
+            function(Field $f) {
376 376
                 if (!$f->getExtradata('modelFillable')) {
377 377
                     return false;
378 378
                 }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
         if ($mode == 'editable') {
399 399
             $vue->setEditableTemplate(
400
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
400
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
401 401
                     return $this->generator->templateCallback($stub, $vue, $data, $m);
402 402
                 }
403 403
             );
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
             );
412 412
         } else {
413 413
             $vue->setViewableTemplate(
414
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
414
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
415 415
                     return $this->generator->templateCallback($stub, $vue, $data, $m);
416 416
                 }
417 417
             );
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $path = $this->generator->getModel()->getName() . '/index.js';
434 434
         $name = $this->generator->getStudlyName();
435 435
 
436
-        $contents = function ($basepath, $element) use ($name) {
436
+        $contents = function($basepath, $element) use ($name) {
437 437
             $dir = $basepath . '/' . $name;
438 438
             $import = [];
439 439
             $export = [];
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         $path = $this->generator->getModel()->getName() . '/index.dynamic.js';
464 464
         $name = $this->generator->getStudlyName();
465 465
 
466
-        $contents = function ($basepath, $element) use ($name) {
466
+        $contents = function($basepath, $element) use ($name) {
467 467
             $dir = $basepath . '/' . $name;
468 468
             $import = [];
469 469
             $export = [];
Please login to merge, or discard this patch.
Modelarium/Laravel/Targets/MigrationGenerator.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -172,28 +172,28 @@  discard block
 block discarded – undo
172 172
                 $fieldName,
173 173
                 'string',
174 174
                 [],
175
-                [ Datatype::REQUIRED => ['value' => $required ] ]
175
+                [Datatype::REQUIRED => ['value' => $required]]
176 176
             );
177 177
         } elseif ($type instanceof IntType) {
178 178
             $formulariumField = new Field(
179 179
                 $fieldName,
180 180
                 'integer',
181 181
                 [],
182
-                [ Datatype::REQUIRED => ['value' => $required ] ]
182
+                [Datatype::REQUIRED => ['value' => $required]]
183 183
             );
184 184
         } elseif ($type instanceof BooleanType) {
185 185
             $formulariumField = new Field(
186 186
                 $fieldName,
187 187
                 'boolean',
188 188
                 [],
189
-                [ Datatype::REQUIRED => ['value' => $required ] ]
189
+                [Datatype::REQUIRED => ['value' => $required]]
190 190
             );
191 191
         } elseif ($type instanceof FloatType) {
192 192
             $formulariumField = new Field(
193 193
                 $fieldName,
194 194
                 'float',
195 195
                 [],
196
-                [ Datatype::REQUIRED => ['value' => $required ] ]
196
+                [Datatype::REQUIRED => ['value' => $required]]
197 197
             );
198 198
         } elseif ($type instanceof EnumType) {
199 199
             $this->processEnum($field, $type, $codeFragment);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 $fieldName,
216 216
                 $ourType->getDatatype(),
217 217
                 [],
218
-                [ Datatype::REQUIRED => ['value' => $required ] ]
218
+                [Datatype::REQUIRED => ['value' => $required]]
219 219
             );
220 220
         } elseif ($type instanceof ListOfType) {
221 221
             throw new Exception("Invalid field type: " . get_class($type));
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 'enum',
274 274
                 'App\\Datatypes',
275 275
                 'Tests\\Unit',
276
-                function (ClassType $enumClass) use ($enumValues) {
276
+                function(ClassType $enumClass) use ($enumValues) {
277 277
                     $enumClass->addConstant('CHOICES', $enumValues);
278 278
                     $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;');
279 279
                 }
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             $this->getBasePath(
465 465
                 'database/migrations/' .
466 466
                 $this->stamp .
467
-                str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
467
+                str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
468 468
                 '_' . $this->mode . '_' .
469 469
                 $relation .
470 470
                 '_table.php'
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
             $this->getBasePath(
507 507
                 'database/migrations/' .
508 508
                 $this->stamp .
509
-                str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
509
+                str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
510 510
                 '_' . $this->mode . '_' .
511 511
                 $type1 . '_' . $type2 .
512 512
                 '_table.php'
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         return $this->getBasePath(
552 552
             'database/migrations/' .
553 553
             $this->stamp .
554
-            str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
554
+            str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema
555 555
             '_' . $this->mode . '_' .
556 556
             $basename . '_' .
557 557
             str_replace('_', '', $this->stamp) . '_' .
@@ -572,10 +572,10 @@  discard block
 block discarded – undo
572 572
             return true;
573 573
         }
574 574
         $tokens = token_get_all($this->lastMigrationCode);
575
-        for ($i=0, $z=count($tokens); $i < $z; $i++) {
575
+        for ($i = 0, $z = count($tokens); $i < $z; $i++) {
576 576
             if (is_array($tokens[$i]) && $tokens[$i][0] === T_FUNCTION
577
-                && is_array($tokens[$i+1]) && $tokens[$i+1][0] == T_WHITESPACE
578
-                && is_array($tokens[$i+2]) && $tokens[$i+2][1] == 'up'
577
+                && is_array($tokens[$i + 1]) && $tokens[$i + 1][0] == T_WHITESPACE
578
+                && is_array($tokens[$i + 2]) && $tokens[$i + 2][1] == 'up'
579 579
             ) {
580 580
                 $accumulator = [];
581 581
                 $braceDepth = 0;
Please login to merge, or discard this patch.
Modelarium/Frontend/FrontendGenerator.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -155,17 +155,17 @@  discard block
 block discarded – undo
155 155
     public function buildTemplateParameters(): void
156 156
     {
157 157
         $this->titleFields = $this->fModel->filterField(
158
-            function (Field $field) {
158
+            function(Field $field) {
159 159
                 return $field->getRenderable('title', false);
160 160
             }
161 161
         );
162 162
         $this->cardFields = $this->fModel->filterField(
163
-            function (Field $field) {
163
+            function(Field $field) {
164 164
                 return $field->getRenderable('card', false);
165 165
             }
166 166
         );
167 167
         $this->tableFields = $this->fModel->filterField(
168
-            function (Field $field) {
168
+            function(Field $field) {
169 169
                 return $field->getRenderable('table', false);
170 170
             }
171 171
         );
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 ],
180 180
             ]
181 181
         )->setContent(
182
-            '<i class="fa fa-plus"></i> '  . $this->getOptions()->getOption('frontend', 'messages')['addNew'],
182
+            '<i class="fa fa-plus"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['addNew'],
183 183
             true,
184 184
             true
185 185
         )->getRenderHTML();
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             'Table',
222 222
             [
223 223
                 Table::ROW_NAMES => array_map(
224
-                    function (Field $field) {
224
+                    function(Field $field) {
225 225
                         return $field->getRenderable(Renderable::LABEL, $field->getName());
226 226
                     },
227 227
                     $this->tableFields
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
             $t->appendContent('<slot name="extraHeaders" :props="$props"></slot>', true);
247 247
         }
248 248
         $titleFields = $this->fModel->filterField(
249
-            function (Field $field) {
249
+            function(Field $field) {
250 250
                 return $field->getRenderable('title', false);
251 251
             }
252 252
         );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             'spinner' => $spinner,
274 274
             'routeBase' => $this->getRouteBase(),
275 275
             'tablelist' => $table->getRenderHTML(),
276
-            'tableItemFields' => array_keys(array_map(function (Field $f) {
276
+            'tableItemFields' => array_keys(array_map(function(Field $f) {
277 277
                 return $f->getName();
278 278
             }, $this->tableFields)),
279 279
             'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName),
@@ -351,13 +351,13 @@  discard block
 block discarded – undo
351 351
                     $filters[] = [
352 352
                         'name' => $arg->name,
353 353
                         'type' => $typename,
354
-                        'graphqlType' =>  $arg->name  . ': ' .
354
+                        'graphqlType' =>  $arg->name . ': ' .
355 355
                             ($isArray ? '[' : '') .
356 356
                             $typename .
357 357
                             $isInternalRequiredString . // TODO: phpstan complains, issue with graphqlphp ($isInternalRequired ? '!' : '') .
358 358
                             ($isArray ? ']' : '') .
359 359
                             ($isRequired ? '!' : ''),
360
-                        'required' => (bool)$isRequired,
360
+                        'required' => (bool) $isRequired,
361 361
                         'requiredJSBoolean' => $isRequired ? 'true' : 'false'
362 362
                     ];
363 363
                 }
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
          * card
376 376
          */
377 377
         $cardFieldNames = array_map(
378
-            function (Field $field) {
378
+            function(Field $field) {
379 379
                 return $field->getName();
380 380
             },
381 381
             $this->cardFields
382 382
         );
383 383
         $graphqlQuery = $this->fModel->mapFields(
384
-            function (Field $f) use ($cardFieldNames, $gcg) {
384
+            function(Field $f) use ($cardFieldNames, $gcg) {
385 385
                 if (in_array($f->getName(), $cardFieldNames)) {
386 386
                     // TODO: filter subfields in relationships
387 387
                     return $gcg->field($f);
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $filtersQuery = ', ' . join(
398 398
                 ', ',
399 399
                 array_map(
400
-                    function ($item) {
400
+                    function($item) {
401 401
                         // TODO: still buggy, misses the internal ! in [Xyz!]!
402 402
                         return '$' . $item['graphqlType'];
403 403
                     },
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $filtersParams = ', ' . join(
408 408
                 ', ',
409 409
                 array_map(
410
-                    function ($item) {
410
+                    function($item) {
411 411
                         return $item['name'] . ': $' . $item['name'];
412 412
                     },
413 413
                     $filters
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
          * table
447 447
          */
448 448
         $tableFieldNames = array_map(
449
-            function (Field $field) {
449
+            function(Field $field) {
450 450
                 return $field->getName();
451 451
             },
452 452
             $this->tableFields
453 453
         );
454 454
 
455 455
         $graphqlQuery = $this->fModel->mapFields(
456
-            function (Field $f) use ($tableFieldNames, $gcg) {
456
+            function(Field $f) use ($tableFieldNames, $gcg) {
457 457
                 if (in_array($f->getName(), $tableFieldNames)) {
458 458
                     // TODO: filter subfields in relationships
459 459
                     return $gcg->field($f);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
          * item
494 494
          */
495 495
         $graphqlQuery = $this->fModel->mapFields(
496
-            function (Field $f) use ($gcg) {
496
+            function(Field $f) use ($gcg) {
497 497
                 return \Modelarium\Frontend\Util::fieldShow($f) ? $gcg->field($f) : null;
498 498
             }
499 499
         );
Please login to merge, or discard this patch.
LaravelEloquent/DatatypeGenerator/DatatypeGenerator_relationship.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
             ($field->getValidatorOption(Datatype::REQUIRED, 'value', false) ? '' : '->nullable()');
22 22
         // $index = '' $field->getRenderable('index')....
23 23
         return [
24
-          $id
24
+            $id
25 25
         ];
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
CodeGenerator/GraphQL/DatatypeGenerator/DatatypeGenerator_relationship.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 $graphqlQuery = array_merge(
82 82
                     $graphqlQuery,
83 83
                     $formulariumModel->mapFields(
84
-                        function (Field $f) { // use ($recurseLevel) {
84
+                        function(Field $f) { // use ($recurseLevel) {
85 85
                             $type = $f->getDatatype();
86 86
                             if ($type instanceof Datatype_relationship && !$type->getIsInverse()) {
87 87
                                 return '';
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
              */
99 99
             $formulariumModel = call_user_func("$model::getFormularium"); /** @phpstan-ignore-line */
100 100
             $graphqlQuery = $formulariumModel->mapFields(
101
-                function (Field $f) { // use ($recurseLevel) {
101
+                function(Field $f) { // use ($recurseLevel) {
102 102
                     return \Modelarium\Frontend\Util::fieldShow($f) ? /* $f->toGraphqlQuery([self::RECURSE => $recurseLevel-1]) */ 'zzz' : null;
103 103
                 }
104 104
             );
Please login to merge, or discard this patch.
Modelarium/Laravel/Targets/SeedGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         }
50 50
 
51 51
         return new GeneratedCollection(
52
-            [ new GeneratedItem(
52
+            [new GeneratedItem(
53 53
                 GeneratedItem::TYPE_SEED,
54 54
                 $this->generateString(),
55 55
                 $this->getGenerateFilename()
@@ -76,6 +76,6 @@  discard block
 block discarded – undo
76 76
             $seedDirectoryName = 'seeders';
77 77
         }
78 78
 
79
-        return $this->getBasePath('database/' . $seedDirectoryName . '/'. $this->studlyName . 'Seeder.php');
79
+        return $this->getBasePath('database/' . $seedDirectoryName . '/' . $this->studlyName . 'Seeder.php');
80 80
     }
81 81
 }
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/MorphedByManyDirective.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
              * @var ObjectType $object
96 96
              */
97 97
 
98
-            if (str_starts_with((string)$name, '__')) {
98
+            if (str_starts_with((string) $name, '__')) {
99 99
                 // internal type
100 100
                 continue;
101 101
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     continue;
108 108
                 }
109 109
 
110
-                $methodName = lcfirst($generator->getInflector()->pluralize((string)$name));
110
+                $methodName = lcfirst($generator->getInflector()->pluralize((string) $name));
111 111
                 $generator->class->addMethod($methodName)
112 112
                         ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany')
113 113
                         ->setPublic()
Please login to merge, or discard this patch.
Modelarium/Laravel/Directives/EagerLoadDirective.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,18 +59,18 @@
 block discarded – undo
59 59
             $targetSingle = lcfirst($generator->getInflector()->singularize($datatype->getTarget()));
60 60
             $targetPlural = $datatype->getTargetTable();
61 61
             switch ($datatype->getRelationship()) {
62
-                case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE:
63
-                case RelationshipFactory::MORPH_ONE_TO_ONE:
64
-                    $target = $targetSingle;
65
-                    break;
66
-                case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY:
67
-                case RelationshipFactory::MORPH_ONE_TO_MANY:
68
-                    $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural;
69
-                    break;
70
-                case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY:
71
-                case RelationshipFactory::MORPH_MANY_TO_MANY:
72
-                    $target = $targetPlural;
73
-                    break;
62
+            case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE:
63
+            case RelationshipFactory::MORPH_ONE_TO_ONE:
64
+                $target = $targetSingle;
65
+                break;
66
+            case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY:
67
+            case RelationshipFactory::MORPH_ONE_TO_MANY:
68
+                $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural;
69
+                break;
70
+            case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY:
71
+            case RelationshipFactory::MORPH_MANY_TO_MANY:
72
+                $target = $targetPlural;
73
+                break;
74 74
             }
75 75
         }
76 76
         $generator->with[] = $target;
Please login to merge, or discard this patch.