@@ -19,7 +19,7 @@ |
||
| 19 | 19 | if (!count($indexFields)) { |
| 20 | 20 | throw new Exception("You must provide at least one field to an index"); |
| 21 | 21 | } |
| 22 | - $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) .'"]);'; |
|
| 22 | + $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) . '"]);'; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function processMigrationFieldDirective( |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | if (!count($indexFields)) { |
| 57 | 57 | throw new Exception("You must provide at least one field to an index on a model"); |
| 58 | 58 | } |
| 59 | - $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) .'"]);'; |
|
| 59 | + $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) . '"]);'; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public static function processMigrationFieldDirective( |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | $name = $directive->name->value; |
| 42 | 42 | |
| 43 | 43 | switch ($name) { |
| 44 | - case 'belongToMany': |
|
| 45 | - case 'morphedByMany': |
|
| 46 | - throw new DirectiveException("Foreign keys cannot be used with many-to-many-relationships. Check field: " . $field->name); |
|
| 44 | + case 'belongToMany': |
|
| 45 | + case 'morphedByMany': |
|
| 46 | + throw new DirectiveException("Foreign keys cannot be used with many-to-many-relationships. Check field: " . $field->name); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | } |
| 25 | 25 | $generator->postCreateCode[] = |
| 26 | 26 | "if (!App::environment('testing')) { |
| 27 | - DB::statement('ALTER TABLE " . $generator->getTableName() . |
|
| 27 | + DB::statement('ALTER TABLE " . $generator->getTableName() . |
|
| 28 | 28 | " ADD FULLTEXT fulltext_index (`" . implode('`, `', $indexFields) . "`)'); |
| 29 | 29 | }"; |
| 30 | 30 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | $writtenFiles = $this->writeFiles( |
| 157 | 157 | $collection, |
| 158 | 158 | $basepath, |
| 159 | - function (GeneratedItem $i) use ($match) { |
|
| 160 | - if ((bool)$this->option('overwrite') === true) { |
|
| 159 | + function(GeneratedItem $i) use ($match) { |
|
| 160 | + if ((bool) $this->option('overwrite') === true) { |
|
| 161 | 161 | return true; |
| 162 | 162 | } |
| 163 | - if ((bool)$this->option('overwrite-graphql') === true) { |
|
| 163 | + if ((bool) $this->option('overwrite-graphql') === true) { |
|
| 164 | 164 | if ( |
| 165 | 165 | StringUtil::endsWith($i->filename, '.graphql') |
| 166 | 166 | ) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | // this runs all prettier commands in parallel. |
| 190 | 190 | $run = array_reduce( |
| 191 | 191 | $writtenFiles, |
| 192 | - function ($carry, $f) use ($command) { |
|
| 192 | + function($carry, $f) use ($command) { |
|
| 193 | 193 | return $carry . '(' . $command . $f . ') & '; |
| 194 | 194 | } |
| 195 | 195 | ); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | // this runs all prettier commands in parallel. |
| 209 | 209 | $run = array_reduce( |
| 210 | 210 | $writtenFiles, |
| 211 | - function ($carry, $f) use ($command) { |
|
| 211 | + function($carry, $f) use ($command) { |
|
| 212 | 212 | return $carry . '(' . $command . $f . ') & '; |
| 213 | 213 | } |
| 214 | 214 | ); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public static function scalars(array $datatypes, string $ns): array |
| 49 | 49 | { |
| 50 | - $graphql = [ "# File automatically generated by Modelarium\n" ]; |
|
| 50 | + $graphql = ["# File automatically generated by Modelarium\n"]; |
|
| 51 | 51 | |
| 52 | 52 | foreach ($datatypes as $name) { |
| 53 | 53 | $typeName = Str::studly($name); |
@@ -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 | } |
@@ -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 | } |