fix: Strict types interfaces: VoterHelperInterface, ProvideRoleHierarchyInterface and ProvideRoleInterface.

This commit is contained in:
Pol Dellaiera
2021-11-23 10:40:34 +01:00
parent 05dda33a7a
commit 328b4c4596
21 changed files with 187 additions and 255 deletions

View File

@@ -68,13 +68,13 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
}
if ($subject instanceof AccompanyingPeriod) {
if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
if (\in_array($attribute, [self::EDIT, self::DELETE])) {
return false;
}
}
if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) {
// only creator can see, edit, delete, etc.
if ($subject->getCreatedBy() === $token->getUser()
@@ -84,7 +84,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
return false;
}
// if confidential, only the referent can see it
if ($subject->isConfidential()) {
return $token->getUser() === $subject->getUser();
@@ -94,18 +94,18 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
public function getRoles()
public function getRoles(): array
{
return self::ALL;
}
public function getRolesWithoutScope()
public function getRolesWithoutScope(): array
{
return [];
}
public function getRolesWithHierarchy()
public function getRolesWithHierarchy(): array
{
return [ 'Accompanying period' => $this->getRoles() ];
return ['Accompanying period' => $this->getRoles()];
}
}