diff --git a/src/Rbac/Role/HierarchicalRole.php b/src/Rbac/Role/HierarchicalRole.php index 714312f..5ab2432 100644 --- a/src/Rbac/Role/HierarchicalRole.php +++ b/src/Rbac/Role/HierarchicalRole.php @@ -9,8 +9,6 @@ namespace Rbac\Role; -use Traversable; - /** * Simple implementation for a hierarchical role */ @@ -19,12 +17,12 @@ class HierarchicalRole extends Role implements HierarchicalRoleInterface /** * @var array|RoleInterface[] */ - protected array $children = []; + protected $children = []; /** * {@inheritDoc} */ - public function hasChildren(): bool + public function hasChildren() { return !empty($this->children); } @@ -32,7 +30,7 @@ public function hasChildren(): bool /** * {@inheritDoc} */ - public function getChildren(): Traversable|array + public function getChildren() { return $this->children; } @@ -42,7 +40,7 @@ public function getChildren(): Traversable|array * * @param RoleInterface $child */ - public function addChild(RoleInterface $child): void + public function addChild(RoleInterface $child) { $this->children[$child->getName()] = $child; } diff --git a/src/Rbac/Role/HierarchicalRoleInterface.php b/src/Rbac/Role/HierarchicalRoleInterface.php index f63589d..9dbb5ea 100644 --- a/src/Rbac/Role/HierarchicalRoleInterface.php +++ b/src/Rbac/Role/HierarchicalRoleInterface.php @@ -23,12 +23,12 @@ interface HierarchicalRoleInterface extends RoleInterface * * @return bool */ - public function hasChildren(): bool; + public function hasChildren(); /** * Get child roles * * @return array|RoleInterface[]|Traversable */ - public function getChildren(): array|Traversable; + public function getChildren(); } diff --git a/src/Rbac/Role/Role.php b/src/Rbac/Role/Role.php index 1b855dd..f2b5a3f 100644 --- a/src/Rbac/Role/Role.php +++ b/src/Rbac/Role/Role.php @@ -18,19 +18,19 @@ class Role implements RoleInterface /** * @var string */ - protected string $name; + protected $name; /** * @var string[] */ - protected array $permissions = []; + protected $permissions = []; /** * Constructor * * @param string $name */ - public function __construct(string $name) + public function __construct($name) { $this->name = (string) $name; } @@ -38,7 +38,7 @@ public function __construct(string $name) /** * {@inheritDoc} */ - public function getName(): string + public function getName() { return $this->name; } @@ -48,7 +48,7 @@ public function getName(): string * * @param string $permission */ - public function addPermission(string $permission): void + public function addPermission($permission) { $this->permissions[(string) $permission] = $permission; } @@ -56,10 +56,10 @@ public function addPermission(string $permission): void /** * Checks if a permission exists for this role * - * @param mixed $permission + * @param string $permission * @return bool */ - public function hasPermission(mixed $permission): bool + public function hasPermission($permission) { return isset($this->permissions[(string) $permission]); } diff --git a/src/Rbac/Role/RoleInterface.php b/src/Rbac/Role/RoleInterface.php index 59aabc5..04f23fd 100644 --- a/src/Rbac/Role/RoleInterface.php +++ b/src/Rbac/Role/RoleInterface.php @@ -21,7 +21,7 @@ interface RoleInterface * * @return string */ - public function getName(): string; + public function getName(); /** * Checks if a permission exists for this role (it does not check child roles) @@ -29,5 +29,5 @@ public function getName(): string; * @param mixed $permission * @return bool */ - public function hasPermission(mixed $permission): bool; + public function hasPermission($permission); } diff --git a/src/Rbac/Traversal/Strategy/GeneratorStrategy.php b/src/Rbac/Traversal/Strategy/GeneratorStrategy.php index 4c1f224..63574f0 100644 --- a/src/Rbac/Traversal/Strategy/GeneratorStrategy.php +++ b/src/Rbac/Traversal/Strategy/GeneratorStrategy.php @@ -24,7 +24,7 @@ class GeneratorStrategy implements TraversalStrategyInterface * @param RoleInterface[]|Traversable $roles * @return Generator */ - public function getRolesIterator($roles): Generator + public function getRolesIterator($roles) { foreach ($roles as $role) { yield $role; diff --git a/src/Rbac/Traversal/Strategy/RecursiveRoleIteratorStrategy.php b/src/Rbac/Traversal/Strategy/RecursiveRoleIteratorStrategy.php index 55e19e0..93b3a52 100644 --- a/src/Rbac/Traversal/Strategy/RecursiveRoleIteratorStrategy.php +++ b/src/Rbac/Traversal/Strategy/RecursiveRoleIteratorStrategy.php @@ -22,7 +22,7 @@ class RecursiveRoleIteratorStrategy implements TraversalStrategyInterface * @param RoleInterface[] $roles * @return RecursiveIteratorIterator */ - public function getRolesIterator($roles): RecursiveIteratorIterator + public function getRolesIterator($roles) { return new RecursiveIteratorIterator( new RecursiveRoleIterator($roles), diff --git a/src/Rbac/Traversal/Strategy/TraversalStrategyInterface.php b/src/Rbac/Traversal/Strategy/TraversalStrategyInterface.php index a8213cd..dfe5046 100644 --- a/src/Rbac/Traversal/Strategy/TraversalStrategyInterface.php +++ b/src/Rbac/Traversal/Strategy/TraversalStrategyInterface.php @@ -21,5 +21,5 @@ interface TraversalStrategyInterface * @param RoleInterface[]|Traversable * @return Traversable */ - public function getRolesIterator($roles): Traversable; + public function getRolesIterator($roles); }