@@ -43,7 +43,7 @@ |
||
43 | 43 | $previousResolver = $fieldValue->getResolver(); |
44 | 44 | |
45 | 45 | // Wrap around the resolver |
46 | - $wrappedResolver = function ($root, array $args, GraphQLContext $context, ResolveInfo $info) use ($previousResolver): string { |
|
46 | + $wrappedResolver = function($root, array $args, GraphQLContext $context, ResolveInfo $info) use ($previousResolver): string { |
|
47 | 47 | // Call the resolver, passing along the resolver arguments |
48 | 48 | /** @var string $result */ |
49 | 49 | $result = $previousResolver($root, $args, $context, $info); |
@@ -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()) |
@@ -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 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | function datatypes() |
10 | 10 | { |
11 | 11 | $markdown = DatatypeFactory::map( |
12 | - function (\ReflectionClass $reflection): array { |
|
12 | + function(\ReflectionClass $reflection): array { |
|
13 | 13 | $class = $reflection->getName(); |
14 | 14 | |
15 | 15 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $files = $processor->getCollection(); |
92 | 92 | if ($name && $name !== '*' && $name !== 'all') { |
93 | 93 | $files = $files->filter( |
94 | - function (GeneratedItem $g) use ($name) { |
|
94 | + function(GeneratedItem $g) use ($name) { |
|
95 | 95 | if (is_array($name)) { |
96 | 96 | throw new \Exception('Arrays not supported yet'); |
97 | 97 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $this->writeFiles( |
105 | 105 | $files, |
106 | 106 | base_path(), |
107 | - (bool)$this->option('overwrite') |
|
107 | + (bool) $this->option('overwrite') |
|
108 | 108 | ); |
109 | 109 | $this->info('Finished scaffolding. You might want to run `composer dump-autoload`'); |
110 | 110 | } |
@@ -54,17 +54,17 @@ |
||
54 | 54 | foreach ($directives as $directive) { |
55 | 55 | $name = $directive->name->value; |
56 | 56 | switch ($name) { |
57 | - case 'belongsToMany': |
|
58 | - $type1 = $this->lowerName; |
|
59 | - $type2 = $lowerName; |
|
60 | - if (strcasecmp($type1, $type2) < 0) { // TODO: check this, might not work |
|
61 | - $relationship = mb_strtolower($this->getInflector()->pluralize($field->name)); |
|
62 | - $this->extraCode[] = $this->makeManyToManySeed($type1, $type2, $relationship); |
|
63 | - } |
|
64 | - break; |
|
65 | - case 'morphedByMany': |
|
66 | - // TODO $relation = Parser::getDirectiveArgumentByName($directive, 'relation', $lowerName); |
|
67 | - break; |
|
57 | + case 'belongsToMany': |
|
58 | + $type1 = $this->lowerName; |
|
59 | + $type2 = $lowerName; |
|
60 | + if (strcasecmp($type1, $type2) < 0) { // TODO: check this, might not work |
|
61 | + $relationship = mb_strtolower($this->getInflector()->pluralize($field->name)); |
|
62 | + $this->extraCode[] = $this->makeManyToManySeed($type1, $type2, $relationship); |
|
63 | + } |
|
64 | + break; |
|
65 | + case 'morphedByMany': |
|
66 | + // TODO $relation = Parser::getDirectiveArgumentByName($directive, 'relation', $lowerName); |
|
67 | + break; |
|
68 | 68 | default: |
69 | 69 | break; |
70 | 70 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | return new GeneratedCollection( |
41 | - [ new GeneratedItem( |
|
41 | + [new GeneratedItem( |
|
42 | 42 | GeneratedItem::TYPE_SEED, |
43 | 43 | $this->generateString(), |
44 | 44 | $this->getGenerateFilename() |
@@ -101,6 +101,6 @@ discard block |
||
101 | 101 | |
102 | 102 | public function getGenerateFilename(): string |
103 | 103 | { |
104 | - return $this->getBasePath('database/seeds/'. $this->studlyName . 'Seeder.php'); |
|
104 | + return $this->getBasePath('database/seeds/' . $this->studlyName . 'Seeder.php'); |
|
105 | 105 | } |
106 | 106 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @var ObjectType $object |
315 | 315 | */ |
316 | 316 | |
317 | - if (str_starts_with((string)$name, '__')) { |
|
317 | + if (str_starts_with((string) $name, '__')) { |
|
318 | 318 | // internal type |
319 | 319 | continue; |
320 | 320 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | continue; |
327 | 327 | } |
328 | 328 | |
329 | - $methodName = $this->getInflector()->pluralize(mb_strtolower((string)$name)); |
|
329 | + $methodName = $this->getInflector()->pluralize(mb_strtolower((string) $name)); |
|
330 | 330 | $this->class->addMethod($methodName) |
331 | 331 | ->setReturnType('\\Illuminate\\Database\\Eloquent\\Relations\\MorphToMany') |
332 | 332 | ->setPublic() |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } else { |
355 | 355 | $this->methodRandom->addBody( |
356 | 356 | '$data["' . $lowerName . '_id"] = function () {' . "\n" . |
357 | - ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
357 | + ' return factory(' . $targetClass . '::class)->create()->id;' . "\n" . |
|
358 | 358 | '};' |
359 | 359 | ); |
360 | 360 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | // get the title field |
70 | 70 | $titleField = $targetModel->firstField( |
71 | - function (Field $field) { |
|
71 | + function(Field $field) { |
|
72 | 72 | return $field->getRenderable('title', false); |
73 | 73 | } |
74 | 74 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'enum', |
157 | 157 | 'App\\Datatypes', |
158 | 158 | 'Tests\\Unit', |
159 | - function (ClassType $enumClass) use ($enumValues) { |
|
159 | + function(ClassType $enumClass) use ($enumValues) { |
|
160 | 160 | $enumClass->addConstant('CHOICES', $enumValues); |
161 | 161 | $enumClass->getMethod('__construct')->addBody('$this->choices = self::CHOICES;'); |
162 | 162 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $name = $directive->name->value; |
364 | 364 | switch ($name) { |
365 | 365 | case 'migrationSoftDeletes': |
366 | - $this->createCode[] ='$table->softDeletes();'; |
|
366 | + $this->createCode[] = '$table->softDeletes();'; |
|
367 | 367 | break; |
368 | 368 | case 'migrationPrimaryIndex': |
369 | 369 | // TODO |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | if (!count($indexFields)) { |
379 | 379 | throw new Exception("You must provide at least one field to an index"); |
380 | 380 | } |
381 | - $this->createCode[] ='$table->index("' . implode('", "', $indexFields) .'");'; |
|
381 | + $this->createCode[] = '$table->index("' . implode('", "', $indexFields) . '");'; |
|
382 | 382 | break; |
383 | 383 | case 'migrationSpatialIndex': |
384 | - $this->createCode[] ='$table->spatialIndex("' . $directive->arguments[0]->value->value .'");'; |
|
384 | + $this->createCode[] = '$table->spatialIndex("' . $directive->arguments[0]->value->value . '");'; |
|
385 | 385 | break; |
386 | 386 | |
387 | 387 | case 'migrationFulltextIndex': |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | "\")');"; |
403 | 403 | break; |
404 | 404 | case 'migrationRememberToken': |
405 | - $this->createCode[] ='$table->rememberToken();'; |
|
405 | + $this->createCode[] = '$table->rememberToken();'; |
|
406 | 406 | break; |
407 | 407 | case 'migrationTimestamps': |
408 | - $this->createCode[] ='$table->timestamps();'; |
|
408 | + $this->createCode[] = '$table->timestamps();'; |
|
409 | 409 | break; |
410 | 410 | default: |
411 | 411 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $this->getBasePath( |
491 | 491 | 'database/migrations/' . |
492 | 492 | date('Y_m_d_His') . |
493 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
493 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
494 | 494 | '_' . $this->mode . '_' . |
495 | 495 | $relation . |
496 | 496 | '_table.php' |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $this->getBasePath( |
531 | 531 | 'database/migrations/' . |
532 | 532 | date('Y_m_d_His') . |
533 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
533 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
534 | 534 | '_' . $this->mode . '_' . |
535 | 535 | $type1 . '_' . $type2 . |
536 | 536 | '_table.php' |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | return $this->getBasePath( |
576 | 576 | 'database/migrations/' . |
577 | 577 | date('Y_m_d_His') . |
578 | - str_pad((string)(static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
578 | + str_pad((string) (static::$counter++), 3, "0", STR_PAD_LEFT) . // so we keep the same order of types in schema |
|
579 | 579 | '_' . $this->mode . '_' . |
580 | 580 | $basename . '_table.php' |
581 | 581 | ); |