From 04294a5df4ede2ff8027483cdb3fa3ea30451721 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sun, 26 Oct 2025 12:06:10 +0100 Subject: [PATCH 1/2] refactor: clean up and organize codebase --- Interfaces/PermissionInterface.php | 10 +++++----- Interfaces/RoleInterface.php | 2 +- Permission.php | 5 +++-- Role.php | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Interfaces/PermissionInterface.php b/Interfaces/PermissionInterface.php index 4322719..4aa74e2 100755 --- a/Interfaces/PermissionInterface.php +++ b/Interfaces/PermissionInterface.php @@ -4,11 +4,11 @@ interface PermissionInterface { - /** - * Add read permission - * @param int $role - * @return self - */ + /** + * Add read permission + * @param int $role + * @return self + */ public function read(int $role): self; /** diff --git a/Interfaces/RoleInterface.php b/Interfaces/RoleInterface.php index 7c87a2c..7d3f5bd 100755 --- a/Interfaces/RoleInterface.php +++ b/Interfaces/RoleInterface.php @@ -17,7 +17,7 @@ public function setUserRole(int $userRole): void; * @param string|null $queryStr r=1&i=1&u=1&d=1 */ public function set(array|int $roleKey, ?string $queryStr = null): void; - + /** * Get role int number from role key * @param string $roleTitle diff --git a/Permission.php b/Permission.php index 9faa979..bebd7db 100755 --- a/Permission.php +++ b/Permission.php @@ -1,4 +1,5 @@ $permInt) { $roleMethod = $this->getSymlink($role); - if (is_null($roleMethod)) { + if ($roleMethod === null) { $roleMethod = $role; } if (method_exists($this, $roleMethod)) { diff --git a/Role.php b/Role.php index 87e09e1..8b88ac6 100755 --- a/Role.php +++ b/Role.php @@ -1,4 +1,5 @@ setUserRole($userRole); } } @@ -87,7 +88,7 @@ public function hasRole(int $role): bool */ public function getPermission(int $roleKey): object { - if (is_null($this->userRole)) { + if ($this->userRole === null) { throw new RolesException("You need to specify the current users role with @setUserRole or the @constructer.", 1); } $this->validateRole($roleKey); From 4ff1f08e943fa2f1f24352f3a034995796392fa8 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sun, 26 Oct 2025 12:28:01 +0100 Subject: [PATCH 2/2] chore: minor adjustments --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 27fee1d..34c104f 100755 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.0" + "php": ">=8.2" }, "autoload": { "psr-4": {