Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Sep 25, 2024
1 parent 09fd46e commit 033a27e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ includes:
- ./vendor/phpstan/phpstan-phpunit/extension.neon
- ./vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: 9
level: max
paths:
- src
- tests
12 changes: 2 additions & 10 deletions src/Relations/BelongsToThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BelongsToThrough extends Relation
/**
* The "through" parent model instances.
*
* @var list<\Illuminate\Database\Eloquent\Model>
* @var non-empty-list<\Illuminate\Database\Eloquent\Model>
*/
protected $throughParents;

Expand Down Expand Up @@ -62,7 +62,7 @@ class BelongsToThrough extends Relation
*
* @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
* @param TDeclaringModel $parent
* @param list<\Illuminate\Database\Eloquent\Model> $throughParents
* @param non-empty-list<\Illuminate\Database\Eloquent\Model> $throughParents
* @param string|null $localKey
* @param string $prefix
* @param array<string, string> $foreignKeyLookup
Expand Down Expand Up @@ -340,10 +340,6 @@ public function getFirstForeignKeyName()
{
$firstThroughParent = end($this->throughParents);

if ($firstThroughParent === false) {
throw new RuntimeException('No "through" parent models were specified.'); // @codeCoverageIgnore
}

return $this->prefix . $this->getForeignKeyName($firstThroughParent);
}

Expand All @@ -356,10 +352,6 @@ public function getQualifiedFirstLocalKeyName()
{
$firstThroughParent = end($this->throughParents);

if ($firstThroughParent === false) {
throw new RuntimeException('No "through" parent models were specified.'); // @codeCoverageIgnore
}

return $firstThroughParent->qualifyColumn($this->getLocalKeyName($firstThroughParent));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Traits/BelongsToThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait BelongsToThrough
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $related
* @param class-string<\Illuminate\Database\Eloquent\Model>[]|array{0: class-string<\Illuminate\Database\Eloquent\Model>, 1: string}[]|class-string<\Illuminate\Database\Eloquent\Model> $through
* @param non-empty-list<class-string<\Illuminate\Database\Eloquent\Model>>|non-empty-list<array{0: class-string<\Illuminate\Database\Eloquent\Model>, 1: string}>|class-string<\Illuminate\Database\Eloquent\Model> $through
* @param string|null $localKey
* @param string $prefix
* @param array<class-string<\Illuminate\Database\Eloquent\Model>, string> $foreignKeyLookup
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function belongsToThroughParentInstance($model)
*
* @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
* @param TDeclaringModel $parent
* @param list<\Illuminate\Database\Eloquent\Model> $throughParents
* @param non-empty-list<\Illuminate\Database\Eloquent\Model> $throughParents
* @param string|null $localKey
* @param string $prefix
* @param array<string, string> $foreignKeyLookup
Expand Down

0 comments on commit 033a27e

Please sign in to comment.