diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3c3b3e5..f3b5181 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -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 diff --git a/src/Relations/BelongsToThrough.php b/src/Relations/BelongsToThrough.php index 8c6e6d9..c81c9fb 100644 --- a/src/Relations/BelongsToThrough.php +++ b/src/Relations/BelongsToThrough.php @@ -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; @@ -62,7 +62,7 @@ class BelongsToThrough extends Relation * * @param \Illuminate\Database\Eloquent\Builder $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 $foreignKeyLookup @@ -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); } @@ -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)); } diff --git a/src/Traits/BelongsToThrough.php b/src/Traits/BelongsToThrough.php index 4f9042b..d74848a 100644 --- a/src/Traits/BelongsToThrough.php +++ b/src/Traits/BelongsToThrough.php @@ -14,7 +14,7 @@ trait BelongsToThrough * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * * @param class-string $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>|non-empty-list, 1: string}>|class-string<\Illuminate\Database\Eloquent\Model> $through * @param string|null $localKey * @param string $prefix * @param array, string> $foreignKeyLookup @@ -124,7 +124,7 @@ protected function belongsToThroughParentInstance($model) * * @param \Illuminate\Database\Eloquent\Builder $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 $foreignKeyLookup