-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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 (#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 <enunomaduro@gmail.com>
- Loading branch information
1 parent
ff152fa
commit 0cb3a55
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); |