@@ -34,24 +34,24 @@ |
||
| 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 = (string)$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 = (string)$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 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | switch ($arg->name->value) { |
| 37 | 37 | case 'ability': |
| 38 | 38 | // @phpstan-ignore-next-line |
| 39 | - $ability = (string)$arg->value->value; |
|
| 39 | + $ability = (string) $arg->value->value; |
|
| 40 | 40 | break; |
| 41 | 41 | case 'find': |
| 42 | 42 | // @phpstan-ignore-next-line |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | $value = $arg->value->value; |
| 21 | 21 | |
| 22 | 22 | switch ($arg->name->value) { |
| 23 | - case 'class': |
|
| 24 | - $generator->parentClassName = (string)$value; |
|
| 25 | - break; |
|
| 23 | + case 'class': |
|
| 24 | + $generator->parentClassName = (string)$value; |
|
| 25 | + break; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | switch ($arg->name->value) { |
| 23 | 23 | case 'class': |
| 24 | - $generator->parentClassName = (string)$value; |
|
| 24 | + $generator->parentClassName = (string) $value; |
|
| 25 | 25 | break; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'enum', |
| 213 | 213 | 'App\\Datatypes', |
| 214 | 214 | 'Tests\\Unit', |
| 215 | - function (ClassType $enumClass) use ($enumValues) { |
|
| 215 | + function(ClassType $enumClass) use ($enumValues) { |
|
| 216 | 216 | $enumClass->addConstant('CHOICES', $enumValues); |
| 217 | 217 | $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;'); |
| 218 | 218 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $options = []; // TODO: from directives |
| 264 | - $codeFragment->appendBase('$table->' . $ourType->getLaravelSQLType($fieldName, $options)); |
|
| 264 | + $codeFragment->appendBase('$table->' . $ourType->getLaravelSQLType($fieldName, $options)); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $this->getBasePath( |
| 392 | 392 | 'database/migrations/' . |
| 393 | 393 | date('Y_m_d_His') . |
| 394 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 394 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 395 | 395 | '_' . $this->mode . '_' . |
| 396 | 396 | $relation . |
| 397 | 397 | '_table.php' |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $this->getBasePath( |
| 432 | 432 | 'database/migrations/' . |
| 433 | 433 | date('Y_m_d_His') . |
| 434 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 434 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 435 | 435 | '_' . $this->mode . '_' . |
| 436 | 436 | $type1 . '_' . $type2 . |
| 437 | 437 | '_table.php' |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | return $this->getBasePath( |
| 477 | 477 | 'database/migrations/' . |
| 478 | 478 | date('Y_m_d_His') . |
| 479 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 479 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
| 480 | 480 | '_' . $this->mode . '_' . |
| 481 | 481 | $basename . '_table.php' |
| 482 | 482 | ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param string[] $directiveNamespaces |
| 79 | 79 | * @return array<string, string> |
| 80 | 80 | */ |
| 81 | - public static function getDirectivesGraphql($directiveNamespaces = [ 'Modelarium\Laravel\Lighthouse\Directives' ]): array |
|
| 81 | + public static function getDirectivesGraphql($directiveNamespaces = ['Modelarium\Laravel\Lighthouse\Directives']): array |
|
| 82 | 82 | { |
| 83 | 83 | $directives = []; |
| 84 | 84 | |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | foreach ($classesInNamespace as $class) { |
| 90 | 90 | $reflection = new \ReflectionClass($class); |
| 91 | - if (! $reflection->isInstantiable()) { |
|
| 91 | + if (!$reflection->isInstantiable()) { |
|
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (! is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
| 95 | + if (!is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
| 96 | 96 | continue; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $name = \Nuwave\Lighthouse\Schema\DirectiveLocator::directiveName((string)$class); |
|
| 99 | + $name = \Nuwave\Lighthouse\Schema\DirectiveLocator::directiveName((string) $class); |
|
| 100 | 100 | $directives[$name] = trim($class::definition()); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -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 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $originalTypeLoader = $this->schema->getConfig()->typeLoader; |
| 180 | 180 | |
| 181 | - $this->schema->getConfig()->typeLoader = function ($typeName) use ($originalTypeLoader) { |
|
| 181 | + $this->schema->getConfig()->typeLoader = function($typeName) use ($originalTypeLoader) { |
|
| 182 | 182 | $type = $originalTypeLoader($typeName); |
| 183 | 183 | if ($type instanceof \GraphQL\Type\Definition\CustomScalarType) { |
| 184 | 184 | $scalarName = $type->name; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | $this->ast = Visitor::visit($this->ast, [ |
| 195 | 195 | // load the scalar type classes |
| 196 | - NodeKind::SCALAR_TYPE_DEFINITION => function ($node) { |
|
| 196 | + NodeKind::SCALAR_TYPE_DEFINITION => function($node) { |
|
| 197 | 197 | $scalarName = $node->name->value; |
| 198 | 198 | |
| 199 | 199 | // load classes |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | switch ($arg->name->value) { |
| 208 | 208 | case 'class': |
| 209 | - $className = (string)$value; |
|
| 209 | + $className = (string) $value; |
|
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | return []; |
| 253 | 253 | } |
| 254 | 254 | return array_map( |
| 255 | - function ($i) use ($basedir) { |
|
| 255 | + function($i) use ($basedir) { |
|
| 256 | 256 | $name = $i[1]; |
| 257 | 257 | if (array_key_exists($name, $this->imports)) { |
| 258 | 258 | return $this->imports[$name]; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 133 | 133 | Button::ATTRIBUTES => [ |
| 134 | 134 | $targetAttribute => "/{$routeBase}/edit", |
| 135 | - ] + ($hasCan ? [ "v-if" => 'can(\'create\')' ]: []), |
|
| 135 | + ] + ($hasCan ? ["v-if" => 'can(\'create\')'] : []), |
|
| 136 | 136 | ] |
| 137 | 137 | )->setContent( |
| 138 | 138 | '<i class="fa fa-plus"></i> Add new', |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 147 | 147 | Button::ATTRIBUTES => [ |
| 148 | 148 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
| 149 | - ] + ($hasCan ? [ "v-if" => 'can(\'edit\')' ]: []), |
|
| 149 | + ] + ($hasCan ? ["v-if" => 'can(\'edit\')'] : []), |
|
| 150 | 150 | ] |
| 151 | 151 | )->setContent( |
| 152 | 152 | '<i class="fa fa-pencil"></i> Edit', |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | Button::ATTRIBUTES => [ |
| 163 | 163 | 'href' => '#', |
| 164 | 164 | '@click.prevent' => 'remove', |
| 165 | - ] + ($hasCan ? [ "v-if" => 'can(\'delete\')' ]: []), |
|
| 165 | + ] + ($hasCan ? ["v-if" => 'can(\'delete\')'] : []), |
|
| 166 | 166 | ] |
| 167 | 167 | )->setContent( |
| 168 | 168 | '<i class="fa fa-trash"></i> Delete', |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $this->generator->templateParameters['options'] = $this->options->getSection('vue'); |
| 183 | 183 | |
| 184 | 184 | $this->generator->templateParameters['tableItemFields'] = |
| 185 | - array_values(array_map(function (Field $f) { |
|
| 185 | + array_values(array_map(function(Field $f) { |
|
| 186 | 186 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
| 187 | 187 | $name = $f->getName(); |
| 188 | 188 | return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>"; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | 'required' => true |
| 278 | 278 | ] |
| 279 | 279 | ]; |
| 280 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 280 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 281 | 281 | return $f->getName(); |
| 282 | 282 | }, $this->generator->getCardFields()); |
| 283 | 283 | $vueCode->setExtraProps($extraprops); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $vueCode = $vue->getVueCode(); |
| 304 | 304 | // set basic data for vue |
| 305 | 305 | $vueCode->setExtraProps([]); |
| 306 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 306 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 307 | 307 | return $f->getName(); |
| 308 | 308 | }, $this->generator->getCardFields()); |
| 309 | 309 | foreach ($this->generator->getCardFields() as $f) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | public function vueTableItem(FrameworkVue $vue): void |
| 337 | 337 | { |
| 338 | 338 | $vueCode = $vue->getVueCode(); |
| 339 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 339 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 340 | 340 | return $f->getName(); |
| 341 | 341 | }, $this->generator->getTableFields()); |
| 342 | 342 | $vueCode->setExtraProps([]); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $vue, |
| 370 | 370 | 'Form', |
| 371 | 371 | 'editable', |
| 372 | - function (Field $f) { |
|
| 372 | + function(Field $f) { |
|
| 373 | 373 | if (!$f->getExtradata('modelFillable')) { |
| 374 | 374 | return false; |
| 375 | 375 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | if ($mode == 'editable') { |
| 396 | 396 | $vue->setEditableTemplate( |
| 397 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 397 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 398 | 398 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 399 | 399 | } |
| 400 | 400 | ); |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | ); |
| 409 | 409 | } else { |
| 410 | 410 | $vue->setViewableTemplate( |
| 411 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 411 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 412 | 412 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 413 | 413 | } |
| 414 | 414 | ); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $path = $this->generator->getModel()->getName() . '/index.js'; |
| 431 | 431 | $name = $this->generator->getStudlyName(); |
| 432 | 432 | |
| 433 | - $contents = function ($basepath, $element) use ($name) { |
|
| 433 | + $contents = function($basepath, $element) use ($name) { |
|
| 434 | 434 | $dir = $basepath . '/' . $name; |
| 435 | 435 | $import = []; |
| 436 | 436 | $export = []; |