Merge pull request #20003 from nextcloud/enh/19989/type-additional-scoes

Annotate $additionalScopes so the IDE knows what type $scopeCandidate is
This commit is contained in:
Joas Schilling 2020-03-18 15:32:39 +01:00 committed by GitHub
commit 570f3c7798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -163,6 +163,10 @@ class Manager implements IManager {
return $operations;
}
/**
* @param string $operationClass
* @return ScopeContext[]
*/
public function getAllConfiguredScopesForOperation(string $operationClass): array {
static $scopesByOperation = [];
if (isset($scopesByOperation[$operationClass])) {

View File

@ -134,9 +134,9 @@ class RuleMatcher implements IRuleMatcher {
}
if($this->entity instanceof IEntity) {
/** @var ScopeContext[] $additionalScopes */
$additionalScopes = $this->manager->getAllConfiguredScopesForOperation($class);
foreach ($additionalScopes as $hash => $scopeCandidate) {
/** @var ScopeContext $scopeCandidate */
if ($scopeCandidate->getScope() !== IManager::SCOPE_USER || in_array($scopeCandidate, $scopes)) {
continue;
}