Skip to content

Commit

Permalink
phpstan fix (#43) (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored and dg committed May 27, 2020
1 parent d0d253b commit 2eacede
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Bridges/SecurityDI/SecurityExtension.php
Expand Up @@ -50,6 +50,7 @@ public function getConfigSchema(): Nette\Schema\Schema

public function loadConfiguration()
{
/** @var object{debugger: bool, users: array, roles: array, resources: array} $config */
$config = $this->config;
$builder = $this->getContainerBuilder();

Expand Down
13 changes: 5 additions & 8 deletions src/Security/Permission.php
Expand Up @@ -597,20 +597,17 @@ public function isAllowed($role = self::ALL, $resource = self::ALL, $privilege =
break;
}
}
} else {
if (($result = $this->getRuleType($resource, null, $privilege)) !== null) { // look for rule on 'allRoles' pseudo-parent
break;

} elseif (($result = $this->getRuleType($resource, null, null)) !== null) {
break;
}
} elseif (($result = $this->getRuleType($resource, null, $privilege)) !== null) { // look for rule on 'allRoles' pseudo-parent
break;
} elseif (($result = $this->getRuleType($resource, null, null)) !== null) {
break;
}

$resource = $this->resources[$resource]['parent']; // try next Resource
} while (true);

$this->queriedRole = $this->queriedResource = null;
return $result;
return $result ?? false;
}


Expand Down
2 changes: 2 additions & 0 deletions tests/phpstan.neon
Expand Up @@ -3,3 +3,5 @@ includes:

parameters:
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Variable \$this in isset\(\) always exists and is not nullable\.#'

0 comments on commit 2eacede

Please sign in to comment.