Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Hesselberg authored May 12, 2023
1 parent 3b3e22a commit da93203
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions types/Database/Eloquent/DatabaseNotificationCollection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use function PHPStan\Testing\assertType;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;

class CustomNotification extends DatabaseNotification
{
/**
* @param array<int, CustomNotification> $models
*/
public function newCollection(array $models = []): CustomNotificationCollection
{
return new CustomNotificationCollection($models);
}
}

/**
* @extends DatabaseNotificationCollection<int, CustomNotification>
*/
class CustomNotificationCollection extends DatabaseNotificationCollection
{
}

$databaseNotificationsCollection = DatabaseNotification::all();
assertType('Illuminate\Database\Eloquent\Collection<int, Illuminate\Notifications\DatabaseNotification>', $databaseNotificationsCollection);


$customNotificationsCollection = CustomNotification::all();
assertType('Illuminate\Database\Eloquent\Collection<int, CustomNotification>', $customNotificationsCollection);

0 comments on commit da93203

Please sign in to comment.