@@ -21,7 +21,7 @@ |
||
21 | 21 | ($field->getValidatorOption(Datatype::REQUIRED, 'value', false) ? '' : '->nullable()'); |
22 | 22 | // $index = '' $field->getRenderable('index').... |
23 | 23 | return [ |
24 | - $id |
|
24 | + $id |
|
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $graphqlQuery = array_merge( |
82 | 82 | $graphqlQuery, |
83 | 83 | $formulariumModel->mapFields( |
84 | - function (Field $f) { // use ($recurseLevel) { |
|
84 | + function(Field $f) { // use ($recurseLevel) { |
|
85 | 85 | $type = $f->getDatatype(); |
86 | 86 | if ($type instanceof Datatype_relationship && !$type->getIsInverse()) { |
87 | 87 | return ''; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | $formulariumModel = call_user_func("$model::getFormularium"); /** @phpstan-ignore-line */ |
100 | 100 | $graphqlQuery = $formulariumModel->mapFields( |
101 | - function (Field $f) { // use ($recurseLevel) { |
|
101 | + function(Field $f) { // use ($recurseLevel) { |
|
102 | 102 | return \Modelarium\Frontend\Util::fieldShow($f) ? /* $f->toGraphqlQuery([self::RECURSE => $recurseLevel-1]) */ 'zzz' : null; |
103 | 103 | } |
104 | 104 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | return new GeneratedCollection( |
52 | - [ new GeneratedItem( |
|
52 | + [new GeneratedItem( |
|
53 | 53 | GeneratedItem::TYPE_SEED, |
54 | 54 | $this->generateString(), |
55 | 55 | $this->getGenerateFilename() |
@@ -76,6 +76,6 @@ discard block |
||
76 | 76 | $seedDirectoryName = 'seeders'; |
77 | 77 | } |
78 | 78 | |
79 | - return $this->getBasePath('database/' . $seedDirectoryName . '/'. $this->studlyName . 'Seeder.php'); |
|
79 | + return $this->getBasePath('database/' . $seedDirectoryName . '/' . $this->studlyName . 'Seeder.php'); |
|
80 | 80 | } |
81 | 81 | } |
@@ -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()) |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | $writtenFiles = $this->writeFiles( |
168 | 168 | $collection, |
169 | 169 | $basepath, |
170 | - function (GeneratedItem $i) { |
|
171 | - if ((bool)$this->option('overwrite') === true) { |
|
170 | + function(GeneratedItem $i) { |
|
171 | + if ((bool) $this->option('overwrite') === true) { |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | return false; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // this runs all prettier commands in parallel. |
189 | 189 | $run = array_reduce( |
190 | 190 | $writtenFiles, |
191 | - function ($carry, $f) use ($command) { |
|
191 | + function($carry, $f) use ($command) { |
|
192 | 192 | return $carry . '(' . $command . $f . ') & '; |
193 | 193 | } |
194 | 194 | ); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | // this runs all prettier commands in parallel. |
208 | 208 | $run = array_reduce( |
209 | 209 | $writtenFiles, |
210 | - function ($carry, $f) use ($command) { |
|
210 | + function($carry, $f) use ($command) { |
|
211 | 211 | return $carry . '(' . $command . $f . ') & '; |
212 | 212 | } |
213 | 213 | ); |