Skip to content

Commit

Permalink
Merge pull request #15 from Naoray/analysis-yv7DB5
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI

[ci skip] [skip ci]
  • Loading branch information
Naoray authored Feb 9, 2021
2 parents c0296b0 + 3c373c2 commit a035b9c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
12 changes: 6 additions & 6 deletions src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function __construct(string $column, string $table)
public function toArray(): array
{
return [
'name' => $this->column,
'type' => $this->typeClass(),
'unsigned' => $this->data->getUnsigned(),
'unique' => $this->isUnique(),
'isForeignKey' => $this->isForeignKey(),
'nullable' => ! $this->data->getNotnull(),
'name' => $this->column,
'type' => $this->typeClass(),
'unsigned' => $this->data->getUnsigned(),
'unique' => $this->isUnique(),
'isForeignKey' => $this->isForeignKey(),
'nullable' => !$this->data->getNotnull(),
'autoincrement' => $this->data->getAutoincrement(),
];
}
Expand Down
10 changes: 5 additions & 5 deletions src/RelationMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function toArray(): array
{
return [
'relatedClass' => $this->getRelatedClass(),
'type' => $this->returnType(),
'foreignKey' => $this->foreignKey(),
'ownerKey' => $this->ownerKey(),
'methodName' => $this->getName(),
'type' => $this->returnType(),
'foreignKey' => $this->foreignKey(),
'ownerKey' => $this->ownerKey(),
'methodName' => $this->getName(),
];
}

Expand All @@ -71,7 +71,7 @@ public function getRelatedClass(): string
* If classname does not use ::class notation
* we consider it as a full class string reference.
*/
if (! $className->is('*::class')) {
if (!$className->is('*::class')) {
return $className;
}

Expand Down
48 changes: 24 additions & 24 deletions tests/ColumnsDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ public function up()

$this->assertCount(4, $fields);
$this->assertEquals([
'name' => 'id',
'type' => IntegerType::class,
'unsigned' => false,
'unique' => true,
'isForeignKey' => false,
'nullable' => false,
'name' => 'id',
'type' => IntegerType::class,
'unsigned' => false,
'unique' => true,
'isForeignKey' => false,
'nullable' => false,
'autoincrement' => true,
], $fields->get('id')->toArray());
$this->assertEquals([
'name' => 'name',
'type' => StringType::class,
'unsigned' => false,
'unique' => false,
'isForeignKey' => false,
'nullable' => false,
'name' => 'name',
'type' => StringType::class,
'unsigned' => false,
'unique' => false,
'isForeignKey' => false,
'nullable' => false,
'autoincrement' => false,
], $fields->get('name')->toArray());
$this->assertEquals([
'name' => 'email',
'type' => StringType::class,
'unsigned' => false,
'unique' => true,
'isForeignKey' => false,
'nullable' => false,
'name' => 'email',
'type' => StringType::class,
'unsigned' => false,
'unique' => true,
'isForeignKey' => false,
'nullable' => false,
'autoincrement' => false,
], $fields->get('email')->toArray());
$this->assertEquals([
'name' => 'bio',
'type' => TextType::class,
'unsigned' => false,
'unique' => false,
'isForeignKey' => false,
'nullable' => true,
'name' => 'bio',
'type' => TextType::class,
'unsigned' => false,
'unique' => false,
'isForeignKey' => false,
'nullable' => true,
'autoincrement' => false,
], $fields->get('bio')->toArray());
}
Expand Down
48 changes: 24 additions & 24 deletions tests/RelationMethodDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ public function it_can_get_relation_methods_of_a_model_by_return_type()
$this->assertCount(2, $relationMethods);
$this->assertEquals([
'relatedClass' => UserWithReturnTypes::class,
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
], $relationMethods->first()->toArray());
$this->assertEquals([
'relatedClass' => Post::class,
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
], $relationMethods->get(1)->toArray());
}

Expand All @@ -41,17 +41,17 @@ public function it_can_get_relation_methods_of_a_model_by_doc_comment()
$this->assertCount(2, $relationMethods);
$this->assertEquals([
'relatedClass' => UserWithDocComments::class,
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
], $relationMethods->first()->toArray());
$this->assertEquals([
'relatedClass' => Post::class,
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
], $relationMethods->get(1)->toArray());
}

Expand All @@ -65,17 +65,17 @@ public function it_can_get_relation_methods_of_a_model_by_method_content()
$this->assertCount(2, $relationMethods);
$this->assertEquals([
'relatedClass' => UserWithoutAnyHints::class,
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
'type' => BelongsTo::class,
'foreignKey' => 'parent_id',
'ownerKey' => 'id',
'methodName' => 'parent',
], $relationMethods->first()->toArray());
$this->assertEquals([
'relatedClass' => Post::class,
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
'type' => HasMany::class,
'foreignKey' => 'user_id',
'ownerKey' => 'id',
'methodName' => 'posts',
], $relationMethods->get(1)->toArray());
}
}
Expand Down

0 comments on commit a035b9c

Please sign in to comment.