mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
phpstan, rector, phpcs fixes
This commit is contained in:
parent
3d6ffea58e
commit
70b104d41e
@ -23,11 +23,11 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Csv;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Ods;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@ -41,8 +41,10 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
/**
|
||||
* Class EventController.
|
||||
@ -59,9 +61,8 @@ final class EventController extends AbstractController
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly PaginatorFactory $paginator,
|
||||
private readonly Security $security,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
private readonly ManagerRegistry $managerRegistry,
|
||||
private readonly SerializerInterface $serializer,
|
||||
|
||||
) {}
|
||||
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'POST', 'DELETE'])]
|
||||
@ -172,6 +173,8 @@ final class EventController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to create a new Event entity.
|
||||
*
|
||||
* @throws ExceptionInterface
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])]
|
||||
public function newAction(?Center $center, Request $request): Response
|
||||
|
@ -200,7 +200,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
$this->animators->removeElement($tp);
|
||||
}
|
||||
|
||||
public function getCenter(): ?Center
|
||||
public function getCenter(): Center
|
||||
{
|
||||
return $this->center;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ class EventBudgetElement
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getAmount(): float
|
||||
{
|
||||
return (float) $this->amount;
|
||||
|
@ -80,24 +80,14 @@ class EventTheme
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active.
|
||||
*
|
||||
* @return EventTheme
|
||||
*/
|
||||
public function setIsActive(bool $active): static
|
||||
public function setIsActive(bool $active): self
|
||||
{
|
||||
$this->isActive = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set label.
|
||||
*
|
||||
* @return EventTheme
|
||||
*/
|
||||
public function setName(array $label): static
|
||||
public function setName(array $label): self
|
||||
{
|
||||
$this->name = $label;
|
||||
|
||||
@ -130,23 +120,9 @@ class EventTheme
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function getDescendants(): Collection
|
||||
public function hasChildren(): bool
|
||||
{
|
||||
$descendants = new ArrayCollection();
|
||||
|
||||
foreach ($this->getChildren() as $child) {
|
||||
if (!$descendants->contains($child)) {
|
||||
$descendants->add($child);
|
||||
|
||||
foreach ($child->getDescendants() as $descendantsOfChild) {
|
||||
if (!$descendants->contains($descendantsOfChild)) {
|
||||
$descendants->add($descendantsOfChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $descendants;
|
||||
return 0 < $this->getChildren()->count();
|
||||
}
|
||||
|
||||
public function hasParent(): bool
|
||||
|
@ -108,7 +108,7 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
||||
return 'Exports of events';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return match ($key) {
|
||||
'event_id' => fn ($value) => '_header' === $value ? 'export.event.list.'.$key : $value,
|
||||
@ -258,21 +258,21 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
||||
break;
|
||||
|
||||
case 'event_type':
|
||||
if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.type')) {
|
||||
if (!$this->hasJoin($qb, 'event.type')) {
|
||||
$qb->leftJoin('event.type', 'type');
|
||||
}
|
||||
$qb->addSelect('type.name AS event_type');
|
||||
break;
|
||||
|
||||
case 'event_center':
|
||||
if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.center')) {
|
||||
if (!$this->hasJoin($qb, 'event.center')) {
|
||||
$qb->leftJoin('event.center', 'center');
|
||||
}
|
||||
$qb->addSelect('center.name AS event_center');
|
||||
break;
|
||||
|
||||
case 'event_moderator':
|
||||
if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.moderator')) {
|
||||
if (!$this->hasJoin($qb, 'event.moderator')) {
|
||||
$qb->leftJoin('event.moderator', 'user');
|
||||
}
|
||||
$qb->addSelect('user.username AS event_moderator');
|
||||
@ -283,7 +283,7 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
||||
break;
|
||||
|
||||
case 'event_location':
|
||||
if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.location')) {
|
||||
if (!$this->hasJoin($qb, 'event.location')) {
|
||||
$qb->leftJoin('event.location', 'location');
|
||||
}
|
||||
$qb->addSelect('location.name AS event_location');
|
||||
|
@ -25,7 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class AddEventBudgetElementType extends AbstractType
|
||||
{
|
||||
public function __construct(private EventBudgetKindRepository $kindRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
public function __construct(private readonly EventBudgetKindRepository $kindRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
|
@ -12,11 +12,11 @@ declare(strict_types=1);
|
||||
namespace Chill\EventBundle\Form;
|
||||
|
||||
use Chill\EventBundle\Entity\BudgetTypeEnum;
|
||||
use Chill\EventBundle\Entity\EventBudgetKind;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@ -48,6 +48,6 @@ class EventBudgetKindType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('class', ChargeKind::class);
|
||||
->setDefault('class', EventBudgetKind::class);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class EventThemeType extends AbstractType
|
||||
'class' => EventTheme::class,
|
||||
'required' => false,
|
||||
'choice_label' => fn (EventTheme $theme): ?string => $this->translatableStringHelper->localize($theme->getName()),
|
||||
'mapped' => 'create' === $options['step'],
|
||||
'mapped' => 'create' == $options['step'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,6 @@ class EventType extends AbstractType
|
||||
->setAllowedTypes('role', 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
// as the js shares some hardcoded items from the activity bundle, we have to rewrite block prefix
|
||||
|
@ -23,11 +23,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class PickEventTypeType extends AbstractType
|
||||
{
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $helper)
|
||||
public function __construct(protected TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $helper;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||
|
@ -24,5 +24,4 @@ class EventBudgetElementRepository extends ServiceEntityRepository
|
||||
{
|
||||
parent::__construct($registry, EventBudgetElement::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,5 +34,4 @@ class EventThemeRepository extends ServiceEntityRepository
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
Loading…
x
Reference in New Issue
Block a user