Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte authored and github-actions[bot] committed Dec 9, 2023
1 parent c24211a commit 299dd2c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/Models/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function users(): BelongsToMany
*
* @throws PermissionDoesNotExist
*/
public static function findByName(string $name, string $guardName = null): PermissionContract
public static function findByName(string $name, ?string $guardName = null): PermissionContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$permission = static::getPermission(['name' => $name, 'guard_name' => $guardName]);
Expand All @@ -104,7 +104,7 @@ public static function findByName(string $name, string $guardName = null): Permi
*
* @throws PermissionDoesNotExist
*/
public static function findById(int|string $id, string $guardName = null): PermissionContract
public static function findById(int|string $id, ?string $guardName = null): PermissionContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$permission = static::getPermission([(new static())->getKeyName() => $id, 'guard_name' => $guardName]);
Expand All @@ -121,7 +121,7 @@ public static function findById(int|string $id, string $guardName = null): Permi
*
* @return PermissionContract|Permission
*/
public static function findOrCreate(string $name, string $guardName = null): PermissionContract
public static function findOrCreate(string $name, ?string $guardName = null): PermissionContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$permission = static::getPermission(['name' => $name, 'guard_name' => $guardName]);
Expand Down
8 changes: 4 additions & 4 deletions src/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function users(): BelongsToMany
*
* @throws RoleDoesNotExist
*/
public static function findByName(string $name, string $guardName = null): RoleContract
public static function findByName(string $name, ?string $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);

Expand All @@ -113,7 +113,7 @@ public static function findByName(string $name, string $guardName = null): RoleC
*
* @return RoleContract|Role
*/
public static function findById(int|string $id, string $guardName = null): RoleContract
public static function findById(int|string $id, ?string $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);

Expand All @@ -131,7 +131,7 @@ public static function findById(int|string $id, string $guardName = null): RoleC
*
* @return RoleContract|Role
*/
public static function findOrCreate(string $name, string $guardName = null): RoleContract
public static function findOrCreate(string $name, ?string $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);

Expand Down Expand Up @@ -176,7 +176,7 @@ protected static function findByParam(array $params = []): ?RoleContract
*
* @throws PermissionDoesNotExist|GuardDoesNotMatch
*/
public function hasPermissionTo($permission, string $guardName = null): bool
public function hasPermissionTo($permission, ?string $guardName = null): bool
{
if ($this->getWildcardClass()) {
return $this->hasWildcardPermission($permission, $guardName);
Expand Down
2 changes: 1 addition & 1 deletion src/PermissionRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function forgetCachedPermissions()
return $this->cache->forget($this->cacheKey);
}

public function forgetWildcardPermissionIndex(Model $record = null): void
public function forgetWildcardPermissionIndex(?Model $record = null): void
{
if ($record) {
unset($this->wildcardPermissionsIndex[get_class($record)][$record->getKey()]);
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function syncRoles(...$roles)
*
* @param string|int|array|Role|Collection|\BackedEnum $roles
*/
public function hasRole($roles, string $guard = null): bool
public function hasRole($roles, ?string $guard = null): bool
{
$this->loadMissing('roles');

Expand Down Expand Up @@ -282,7 +282,7 @@ public function hasAnyRole(...$roles): bool
*
* @param string|array|Role|Collection|\BackedEnum $roles
*/
public function hasAllRoles($roles, string $guard = null): bool
public function hasAllRoles($roles, ?string $guard = null): bool
{
$this->loadMissing('roles');

Expand Down Expand Up @@ -324,7 +324,7 @@ public function hasAllRoles($roles, string $guard = null): bool
*
* @param string|array|Role|Collection $roles
*/
public function hasExactRoles($roles, string $guard = null): bool
public function hasExactRoles($roles, ?string $guard = null): bool
{
$this->loadMissing('roles');

Expand Down

0 comments on commit 299dd2c

Please sign in to comment.