Passed
Push — master ( 04c25a...2ea954 )
by Bruno
06:15
created
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.