mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
cs: Fix code-style (using PHPCSFixer and PHPCS).
This commit is contained in:
@@ -39,6 +39,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;
|
||||
|
||||
/**
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\EventBundle\Controller;
|
||||
use Chill\EventBundle\Entity\EventType;
|
||||
use Chill\EventBundle\Form\EventTypeType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@@ -25,6 +25,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;
|
||||
|
||||
/**
|
||||
@@ -112,7 +113,9 @@ class ParticipationController extends AbstractController
|
||||
[
|
||||
'event_id' => current($participations)->getEvent()->getId(),
|
||||
'persons_ids' => implode(',', array_map(
|
||||
static function (Participation $p) { return $p->getPerson()->getId(); },
|
||||
static function (Participation $p) {
|
||||
return $p->getPerson()->getId();
|
||||
},
|
||||
$participations
|
||||
)),
|
||||
]
|
||||
@@ -648,7 +651,9 @@ class ParticipationController extends AbstractController
|
||||
/** @var \Doctrine\Common\Collections\ArrayCollection $peopleParticipating */
|
||||
$peopleParticipating = $peopleParticipating ??
|
||||
$participation->getEvent()->getParticipations()->map(
|
||||
static function (Participation $p) { return $p->getPerson()->getId(); }
|
||||
static function (Participation $p) {
|
||||
return $p->getPerson()->getId();
|
||||
}
|
||||
);
|
||||
// check that the user is not already in the event
|
||||
if ($peopleParticipating->contains($participation->getPerson()->getId())) {
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\EventBundle\Controller;
|
||||
use Chill\EventBundle\Entity\Status;
|
||||
use Chill\EventBundle\Form\StatusType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\RoleScope;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
@@ -172,15 +173,19 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->getRole()->getType()->getId() !==
|
||||
$this->getEvent()->getType()->getId()) {
|
||||
if (
|
||||
$this->getRole()->getType()->getId() !==
|
||||
$this->getEvent()->getType()->getId()
|
||||
) {
|
||||
$context->buildViolation('The role is not allowed with this event type')
|
||||
->atPath('role')
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if ($this->getStatus()->getType()->getId() !==
|
||||
$this->getEvent()->getType()->getId()) {
|
||||
if (
|
||||
$this->getStatus()->getType()->getId() !==
|
||||
$this->getEvent()->getType()->getId()
|
||||
) {
|
||||
$context->buildViolation('The status is not allowed with this event type')
|
||||
->atPath('status')
|
||||
->addViolation();
|
||||
|
@@ -16,6 +16,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
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;
|
||||
@@ -83,8 +84,10 @@ class EventChoiceLoader implements ChoiceLoaderInterface
|
||||
|
||||
$event = $this->eventRepository->find($value);
|
||||
|
||||
if ($this->hasCenterFilter()
|
||||
&& !in_array($event->getCenter(), $this->centers, true)) {
|
||||
if (
|
||||
$this->hasCenterFilter()
|
||||
&& !in_array($event->getCenter(), $this->centers, true)
|
||||
) {
|
||||
throw new RuntimeException('chosen an event not in correct center');
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@ 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;
|
||||
|
||||
@@ -170,10 +171,14 @@ class PickEventType extends AbstractType
|
||||
. 'option must be an instance of ' . Center::class);
|
||||
}
|
||||
|
||||
if (!in_array($c->getId(), array_map(
|
||||
static function (Center $c) { return $c->getId(); },
|
||||
$centers
|
||||
), true)) {
|
||||
if (
|
||||
!in_array($c->getId(), array_map(
|
||||
static function (Center $c) {
|
||||
return $c->getId();
|
||||
},
|
||||
$centers
|
||||
), true)
|
||||
) {
|
||||
throw new AccessDeniedException('The given center is not reachable');
|
||||
}
|
||||
$selectedCenters[] = $c;
|
||||
|
@@ -20,6 +20,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
@@ -174,7 +175,8 @@ class EventSearch extends AbstractSearch
|
||||
|
||||
if (
|
||||
(isset($terms['name']) || isset($terms['_default']))
|
||||
&& (!empty($terms['name']) || !empty($terms['_default']))) {
|
||||
&& (!empty($terms['name']) || !empty($terms['_default']))
|
||||
) {
|
||||
// the form with name:"xyz" has precedence
|
||||
$name = $terms['name'] ?? $terms['_default'];
|
||||
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use LogicException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
@@ -207,7 +208,9 @@ class TimelineEventProvider implements TimelineProviderInterface
|
||||
|
||||
foreach ($reachableCenters as $center) {
|
||||
$reachableCircleId = array_map(
|
||||
static function (Scope $scope) { return $scope->getId(); },
|
||||
static function (Scope $scope) {
|
||||
return $scope->getId();
|
||||
},
|
||||
$this->helper->getReachableCircles($this->user, $role, $person->getCenter())
|
||||
);
|
||||
$centerAndScopeLines[] = sprintf(
|
||||
|
Reference in New Issue
Block a user