Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Interfaces/PermissionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/RoleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Permission.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace MaplePHP\Roles;
Expand Down Expand Up @@ -95,11 +96,11 @@ public function delete(int $role): self
*/
final protected function propagate(?string $propagate = null): void
{
if (!is_null($propagate)) {
if ($propagate !== null) {
parse_str($propagate, $arr);
foreach ($arr as $role => $permInt) {
$roleMethod = $this->getSymlink($role);
if (is_null($roleMethod)) {
if ($roleMethod === null) {
$roleMethod = $role;
}
if (method_exists($this, $roleMethod)) {
Expand Down
5 changes: 3 additions & 2 deletions Role.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace MaplePHP\Roles;
Expand All @@ -24,7 +25,7 @@ class Role implements RoleInterface
*/
public function __construct(?int $userRole = null)
{
if (!is_null($userRole)) {
if ($userRole !== null) {
$this->setUserRole($userRole);
}
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=8.0"
"php": ">=8.2"
},
"autoload": {
"psr-4": {
Expand Down