diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 448d57f2..a646b81e 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -105,12 +105,12 @@ public function hasRole(string $role): bool * Checks whether Role is valid and exists in the list. * @throws Nette\InvalidStateException */ - private function checkRole(string $role, bool $throw = true): void + private function checkRole(string $role, bool $exists = true): void { if ($role === '') { throw new Nette\InvalidArgumentException('Role must be a non-empty string.'); - } elseif ($throw && !isset($this->roles[$role])) { + } elseif ($exists && !isset($this->roles[$role])) { throw new Nette\InvalidStateException("Role '$role' does not exist."); } } @@ -270,12 +270,12 @@ public function hasResource(string $resource): bool * Checks whether Resource is valid and exists in the list. * @throws Nette\InvalidStateException */ - private function checkResource(string $resource, bool $throw = true): void + private function checkResource(string $resource, bool $exists = true): void { if ($resource === '') { throw new Nette\InvalidArgumentException('Resource must be a non-empty string.'); - } elseif ($throw && !isset($this->resources[$resource])) { + } elseif ($exists && !isset($this->resources[$resource])) { throw new Nette\InvalidStateException("Resource '$resource' does not exist."); } }