@@ -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; |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | 'enum', |
| 206 | 206 | 'App\\Datatypes', |
| 207 | 207 | 'Tests\\Unit', |
| 208 | - function (ClassType $enumClass) use ($enumValues) { |
|
| 208 | + function(ClassType $enumClass) use ($enumValues) { |
|
| 209 | 209 | $enumClass->addConstant('CHOICES', $enumValues); |
| 210 | 210 | $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;'); |
| 211 | 211 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $options = []; // TODO: from directives |
| 256 | - $codeFragment->appendBase('$table->' . $ourType->getLaravelSQLType($fieldName, $options)); |
|
| 256 | + $codeFragment->appendBase('$table->' . $ourType->getLaravelSQLType($fieldName, $options)); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | protected function processRelationship( |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $this->getBasePath( |
| 489 | 489 | 'database/migrations/' . |
| 490 | 490 | date('Y_m_d_His') . |
| 491 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 491 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 492 | 492 | '_' . $this->mode . '_' . |
| 493 | 493 | $relation . |
| 494 | 494 | '_table.php' |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $this->getBasePath( |
| 529 | 529 | 'database/migrations/' . |
| 530 | 530 | date('Y_m_d_His') . |
| 531 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 531 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 532 | 532 | '_' . $this->mode . '_' . |
| 533 | 533 | $type1 . '_' . $type2 . |
| 534 | 534 | '_table.php' |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | return $this->getBasePath( |
| 574 | 574 | 'database/migrations/' . |
| 575 | 575 | date('Y_m_d_His') . |
| 576 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 576 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 577 | 577 | '_' . $this->mode . '_' . |
| 578 | 578 | $basename . '_table.php' |
| 579 | 579 | ); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param string[] $directiveNamespaces |
| 78 | 78 | * @return array<string, string> |
| 79 | 79 | */ |
| 80 | - public static function getDirectivesGraphql($directiveNamespaces = [ 'Modelarium\Laravel\Lighthouse\Directives' ]): array |
|
| 80 | + public static function getDirectivesGraphql($directiveNamespaces = ['Modelarium\Laravel\Lighthouse\Directives']): array |
|
| 81 | 81 | { |
| 82 | 82 | $directives = []; |
| 83 | 83 | |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | foreach ($classesInNamespace as $class) { |
| 89 | 89 | $reflection = new \ReflectionClass($class); |
| 90 | - if (! $reflection->isInstantiable()) { |
|
| 90 | + if (!$reflection->isInstantiable()) { |
|
| 91 | 91 | continue; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
| 94 | + if (!is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $name = DirectiveFactory::directiveName((string)$class); |
|
| 98 | + $name = DirectiveFactory::directiveName((string) $class); |
|
| 99 | 99 | // @phpstan-ignore-next-line |
| 100 | 100 | $directives[$name] = trim($class::definition()); |
| 101 | 101 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param string[] $directiveNamespaces |
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | - public static function getDirectivesGraphqlString($directiveNamespaces = [ 'Modelarium\\Laravel\\Lighthouse\\Directives' ]): string |
|
| 113 | + public static function getDirectivesGraphqlString($directiveNamespaces = ['Modelarium\\Laravel\\Lighthouse\\Directives']): string |
|
| 114 | 114 | { |
| 115 | 115 | return implode("\n\n", self::getDirectivesGraphql($directiveNamespaces)); |
| 116 | 116 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if ($name === 'Query' || $name === 'Mutation' || $name === 'Subscription' || $name === 'Can') { |
| 168 | 168 | continue; |
| 169 | 169 | } |
| 170 | - $g = $this->processType((string)$name, $object); |
|
| 170 | + $g = $this->processType((string) $name, $object); |
|
| 171 | 171 | $this->collection = $this->collection->merge($g); |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -67,10 +67,10 @@ |
||
| 67 | 67 | $targetDirectives = $targetField->astNode->directives; |
| 68 | 68 | foreach ($targetDirectives as $targetDirective) { |
| 69 | 69 | switch ($targetDirective->name->value) { |
| 70 | - case 'hasOne': |
|
| 71 | - case 'hasMany': |
|
| 72 | - $codeFragment->appendBase('->unsignedBigInteger("' . $fieldName . '")'); |
|
| 73 | - break; |
|
| 70 | + case 'hasOne': |
|
| 71 | + case 'hasMany': |
|
| 72 | + $codeFragment->appendBase('->unsignedBigInteger("' . $fieldName . '")'); |
|
| 73 | + break; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $writtenFiles = $this->writeFiles( |
| 145 | 145 | $collection, |
| 146 | 146 | $basepath, |
| 147 | - function (GeneratedItem $i) { |
|
| 148 | - if ((bool)$this->option('overwrite') === true) { |
|
| 147 | + function(GeneratedItem $i) { |
|
| 148 | + if ((bool) $this->option('overwrite') === true) { |
|
| 149 | 149 | return true; |
| 150 | 150 | } |
| 151 | - if ((bool)$this->option('overwrite-graphql') === true) { |
|
| 151 | + if ((bool) $this->option('overwrite-graphql') === true) { |
|
| 152 | 152 | if ( |
| 153 | 153 | StringUtil::endsWith($i->filename, '.graphql') |
| 154 | 154 | ) { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | // this runs all prettier commands in parallel. |
| 182 | 182 | $run = array_reduce( |
| 183 | 183 | $writtenFiles, |
| 184 | - function ($carry, $f) use ($command) { |
|
| 184 | + function($carry, $f) use ($command) { |
|
| 185 | 185 | return $carry . '(' . $command . $f . ') & '; |
| 186 | 186 | } |
| 187 | 187 | ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $vue, |
| 69 | 69 | 'Form', |
| 70 | 70 | 'editable', |
| 71 | - function (Field $f) { |
|
| 71 | + function(Field $f) { |
|
| 72 | 72 | if (!$f->getExtradata('modelFillable')) { |
| 73 | 73 | return false; |
| 74 | 74 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | 'required' => true |
| 156 | 156 | ] |
| 157 | 157 | ]; |
| 158 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 158 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 159 | 159 | return $f->getName(); |
| 160 | 160 | }, $this->generator->getCardFields()); |
| 161 | 161 | $vueCode->setExtraProps($extraprops); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | ] |
| 184 | 184 | ]; |
| 185 | 185 | $vueCode->setExtraProps($extraprops); |
| 186 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 186 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 187 | 187 | return $f->getName(); |
| 188 | 188 | }, $this->generator->getCardFields()); |
| 189 | 189 | foreach ($this->generator->getCardFields() as $f) { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function vueTableItem(FrameworkVue $vue): void |
| 201 | 201 | { |
| 202 | 202 | $vueCode = $vue->getVueCode(); |
| 203 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 203 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 204 | 204 | return $f->getName(); |
| 205 | 205 | }, $this->generator->getTableFields()); |
| 206 | 206 | $extraprops = [ |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | if ($mode == 'editable') { |
| 244 | 244 | $vue->setEditableTemplate( |
| 245 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 245 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 246 | 246 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 247 | 247 | } |
| 248 | 248 | ); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | } else { |
| 258 | 258 | $vue->setViewableTemplate( |
| 259 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 259 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 260 | 260 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 261 | 261 | } |
| 262 | 262 | ); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | ]; |
| 289 | 289 | |
| 290 | 290 | $import = array_map( |
| 291 | - function ($i) use ($name) { |
|
| 291 | + function($i) use ($name) { |
|
| 292 | 292 | return "import {$name}$i from './{$name}$i.vue';"; |
| 293 | 293 | }, |
| 294 | 294 | $items |
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | $export = array_map( |
| 298 | - function ($i) use ($name) { |
|
| 298 | + function($i) use ($name) { |
|
| 299 | 299 | return " {$name}$i,\n"; |
| 300 | 300 | }, |
| 301 | 301 | $items |