Skip to content

Commit

Permalink
Permission: removed useless condition (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
adaamz authored and dg committed Mar 2, 2019
1 parent 55b6f3e commit 2082793
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Security/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function hasRole(string $role): bool
*/
private function checkRole(string $role, bool $throw = true): void
{
if (!is_string($role) || $role === '') {
if ($role === '') {
throw new Nette\InvalidArgumentException('Role must be a non-empty string.');

} elseif ($throw && !isset($this->roles[$role])) {
Expand Down Expand Up @@ -272,7 +272,7 @@ public function hasResource(string $resource): bool
*/
private function checkResource(string $resource, bool $throw = true): void
{
if (!is_string($resource) || $resource === '') {
if ($resource === '') {
throw new Nette\InvalidArgumentException('Resource must be a non-empty string.');

} elseif ($throw && !isset($this->resources[$resource])) {
Expand Down

0 comments on commit 2082793

Please sign in to comment.