cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:37:57 +01:00
parent c8195e6df5
commit a9188355c5
193 changed files with 306 additions and 63 deletions

View File

@@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
use function count;
/**
* Class EventController.

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use function count;
/**
* Class ParticipationController.

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use function in_array;
/**
* Add roles to existing groups.

View File

@@ -19,6 +19,7 @@ use DateTime;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function in_array;
/**
* Class Participation.

View File

@@ -15,6 +15,7 @@ use RuntimeException;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use function call_user_func;
use function count;
use function in_array;
/**

View File

@@ -27,6 +27,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
use function in_array;
use function is_array;
/**
* Class PickEventType.

View File

@@ -19,6 +19,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
use function count;
/**
* Search within Events.

View File

@@ -20,6 +20,8 @@ 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.
@@ -86,7 +88,7 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
public function supports($attribute, $subject)
{
return ($subject instanceof Event && in_array($attribute, self::ROLES))
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE]))
|| (null === $subject && self::SEE === $attribute);
}

View File

@@ -20,6 +20,8 @@ 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
{
@@ -83,7 +85,7 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
public function supports($attribute, $subject)
{
return ($subject instanceof Participation && in_array($attribute, self::ROLES))
|| ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
|| ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE]))
|| (null === $subject && self::SEE === $attribute);
}

View File

@@ -10,6 +10,8 @@
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use function count;
use function in_array;
/**
* Test the creation of participation controller.

View File

@@ -13,6 +13,7 @@ use Chill\EventBundle\Entity\Event;
use Chill\EventBundle\Search\EventSearch;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use function in_array;
/**
* Test the EventSearch class.

View File

@@ -22,6 +22,7 @@ use LogicException;
use RuntimeException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use function count;
/**
* Class TimelineEventProvider.