@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function generate(): GeneratedCollection |
11 | 11 | { |
12 | 12 | return new GeneratedCollection( |
13 | - [ new GeneratedItem( |
|
13 | + [new GeneratedItem( |
|
14 | 14 | GeneratedItem::TYPE_SEED, |
15 | 15 | $this->generateString(), |
16 | 16 | $this->getGenerateFilename() |
@@ -25,6 +25,6 @@ discard block |
||
25 | 25 | |
26 | 26 | public function getGenerateFilename(): string |
27 | 27 | { |
28 | - return $this->getBasePath('database/seeds/'. $this->studlyName . 'Seeder.php'); |
|
28 | + return $this->getBasePath('database/seeds/' . $this->studlyName . 'Seeder.php'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function filterByType(string $type): GeneratedCollection |
10 | 10 | { |
11 | 11 | return $this->filter( |
12 | - function ($i) use ($type) { |
|
12 | + function($i) use ($type) { |
|
13 | 13 | return $i->type == $type; |
14 | 14 | } |
15 | 15 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function generate(): GeneratedCollection |
11 | 11 | { |
12 | 12 | return new GeneratedCollection( |
13 | - [ new GeneratedItem( |
|
13 | + [new GeneratedItem( |
|
14 | 14 | GeneratedItem::TYPE_FACTORY, |
15 | 15 | $this->generateString(), |
16 | 16 | $this->getGenerateFilename() |
@@ -25,6 +25,6 @@ discard block |
||
25 | 25 | |
26 | 26 | public function getGenerateFilename(): string |
27 | 27 | { |
28 | - return $this->getBasePath('database/factories/'. $this->studlyName . 'Factory.php'); |
|
28 | + return $this->getBasePath('database/factories/' . $this->studlyName . 'Factory.php'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $originalTypeLoader = $this->schema->getConfig()->typeLoader; |
161 | 161 | |
162 | - $this->schema->getConfig()->typeLoader = function ($typeName) use ($originalTypeLoader) { |
|
162 | + $this->schema->getConfig()->typeLoader = function($typeName) use ($originalTypeLoader) { |
|
163 | 163 | $type = $originalTypeLoader($typeName); |
164 | 164 | if ($type instanceof \GraphQL\Type\Definition\CustomScalarType) { |
165 | 165 | $scalarName = $type->name; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | $this->ast = Visitor::visit($this->ast, [ |
176 | 176 | // load the scalar type classes |
177 | - NodeKind::SCALAR_TYPE_DEFINITION => function ($node) { |
|
177 | + NodeKind::SCALAR_TYPE_DEFINITION => function($node) { |
|
178 | 178 | $scalarName = $node->name->value; |
179 | 179 | |
180 | 180 | // load classes |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | return []; |
238 | 238 | } |
239 | 239 | return array_map( |
240 | - function ($i) use ($basedir) { |
|
240 | + function($i) use ($basedir) { |
|
241 | 241 | $name = $i[1]; |
242 | 242 | if (array_key_exists($name, $this->imports)) { |
243 | 243 | return $this->imports[$name]; |
@@ -105,24 +105,24 @@ |
||
105 | 105 | |
106 | 106 | foreach ($directive->arguments as $arg) { |
107 | 107 | switch ($arg->name->value) { |
108 | - case 'ability': |
|
109 | - // @phpstan-ignore-next-line |
|
110 | - $ability = $arg->value->value; |
|
111 | - break; |
|
112 | - case 'find': |
|
113 | - // @phpstan-ignore-next-line |
|
114 | - $find = $arg->value->value; |
|
115 | - break; |
|
116 | - case 'model': |
|
117 | - // @phpstan-ignore-next-line |
|
118 | - $model = $arg->value->value; |
|
119 | - break; |
|
120 | - case 'injectArgs': |
|
121 | - $injected = true; |
|
122 | - break; |
|
123 | - case 'args': |
|
124 | - $args = true; |
|
125 | - break; |
|
108 | + case 'ability': |
|
109 | + // @phpstan-ignore-next-line |
|
110 | + $ability = $arg->value->value; |
|
111 | + break; |
|
112 | + case 'find': |
|
113 | + // @phpstan-ignore-next-line |
|
114 | + $find = $arg->value->value; |
|
115 | + break; |
|
116 | + case 'model': |
|
117 | + // @phpstan-ignore-next-line |
|
118 | + $model = $arg->value->value; |
|
119 | + break; |
|
120 | + case 'injectArgs': |
|
121 | + $injected = true; |
|
122 | + break; |
|
123 | + case 'args': |
|
124 | + $args = true; |
|
125 | + break; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
@@ -168,6 +168,6 @@ |
||
168 | 168 | |
169 | 169 | public function getGenerateFilename(string $name): string |
170 | 170 | { |
171 | - return $this->getBasePath('app/Policies/'. Str::studly($name) . 'Policy.php'); |
|
171 | + return $this->getBasePath('app/Policies/' . Str::studly($name) . 'Policy.php'); |
|
172 | 172 | } |
173 | 173 | } |
@@ -106,7 +106,7 @@ |
||
106 | 106 | throw new Exception("Directive $validator does not have argument $argName"); |
107 | 107 | } |
108 | 108 | if ($argValidator->type === 'Int') { |
109 | - $argValue = (int)$argValue; |
|
109 | + $argValue = (int) $argValue; |
|
110 | 110 | } |
111 | 111 | $arguments[$argName] = $argValue; |
112 | 112 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string[] $directiveNamespaces |
75 | 75 | * @return array<string, string> |
76 | 76 | */ |
77 | - public static function getDirectivesGraphql($directiveNamespaces = [ 'Modelarium\Laravel\Lighthouse\Directives' ]): array |
|
77 | + public static function getDirectivesGraphql($directiveNamespaces = ['Modelarium\Laravel\Lighthouse\Directives']): array |
|
78 | 78 | { |
79 | 79 | $directives = []; |
80 | 80 | |
@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | |
85 | 85 | foreach ($classesInNamespace as $class) { |
86 | 86 | $reflection = new \ReflectionClass($class); |
87 | - if (! $reflection->isInstantiable()) { |
|
87 | + if (!$reflection->isInstantiable()) { |
|
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | |
91 | - if (! is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
91 | + if (!is_a($class, \Nuwave\Lighthouse\Schema\Directives\BaseDirective::class, true)) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - $name = DirectiveFactory::directiveName((string)$class); |
|
95 | + $name = DirectiveFactory::directiveName((string) $class); |
|
96 | 96 | $directives[$name] = trim($class::definition()); |
97 | 97 | } |
98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param string[] $directiveNamespaces |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public static function getDirectivesGraphqlString($directiveNamespaces = [ 'Modelarium\\Laravel\\Lighthouse\\Directives' ]): string |
|
109 | + public static function getDirectivesGraphqlString($directiveNamespaces = ['Modelarium\\Laravel\\Lighthouse\\Directives']): string |
|
110 | 110 | { |
111 | 111 | return implode("\n\n", self::getDirectivesGraphql($directiveNamespaces)); |
112 | 112 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($name === 'Query' || $name === 'Mutation' || $name === 'Subscription' || $name === 'Can') { |
164 | 164 | continue; |
165 | 165 | } |
166 | - $g = $this->processType((string)$name, $object); |
|
166 | + $g = $this->processType((string) $name, $object); |
|
167 | 167 | $this->collection = $this->collection->merge($g); |
168 | 168 | } |
169 | 169 | } |
@@ -29,19 +29,19 @@ |
||
29 | 29 | if (preg_match('/^relationship:(11|1N|N1|NN):([a-zA-Z0-9]+):([a-zA-Z0-9]+)$/', $name, $matches)) { |
30 | 30 | $mode = null; |
31 | 31 | switch ($matches[1]) { |
32 | - case '11': |
|
33 | - $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
34 | - break; |
|
35 | - case '1N': |
|
36 | - $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
37 | - break; |
|
38 | - case 'NN': |
|
39 | - case 'N1': // TODO |
|
40 | - $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
41 | - break; |
|
42 | - // TODO: morph |
|
43 | - default: |
|
44 | - throw new ClassNotFoundException('Invalid relationship'); |
|
32 | + case '11': |
|
33 | + $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
34 | + break; |
|
35 | + case '1N': |
|
36 | + $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
37 | + break; |
|
38 | + case 'NN': |
|
39 | + case 'N1': // TODO |
|
40 | + $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
41 | + break; |
|
42 | + // TODO: morph |
|
43 | + default: |
|
44 | + throw new ClassNotFoundException('Invalid relationship'); |
|
45 | 45 | } |
46 | 46 | return static::factory($matches[2], $matches[3], $matches[1]); // $mode); |
47 | 47 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | public const RELATIONSHIP = "RELATIONSHIP"; |
15 | 15 | public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
16 | 16 | public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
17 | - public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
17 | + public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
18 | 18 | public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
19 | 19 | public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
20 | - public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
20 | + public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @param string $name relationship:[mode]:[source]:[target] |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @var string |
76 | 76 | */ |
77 | - protected $targetClass= ''; |
|
77 | + protected $targetClass = ''; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @var string |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $name = $directive->name->value; |
307 | 307 | switch ($name) { |
308 | 308 | case 'migrationSoftDeletes': |
309 | - $this->createCode[] ='$table->softDeletes();'; |
|
309 | + $this->createCode[] = '$table->softDeletes();'; |
|
310 | 310 | break; |
311 | 311 | case 'migrationPrimaryIndex': |
312 | 312 | // TODO |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | if (!count($indexFields)) { |
322 | 322 | throw new Exception("You must provide at least one field to an index"); |
323 | 323 | } |
324 | - $this->createCode[] ='$table->index("' . implode('", "', $indexFields) .'");'; |
|
324 | + $this->createCode[] = '$table->index("' . implode('", "', $indexFields) . '");'; |
|
325 | 325 | break; |
326 | 326 | case 'migrationSpatialIndex': |
327 | - $this->createCode[] ='$table->spatialIndex("' . $directive->arguments[0]->value->value .'");'; |
|
327 | + $this->createCode[] = '$table->spatialIndex("' . $directive->arguments[0]->value->value . '");'; |
|
328 | 328 | break; |
329 | 329 | |
330 | 330 | case 'migrationFulltextIndex': |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | "\")');"; |
346 | 346 | break; |
347 | 347 | case 'migrationRememberToken': |
348 | - $this->createCode[] ='$table->rememberToken();'; |
|
348 | + $this->createCode[] = '$table->rememberToken();'; |
|
349 | 349 | break; |
350 | 350 | case 'migrationTimestamps': |
351 | - $this->createCode[] ='$table->timestamps();'; |
|
351 | + $this->createCode[] = '$table->timestamps();'; |
|
352 | 352 | break; |
353 | 353 | default: |
354 | 354 | } |