@@ -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()) |
@@ -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; |