From 9b3143ecd9dd47393528c5c0d24e338bf3e5382d Mon Sep 17 00:00:00 2001 From: RazeSoldier Date: Wed, 26 Feb 2025 01:03:04 +0800 Subject: [PATCH] Fix implicitly nullable parameter Starting PHP 8.4, implicitly nullable parameter will trigger a deprecated message. And will remove the support in PHP 9 per RFC https://wiki.php.net/rfc/deprecate-implicitly-nullable-types --- src/Checkers/User/UserDefaultChecker.php | 2 +- src/Contracts/Role.php | 2 +- src/Models/Role.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Checkers/User/UserDefaultChecker.php b/src/Checkers/User/UserDefaultChecker.php index 28c94106..9b72fd97 100644 --- a/src/Checkers/User/UserDefaultChecker.php +++ b/src/Checkers/User/UserDefaultChecker.php @@ -227,7 +227,7 @@ private function hidrateRole(string $class, Model|array $data): Role /** * Check if a role or permission is added to the user in a same team. */ - private function isInSameTeam($rolePermission, int|string $teamId = null): bool + private function isInSameTeam($rolePermission, int|string|null $teamId = null): bool { if ( ! Config::get('laratrust.teams.enabled') diff --git a/src/Contracts/Role.php b/src/Contracts/Role.php index 2da7b699..266ee619 100644 --- a/src/Contracts/Role.php +++ b/src/Contracts/Role.php @@ -53,5 +53,5 @@ public function givePermissions(iterable $permissions): static; /** * Detach multiple permissions from current role. */ - public function removePermissions(iterable $permissions = null): static; + public function removePermissions(?iterable $permissions = null): static; } diff --git a/src/Models/Role.php b/src/Models/Role.php index 98ac8764..a7ef6670 100644 --- a/src/Models/Role.php +++ b/src/Models/Role.php @@ -152,7 +152,7 @@ public function givePermissions(iterable $permissions): static return $this; } - public function removePermissions(iterable $permissions = null): static + public function removePermissions(?iterable $permissions = null): static { if (! $permissions) { $this->syncPermissions([]);