Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Concerns/HasEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait HasEvents
*
* Allows for object-based events for native Eloquent events.
*
* @var array
* @var array<string, string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
* @var array<string, string>
* @var array<string, class-string>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I missed this!

*/
protected $dispatchesEvents = [];

Expand Down Expand Up @@ -398,7 +398,7 @@ public static function flushEventListeners()
/**
* Get the event map for the model.
*
* @return array
* @return array<string, string>
*/
public function dispatchesEvents()
{
Expand Down
2 changes: 2 additions & 0 deletions types/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function test(User $user, Post $post, Comment $comment, Article $article): void
assertType('bool', $user->restore());
assertType('User', $user->restoreOrCreate());
assertType('User', $user->createOrRestore());

assertType('array<string, string>', $user->dispatchesEvents());
}

class Post extends Model
Expand Down
Loading