forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Add the ability to extend the generic types for DatabaseNotifi…
…cationCollection (laravel#47048) * Add the ability to extend the generic types * Update DatabaseNotificationCollection.php * Remove unused * Add tests * Fix style * rm lb * Updates localtion of type tests --------- Co-authored-by: Nuno Maduro <[email protected]>
- Loading branch information
1 parent
3ba111e
commit 56c9c7d
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use Illuminate\Notifications\DatabaseNotification; | ||
use Illuminate\Notifications\DatabaseNotificationCollection; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class CustomNotification extends DatabaseNotification | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* @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); |