@@ -26,9 +26,9 @@ |
||
| 26 | 26 | $value = $arg->value->value; |
| 27 | 27 | |
| 28 | 28 | switch ($arg->name->value) { |
| 29 | - case 'class': |
|
| 30 | - $generator->parentClassName = $value; |
|
| 31 | - break; |
|
| 29 | + case 'class': |
|
| 30 | + $generator->parentClassName = $value; |
|
| 31 | + break; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public static function processModelFieldDirective( |
| 17 | 17 | ModelGenerator $generator, |
| 18 | 18 | \GraphQL\Type\Definition\FieldDefinition $field, |
| 19 | - \Formularium\Field $fieldFormularium, |
|
| 19 | + \Formularium\Field $fieldFormularium, |
|
| 20 | 20 | \GraphQL\Language\AST\DirectiveNode $directive |
| 21 | 21 | ): void { |
| 22 | 22 | foreach ($directive->arguments as $arg) { |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | MigrationGenerator $generator, |
| 15 | 15 | \GraphQL\Language\AST\DirectiveNode $directive |
| 16 | 16 | ): void { |
| 17 | - $generator->createCode[] ='$table->timestamps();'; |
|
| 17 | + $generator->createCode[] = '$table->timestamps();'; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public static function processMigrationFieldDirective( |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public static function processModelFieldDirective( |
| 36 | 36 | ModelGenerator $generator, |
| 37 | 37 | \GraphQL\Type\Definition\FieldDefinition $field, |
| 38 | - \Formularium\Field $fieldFormularium, |
|
| 38 | + \Formularium\Field $fieldFormularium, |
|
| 39 | 39 | \GraphQL\Language\AST\DirectiveNode $directive |
| 40 | 40 | ): void { |
| 41 | 41 | // nothing |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | \GraphQL\Language\AST\DirectiveNode $directive |
| 16 | 16 | ): void { |
| 17 | 17 | /** @phpstan-ignore-next-line */ |
| 18 | - $generator->createCode[] = '$table->spatialIndex("' . $directive->arguments[0]->value->value .'");'; |
|
| 18 | + $generator->createCode[] = '$table->spatialIndex("' . $directive->arguments[0]->value->value . '");'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function processMigrationFieldDirective( |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public static function processModelFieldDirective( |
| 37 | 37 | ModelGenerator $generator, |
| 38 | 38 | \GraphQL\Type\Definition\FieldDefinition $field, |
| 39 | - \Formularium\Field $fieldFormularium, |
|
| 39 | + \Formularium\Field $fieldFormularium, |
|
| 40 | 40 | \GraphQL\Language\AST\DirectiveNode $directive |
| 41 | 41 | ): void { |
| 42 | 42 | // nothing |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | 'enum', |
| 161 | 161 | 'App\\Datatypes', |
| 162 | 162 | 'Tests\\Unit', |
| 163 | - function (ClassType $enumClass) use ($enumValues) { |
|
| 163 | + function(ClassType $enumClass) use ($enumValues) { |
|
| 164 | 164 | $enumClass->addConstant('CHOICES', $enumValues); |
| 165 | 165 | $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;'); |
| 166 | 166 | } |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | $this->getBasePath( |
| 465 | 465 | 'database/migrations/' . |
| 466 | 466 | date('Y_m_d_His') . |
| 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' |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $this->getBasePath( |
| 505 | 505 | 'database/migrations/' . |
| 506 | 506 | date('Y_m_d_His') . |
| 507 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 507 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 508 | 508 | '_' . $this->mode . '_' . |
| 509 | 509 | $type1 . '_' . $type2 . |
| 510 | 510 | '_table.php' |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | return $this->getBasePath( |
| 550 | 550 | 'database/migrations/' . |
| 551 | 551 | date('Y_m_d_His') . |
| 552 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 552 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 553 | 553 | '_' . $this->mode . '_' . |
| 554 | 554 | $basename . '_table.php' |
| 555 | 555 | ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @var ObjectType $object |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | - if (str_starts_with((string)$name, '__')) { |
|
| 64 | + if (str_starts_with((string) $name, '__')) { |
|
| 65 | 65 | // internal type |
| 66 | 66 | continue; |
| 67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | continue; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $methodName = $generator->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
| 76 | + $methodName = $generator->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
| 77 | 77 | $generator->class->addMethod($methodName) |
| 78 | 78 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
| 79 | 79 | ->setPublic() |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public static function processModelFieldDirective( |
| 25 | 25 | ModelGenerator $generator, |
| 26 | 26 | \GraphQL\Type\Definition\FieldDefinition $field, |
| 27 | - \Formularium\Field $fieldFormularium, |
|
| 27 | + \Formularium\Field $fieldFormularium, |
|
| 28 | 28 | \GraphQL\Language\AST\DirectiveNode $directive |
| 29 | 29 | ): void { |
| 30 | 30 | // nothing |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | if ($vue !== null) { |
| 121 | 121 | // build the fields for cards and tables |
| 122 | 122 | $vueCode = $vue->getVueCode(); |
| 123 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 123 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 124 | 124 | return $f->getName(); |
| 125 | 125 | }, $this->cardFields); |
| 126 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 126 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 127 | 127 | return $f->getName(); |
| 128 | 128 | }, $this->tableFields); |
| 129 | 129 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $vue, |
| 175 | 175 | 'Form', |
| 176 | 176 | 'editable', |
| 177 | - function (Field $f) { |
|
| 177 | + function(Field $f) { |
|
| 178 | 178 | if (!$f->getExtradata('modelFillable')) { |
| 179 | 179 | return false; |
| 180 | 180 | } |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | $hasVue = $this->composer->getByName('Vue'); |
| 245 | 245 | |
| 246 | 246 | $this->cardFields = $this->model->filterField( |
| 247 | - function (Field $field) { |
|
| 247 | + function(Field $field) { |
|
| 248 | 248 | return $field->getRenderable('card', false); |
| 249 | 249 | } |
| 250 | 250 | ); |
| 251 | 251 | $this->tableFields = $this->model->filterField( |
| 252 | - function (Field $field) { |
|
| 252 | + function(Field $field) { |
|
| 253 | 253 | return $field->getRenderable('table', false); |
| 254 | 254 | } |
| 255 | 255 | ); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | Button::TYPE => 'a', |
| 261 | 261 | Button::ATTRIBUTES => [ |
| 262 | 262 | 'href' => "/{$this->routeBase}/edit" |
| 263 | - ] + ($hasVue ? [ "v-if" => 'can.create' ]: []), |
|
| 263 | + ] + ($hasVue ? ["v-if" => 'can.create'] : []), |
|
| 264 | 264 | ] |
| 265 | 265 | )->setContent( |
| 266 | 266 | '<i class="fa fa-plus"></i> Add new', |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | Button::TYPE => ($hasVue ? 'router-link' : 'a'), |
| 275 | 275 | Button::ATTRIBUTES => [ |
| 276 | 276 | ':to' => "'/{$this->lowerName}/' + model.{$this->keyAttribute} + '/edit'" |
| 277 | - ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []), |
|
| 277 | + ] + ($hasVue ? ["v-if" => 'can.edit'] : []), |
|
| 278 | 278 | ] |
| 279 | 279 | )->setContent( |
| 280 | 280 | '<i class="fa fa-pencil"></i> Edit', |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | Button::ATTRIBUTES => [ |
| 291 | 291 | 'href' => '#', |
| 292 | 292 | '@click.prevent' => 'remove' |
| 293 | - ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []), |
|
| 293 | + ] + ($hasVue ? ["v-if" => 'can.delete'] : []), |
|
| 294 | 294 | ] |
| 295 | 295 | )->setContent( |
| 296 | 296 | '<i class="fa fa-trash"></i> Delete', |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | 'Table', |
| 306 | 306 | [ |
| 307 | 307 | Table::ROW_NAMES => array_map( |
| 308 | - function (Field $field) { |
|
| 308 | + function(Field $field) { |
|
| 309 | 309 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
| 310 | 310 | }, |
| 311 | 311 | $this->tableFields |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | true |
| 324 | 324 | ); |
| 325 | 325 | $titleFields = $this->model->filterField( |
| 326 | - function (Field $field) { |
|
| 326 | + function(Field $field) { |
|
| 327 | 327 | return $field->getRenderable('title', false); |
| 328 | 328 | } |
| 329 | 329 | ); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | 'keyAttribute' => $this->keyAttribute, |
| 350 | 350 | 'spinner' => $spinner, |
| 351 | 351 | 'tablelist' => $table->getRenderHTML(), |
| 352 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
| 352 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
| 353 | 353 | return $f->getName(); |
| 354 | 354 | }, $this->tableFields)), |
| 355 | 355 | 'typeTitle' => $this->studlyName, |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | if ($mode == 'editable') { |
| 401 | 401 | $vue->setEditableTemplate( |
| 402 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 402 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 403 | 403 | return $this->templateCallback($stub, $vue, $data, $m); |
| 404 | 404 | } |
| 405 | 405 | ); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | ); |
| 414 | 414 | } else { |
| 415 | 415 | $vue->setViewableTemplate( |
| 416 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 416 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 417 | 417 | return $this->templateCallback($stub, $vue, $data, $m); |
| 418 | 418 | } |
| 419 | 419 | ); |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * card |
| 489 | 489 | */ |
| 490 | 490 | $cardFieldNames = array_map( |
| 491 | - function (Field $field) { |
|
| 491 | + function(Field $field) { |
|
| 492 | 492 | return $field->getName(); |
| 493 | 493 | }, |
| 494 | 494 | $this->cardFields |
@@ -501,8 +501,8 @@ discard block |
||
| 501 | 501 | $filtersQuery = ', ' . join( |
| 502 | 502 | ', ', |
| 503 | 503 | array_map( |
| 504 | - function ($item) { |
|
| 505 | - return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
| 504 | + function($item) { |
|
| 505 | + return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
| 506 | 506 | }, |
| 507 | 507 | $filters |
| 508 | 508 | ) |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $filtersParams = ', ' . join( |
| 511 | 511 | ', ', |
| 512 | 512 | array_map( |
| 513 | - function ($item) { |
|
| 513 | + function($item) { |
|
| 514 | 514 | return $item['name'] . ': $' . $item['name']; |
| 515 | 515 | }, |
| 516 | 516 | $filters |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | * table |
| 550 | 550 | */ |
| 551 | 551 | $tableFieldNames = array_map( |
| 552 | - function (Field $field) { |
|
| 552 | + function(Field $field) { |
|
| 553 | 553 | return $field->getName(); |
| 554 | 554 | }, |
| 555 | 555 | $this->tableFields |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | * item |
| 586 | 586 | */ |
| 587 | 587 | $graphqlQuery = $this->model->mapFields( |
| 588 | - function (Field $f) { |
|
| 588 | + function(Field $f) { |
|
| 589 | 589 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
| 590 | 590 | } |
| 591 | 591 | ); |
@@ -662,14 +662,14 @@ discard block |
||
| 662 | 662 | ]; |
| 663 | 663 | |
| 664 | 664 | $import = array_map( |
| 665 | - function ($i) use ($name) { |
|
| 665 | + function($i) use ($name) { |
|
| 666 | 666 | return "import {$name}$i from './{$name}$i.vue';"; |
| 667 | 667 | }, |
| 668 | 668 | $items |
| 669 | 669 | ); |
| 670 | 670 | |
| 671 | 671 | $export = array_map( |
| 672 | - function ($i) use ($name) { |
|
| 672 | + function($i) use ($name) { |
|
| 673 | 673 | return " {$name}$i,\n"; |
| 674 | 674 | }, |
| 675 | 675 | $items |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public static function getGeneratorDirectiveNamespaces(): array |
| 37 | 37 | { |
| 38 | 38 | return array_map( |
| 39 | - function ($i) { |
|
| 39 | + function($i) { |
|
| 40 | 40 | return $i . '\\Laravel\\Directives'; |
| 41 | 41 | }, |
| 42 | 42 | self::$directiveLaravelLibraries |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public static function getGeneratorLighthouseDirectiveNamespaces(): array |
| 52 | 52 | { |
| 53 | 53 | return array_map( |
| 54 | - function ($i) { |
|
| 54 | + function($i) { |
|
| 55 | 55 | return $i . '\\Laravel\\Lighthouse\\Directives'; |
| 56 | 56 | }, |
| 57 | 57 | self::$directiveLaravelLibraries |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $graphqlQuery = array_merge( |
| 84 | 84 | $graphqlQuery, |
| 85 | 85 | $formulariumModel->mapFields( |
| 86 | - function (Field $f) use ($recurseLevel) { |
|
| 86 | + function(Field $f) use ($recurseLevel) { |
|
| 87 | 87 | $type = $f->getDatatype(); |
| 88 | 88 | if ($type instanceof Datatype_relationship && !$type->getIsInverse()) { |
| 89 | 89 | return ''; |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | $formulariumModel = call_user_func("$model::getFormularium"); /** @phpstan-ignore-line */ |
| 102 | 102 | $graphqlQuery = $formulariumModel->mapFields( |
| 103 | - function (Field $f) use ($recurseLevel) { |
|
| 104 | - return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery([self::RECURSE => $recurseLevel-1]) : null; |
|
| 103 | + function(Field $f) use ($recurseLevel) { |
|
| 104 | + return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery([self::RECURSE => $recurseLevel - 1]) : null; |
|
| 105 | 105 | } |
| 106 | 106 | ); |
| 107 | 107 | array_unshift($graphqlQuery, 'id'); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public static function processModelFieldDirective( |
| 17 | 17 | ModelGenerator $generator, |
| 18 | 18 | \GraphQL\Type\Definition\FieldDefinition $field, |
| 19 | - \Formularium\Field $fieldFormularium, |
|
| 19 | + \Formularium\Field $fieldFormularium, |
|
| 20 | 20 | \GraphQL\Language\AST\DirectiveNode $directive |
| 21 | 21 | ): void { |
| 22 | 22 | $fieldName = $field->name; |