diff --git a/src/Database/Eloquent/Concerns/HasRelationships.php b/src/Database/Eloquent/Concerns/HasRelationships.php index 7323a7a..c302a89 100644 --- a/src/Database/Eloquent/Concerns/HasRelationships.php +++ b/src/Database/Eloquent/Concerns/HasRelationships.php @@ -40,11 +40,13 @@ public function getQualifiedKeyName() /** * Define a one-to-one relationship. * - * @param string $related - * @param string|array|null $foreignKey - * @param string|array|null $localKey + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne + * @param class-string $related + * @param string|array|null $foreignKey + * @param string|array|null $localKey + * + * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne */ public function hasOne($related, $foreignKey = null, $localKey = null) { @@ -74,12 +76,15 @@ public function hasOne($related, $foreignKey = null, $localKey = null) /** * Instantiate a new HasOne relationship. * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string|array $foreignKey - * @param string|array $localKey + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param TDeclaringModel $parent + * @param string|array $foreignKey + * @param string|array $localKey * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne + * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne */ protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localKey) { @@ -104,11 +109,13 @@ private function validateRelatedModel($related) /** * Define a one-to-many relationship. * - * @param string $related - * @param string|array|null $foreignKey - * @param string|array|null $localKey + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * + * @param class-string $related + * @param string|array|null $foreignKey + * @param string|array|null $localKey * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasMany + * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasMany */ public function hasMany($related, $foreignKey = null, $localKey = null) { @@ -138,12 +145,15 @@ public function hasMany($related, $foreignKey = null, $localKey = null) /** * Instantiate a new HasMany relationship. * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string|array $foreignKey - * @param string|array $localKey + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasMany + * @param \Illuminate\Database\Eloquent\Builder $query + * @param TDeclaringModel $parent + * @param string|array $foreignKey + * @param string|array $localKey + * + * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasMany */ protected function newHasMany(Builder $query, Model $parent, $foreignKey, $localKey) { @@ -153,12 +163,14 @@ protected function newHasMany(Builder $query, Model $parent, $foreignKey, $local /** * Define an inverse one-to-one or many relationship. * - * @param string $related - * @param string|array|null $foreignKey - * @param string|array|null $ownerKey - * @param string $relation + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * + * @param class-string $related + * @param string|array|null $foreignKey + * @param string|array|null $ownerKey + * @param string $relation * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo + * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo */ public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) { @@ -193,13 +205,16 @@ public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relat /** * Instantiate a new BelongsTo relationship. * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $child - * @param string|array $foreignKey - * @param string|array $ownerKey - * @param string $relation + * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param TDeclaringModel $child + * @param string|array $foreignKey + * @param string|array $ownerKey + * @param string $relation * - * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo + * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo */ protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) { diff --git a/src/Database/Eloquent/Relations/BelongsTo.php b/src/Database/Eloquent/Relations/BelongsTo.php index 7940a16..f8bddec 100755 --- a/src/Database/Eloquent/Relations/BelongsTo.php +++ b/src/Database/Eloquent/Relations/BelongsTo.php @@ -9,9 +9,9 @@ /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model - * @template TChildModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * - * @extends BaseBelongsTo + * @extends BaseBelongsTo */ class BelongsTo extends BaseBelongsTo { diff --git a/src/Database/Eloquent/Relations/HasMany.php b/src/Database/Eloquent/Relations/HasMany.php index 69f2117..f0c9039 100755 --- a/src/Database/Eloquent/Relations/HasMany.php +++ b/src/Database/Eloquent/Relations/HasMany.php @@ -7,8 +7,9 @@ /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * - * @extends BaseHasMany + * @extends BaseHasMany */ class HasMany extends BaseHasMany { diff --git a/src/Database/Eloquent/Relations/HasOne.php b/src/Database/Eloquent/Relations/HasOne.php index a810e60..1f38b08 100755 --- a/src/Database/Eloquent/Relations/HasOne.php +++ b/src/Database/Eloquent/Relations/HasOne.php @@ -8,8 +8,9 @@ /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model + * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * - * @extends BaseHasOne + * @extends BaseHasOne */ class HasOne extends BaseHasOne {