Skip to content

Commit

Permalink
align type definitions to Laravel
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzolosa committed Dec 17, 2024
1 parent 90e80a9 commit b8445ea
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/HasChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait HasChildren
* Register a model event with the dispatcher.
*
* @param string $event
* @param Closure|string $callback
* @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback
*/
protected static function registerModelEvent($event, $callback): void
{
Expand Down Expand Up @@ -124,10 +124,13 @@ public function newFromBuilder($attributes = [], $connection = null): self
/**
* Define an inverse one-to-one or many relationship.
*
* @param string $related
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $related
* @param string|null $foreignKey
* @param string|null $ownerKey
* @param string|null $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<TRelatedModel, $this>
*/
public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null): BelongsTo
{
Expand All @@ -147,9 +150,12 @@ public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relat
/**
* Define a one-to-many relationship.
*
* @param string $related
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $related
* @param string|null $foreignKey
* @param string|null $localKey
* @return \Illuminate\Database\Eloquent\Relations\HasMany<TRelatedModel, $this>
*/
public function hasMany($related, $foreignKey = null, $localKey = null): HasMany
{
Expand All @@ -159,13 +165,16 @@ public function hasMany($related, $foreignKey = null, $localKey = null): HasMany
/**
* Define a many-to-many relationship.
*
* @param string $related
* @param string|null $table
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $related
* @param string|class-string<\Illuminate\Database\Eloquent\Model>|null $table
* @param string|null $foreignPivotKey
* @param string|null $relatedPivotKey
* @param string|null $parentKey
* @param string|null $relatedKey
* @param string|null $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<TRelatedModel, $this>
*/
public function belongsToMany(
$related, $table = null,
Expand Down

0 comments on commit b8445ea

Please sign in to comment.