@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @var ObjectType $object |
96 | 96 | */ |
97 | 97 | |
98 | - if (str_starts_with((string)$name, '__')) { |
|
98 | + if (str_starts_with((string) $name, '__')) { |
|
99 | 99 | // internal type |
100 | 100 | continue; |
101 | 101 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | - $methodName = lcfirst($generator->getInflector()->pluralize((string)$name)); |
|
110 | + $methodName = lcfirst($generator->getInflector()->pluralize((string) $name)); |
|
111 | 111 | $generator->class->addMethod($methodName) |
112 | 112 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
113 | 113 | ->setPublic() |
@@ -59,18 +59,18 @@ |
||
59 | 59 | $targetSingle = lcfirst($generator->getInflector()->singularize($datatype->getTarget())); |
60 | 60 | $targetPlural = $datatype->getTargetTable(); |
61 | 61 | switch ($datatype->getRelationship()) { |
62 | - case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE: |
|
63 | - case RelationshipFactory::MORPH_ONE_TO_ONE: |
|
64 | - $target = $targetSingle; |
|
65 | - break; |
|
66 | - case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY: |
|
67 | - case RelationshipFactory::MORPH_ONE_TO_MANY: |
|
68 | - $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural; |
|
69 | - break; |
|
70 | - case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY: |
|
71 | - case RelationshipFactory::MORPH_MANY_TO_MANY: |
|
72 | - $target = $targetPlural; |
|
73 | - break; |
|
62 | + case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE: |
|
63 | + case RelationshipFactory::MORPH_ONE_TO_ONE: |
|
64 | + $target = $targetSingle; |
|
65 | + break; |
|
66 | + case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY: |
|
67 | + case RelationshipFactory::MORPH_ONE_TO_MANY: |
|
68 | + $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural; |
|
69 | + break; |
|
70 | + case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY: |
|
71 | + case RelationshipFactory::MORPH_MANY_TO_MANY: |
|
72 | + $target = $targetPlural; |
|
73 | + break; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | $generator->with[] = $target; |
@@ -79,7 +79,7 @@ |
||
79 | 79 | $target = base_path('graphql/data/' . $this->studlyName . '.graphql'); |
80 | 80 | $this->writeFile( |
81 | 81 | $target, |
82 | - (bool)$this->option('overwrite'), |
|
82 | + (bool) $this->option('overwrite'), |
|
83 | 83 | $graphql |
84 | 84 | ); |
85 | 85 | $this->info('Type generated at ' . $target); |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | public const RELATIONSHIP = "RELATIONSHIP"; |
17 | 17 | public const RELATIONSHIP_ONE_TO_ONE = "11"; |
18 | 18 | public const RELATIONSHIP_ONE_TO_MANY = "1N"; |
19 | - public const RELATIONSHIP_MANY_TO_MANY = "NN"; |
|
19 | + public const RELATIONSHIP_MANY_TO_MANY = "NN"; |
|
20 | 20 | public const MORPH_ONE_TO_ONE = "M11"; |
21 | 21 | public const MORPH_ONE_TO_MANY = "M1N"; |
22 | - public const MORPH_MANY_TO_MANY = "MNN"; |
|
22 | + public const MORPH_MANY_TO_MANY = "MNN"; |
|
23 | 23 | |
24 | 24 | private function __construct() |
25 | 25 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (!in_array($matches['mode'], $relationships)) { |
52 | 52 | throw new ClassNotFoundException('Invalid relationship'); |
53 | 53 | } |
54 | - return static::factory($matches['source'], $matches['target'], $matches['mode'], (bool)$matches['inverse']); |
|
54 | + return static::factory($matches['source'], $matches['target'], $matches['mode'], (bool) $matches['inverse']); |
|
55 | 55 | } |
56 | 56 | throw new ClassNotFoundException('Invalid relationship'); |
57 | 57 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * @var string |
33 | 33 | */ |
34 | - protected $targetClass= ''; |
|
34 | + protected $targetClass = ''; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * If false, $source is "User" (class with HasOne/HasMany posts()) |
@@ -172,28 +172,28 @@ discard block |
||
172 | 172 | $fieldName, |
173 | 173 | 'string', |
174 | 174 | [], |
175 | - [ Datatype::REQUIRED => ['value' => $required ] ] |
|
175 | + [Datatype::REQUIRED => ['value' => $required]] |
|
176 | 176 | ); |
177 | 177 | } elseif ($type instanceof IntType) { |
178 | 178 | $formulariumField = new Field( |
179 | 179 | $fieldName, |
180 | 180 | 'integer', |
181 | 181 | [], |
182 | - [ Datatype::REQUIRED => ['value' => $required ] ] |
|
182 | + [Datatype::REQUIRED => ['value' => $required]] |
|
183 | 183 | ); |
184 | 184 | } elseif ($type instanceof BooleanType) { |
185 | 185 | $formulariumField = new Field( |
186 | 186 | $fieldName, |
187 | 187 | 'boolean', |
188 | 188 | [], |
189 | - [ Datatype::REQUIRED => ['value' => $required ] ] |
|
189 | + [Datatype::REQUIRED => ['value' => $required]] |
|
190 | 190 | ); |
191 | 191 | } elseif ($type instanceof FloatType) { |
192 | 192 | $formulariumField = new Field( |
193 | 193 | $fieldName, |
194 | 194 | 'float', |
195 | 195 | [], |
196 | - [ Datatype::REQUIRED => ['value' => $required ] ] |
|
196 | + [Datatype::REQUIRED => ['value' => $required]] |
|
197 | 197 | ); |
198 | 198 | } elseif ($type instanceof EnumType) { |
199 | 199 | $this->processEnum($field, $type, $codeFragment); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $fieldName, |
216 | 216 | $ourType->getDatatype(), |
217 | 217 | [], |
218 | - [ Datatype::REQUIRED => ['value' => $required ] ] |
|
218 | + [Datatype::REQUIRED => ['value' => $required]] |
|
219 | 219 | ); |
220 | 220 | } elseif ($type instanceof ListOfType) { |
221 | 221 | throw new Exception("Invalid field type: " . get_class($type)); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'enum', |
277 | 277 | 'App\\Modelarium\\Datatype', |
278 | 278 | 'Tests\\Unit', |
279 | - function (ClassType $enumClass) use ($enumValues) { |
|
279 | + function(ClassType $enumClass) use ($enumValues) { |
|
280 | 280 | $enumClass->addConstant('CHOICES', $enumValues); |
281 | 281 | $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;'); |
282 | 282 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $this->getBasePath( |
474 | 474 | 'database/migrations/' . |
475 | 475 | $this->stamp . |
476 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
476 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
477 | 477 | '_' . $this->mode . '_' . |
478 | 478 | $relation . |
479 | 479 | '_table.php' |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $this->getBasePath( |
516 | 516 | 'database/migrations/' . |
517 | 517 | $this->stamp . |
518 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
518 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
519 | 519 | '_' . $this->mode . '_' . |
520 | 520 | $type1 . '_' . $type2 . |
521 | 521 | '_table.php' |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | return $this->getBasePath( |
567 | 567 | 'database/migrations/' . |
568 | 568 | $this->stamp . |
569 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
569 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
570 | 570 | '_' . $this->mode . '_' . |
571 | 571 | $basename . '_' . |
572 | 572 | str_replace('_', '', $this->stamp) . '_' . |
@@ -587,10 +587,10 @@ discard block |
||
587 | 587 | return true; |
588 | 588 | } |
589 | 589 | $tokens = token_get_all($this->lastMigrationCode); |
590 | - for ($i=0, $z=count($tokens); $i < $z; $i++) { |
|
590 | + for ($i = 0, $z = count($tokens); $i < $z; $i++) { |
|
591 | 591 | if (is_array($tokens[$i]) && $tokens[$i][0] === T_FUNCTION |
592 | - && is_array($tokens[$i+1]) && $tokens[$i+1][0] == T_WHITESPACE |
|
593 | - && is_array($tokens[$i+2]) && $tokens[$i+2][1] == 'up' |
|
592 | + && is_array($tokens[$i + 1]) && $tokens[$i + 1][0] == T_WHITESPACE |
|
593 | + && is_array($tokens[$i + 2]) && $tokens[$i + 2][1] == 'up' |
|
594 | 594 | ) { |
595 | 595 | $accumulator = []; |
596 | 596 | $braceDepth = 0; |
@@ -77,13 +77,13 @@ |
||
77 | 77 | */ |
78 | 78 | Event::listen( |
79 | 79 | RegisterDirectiveNamespaces::class, |
80 | - function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
80 | + function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
81 | 81 | return 'Modelarium\\Laravel\\Lighthouse\\Directives'; |
82 | 82 | } |
83 | 83 | ); |
84 | 84 | Event::listen( |
85 | 85 | RegisterDirectiveNamespaces::class, |
86 | - function (RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
86 | + function(RegisterDirectiveNamespaces $registerDirectiveNamespaces): string { |
|
87 | 87 | return 'App\\Datatype\\Types'; |
88 | 88 | } |
89 | 89 | ); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @var string $generatorName |
89 | 89 | */ |
90 | - $this->generatorName = (string)$generatorName; |
|
90 | + $this->generatorName = (string) $generatorName; |
|
91 | 91 | |
92 | 92 | $this->loadParser(); |
93 | 93 | if ($name === '*' || $name === 'all') { |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $writtenFiles = $this->writeFiles( |
183 | 183 | $collection, |
184 | 184 | $basepath, |
185 | - function (GeneratedItem $i) { |
|
186 | - if ((bool)$this->option('overwrite') === true) { |
|
185 | + function(GeneratedItem $i) { |
|
186 | + if ((bool) $this->option('overwrite') === true) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 | return false; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | // this runs all prettier commands in parallel. |
204 | 204 | $run = array_reduce( |
205 | 205 | $writtenFiles, |
206 | - function ($carry, $f) use ($command) { |
|
206 | + function($carry, $f) use ($command) { |
|
207 | 207 | return $carry . '(' . $command . $f . ') & '; |
208 | 208 | } |
209 | 209 | ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // this runs all prettier commands in parallel. |
223 | 223 | $run = array_reduce( |
224 | 224 | $writtenFiles, |
225 | - function ($carry, $f) use ($command) { |
|
225 | + function($carry, $f) use ($command) { |
|
226 | 226 | return $carry . '(' . $command . $f . ') & '; |
227 | 227 | } |
228 | 228 | ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $graphqlQuery = array_merge( |
91 | 91 | $graphqlQuery, |
92 | 92 | $formulariumModel->mapFields( |
93 | - function (Field $f) use ($generator, $method, $recurseLevel) { |
|
93 | + function(Field $f) use ($generator, $method, $recurseLevel) { |
|
94 | 94 | $type = $f->getDatatype(); |
95 | 95 | if ($type instanceof Datatype_relationship && !$type->getIsInverse()) { |
96 | 96 | return ''; |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | $formulariumModel = call_user_func("$model::getFormularium"); /** @phpstan-ignore-line */ |
119 | 119 | $graphqlQuery = $formulariumModel->mapFields( |
120 | - function (Field $f) use ($generator, $method, $recurseLevel) { |
|
120 | + function(Field $f) use ($generator, $method, $recurseLevel) { |
|
121 | 121 | $extradata = new Extradata( |
122 | 122 | self::RECURSE, |
123 | 123 | [ |
124 | - new ExtradataParameter('value', $recurseLevel-1) |
|
124 | + new ExtradataParameter('value', $recurseLevel - 1) |
|
125 | 125 | ] |
126 | 126 | ); |
127 | 127 |