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

@@ -25,7 +25,7 @@ use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\MainBundle\Entity\Center;
/**
*
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
@@ -33,13 +33,13 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
{
const STATS = 'CHILL_ACTIVITY_STATS';
const LISTS = 'CHILL_ACTIVITY_LIST';
/**
*
* @var AuthorizationHelper
*/
protected $helper;
public function __construct(AuthorizationHelper $helper)
{
$this->helper = $helper;
@@ -54,15 +54,15 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
{
return array(Center::class);
}
protected function supports($attribute, $subject)
{
if ($subject instanceof Center
if ($subject instanceof Center
&& \in_array($attribute, $this->getAttributes())) {
return true;
}
return false;
}
@@ -71,22 +71,22 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
return false;
}
return $this->helper->userHasAccess($user, $object, $attribute);
}
public function getRoles()
public function getRoles(): array
{
return $this->getAttributes();
}
public function getRolesWithoutScope()
public function getRolesWithoutScope(): array
{
return $this->getAttributes();
}
public function getRolesWithHierarchy()
public function getRolesWithHierarchy(): array
{
return [ 'Activity' => $this->getRoles() ];
return ['Activity' => $this->getRoles()];
}
}