apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -21,10 +21,6 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Role\Role;
use function count;
use function in_array;
/**
* Description of EventVoter.
@@ -90,14 +86,14 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
public function supports($attribute, $subject)
{
return ($subject instanceof Event && in_array($attribute, self::ROLES, true))
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE], true))
return ($subject instanceof Event && \in_array($attribute, self::ROLES, true))
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE], true))
|| (null === $subject && self::SEE === $attribute);
}
/**
* @param string $attribute
* @param Event $subject
* @param Event $subject
*
* @return bool
*/
@@ -121,7 +117,7 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
$centers = $this->authorizationHelper
->getReachableCenters($token->getUser(), $attribute);
return count($centers) > 0;
return \count($centers) > 0;
if (!$this->accessDecisionManager->decide($token, [PersonVoter::SEE], $person)) {
return false;

View File

@@ -21,10 +21,6 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Role\Role;
use function count;
use function in_array;
class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
@@ -87,13 +83,13 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
public function supports($attribute, $subject)
{
return ($subject instanceof Participation && in_array($attribute, self::ROLES, true))
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE], true))
return ($subject instanceof Participation && \in_array($attribute, self::ROLES, true))
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE], true))
|| (null === $subject && self::SEE === $attribute);
}
/**
* @param string $attribute
* @param string $attribute
* @param Participation $subject
*
* @return bool
@@ -118,7 +114,7 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
$centers = $this->authorizationHelper
->getReachableCenters($token->getUser(), $attribute);
return count($centers) > 0;
return \count($centers) > 0;
if (!$this->accessDecisionManager->decide($token, [PersonVoter::SEE], $person)) {
return false;