update php-cs-fixer and rector + fix rules

This commit is contained in:
Julien Fastré 2024-01-09 13:50:45 +01:00
parent a63b40fb6c
commit 825cd127d1
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
79 changed files with 220 additions and 229 deletions

View File

@ -112,6 +112,7 @@ $rules = array_merge(
],
'sort_algorithm' => 'alpha',
],
'single_line_empty_body' => true,
],
$rules,
$riskyRules,

View File

@ -92,7 +92,7 @@
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": ">= 7.5",
"rector/rector": "^0.17.7",
"rector/rector": "^0.19.0",
"symfony/debug-bundle": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/maker-bundle": "^1.20",

View File

@ -50,9 +50,6 @@ return static function (RectorConfig $rectorConfig): void {
// skip some path...
$rectorConfig->skip([
// we need to discuss this: are we going to have FALSE in tests instead of an error ?
\Rector\Php71\Rector\FuncCall\CountOnNullRector::class,
// we must adapt service definition
\Rector\Symfony\Symfony28\Rector\MethodCall\GetToConstructorInjectionRector::class,
\Rector\Symfony\Symfony34\Rector\Closure\ContainerGetNameToTypeInTestsRector::class,

View File

@ -675,8 +675,8 @@ final class ActivityController extends AbstractController
throw $this->createNotFoundException('Accompanying Period not found');
}
// TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
// TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
} else {
throw $this->createNotFoundException('Person or Accompanying Period not found');
}

View File

@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class ActivityReasonCategoryController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new ActivityReasonCategory entity.
*
@ -59,7 +58,7 @@ class ActivityReasonCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
$entity = $em->getRepository(ActivityReasonCategory::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
@ -82,7 +81,7 @@ class ActivityReasonCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->findAll();
$entities = $em->getRepository(ActivityReasonCategory::class)->findAll();
return $this->render('@ChillActivity/ActivityReasonCategory/index.html.twig', [
'entities' => $entities,
@ -114,7 +113,7 @@ class ActivityReasonCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
$entity = $em->getRepository(ActivityReasonCategory::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
@ -134,7 +133,7 @@ class ActivityReasonCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
$entity = $em->getRepository(ActivityReasonCategory::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');

View File

@ -60,7 +60,7 @@ class ActivityReasonController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
$entity = $em->getRepository(ActivityReason::class)->find($id);
if (null === $entity) {
throw new NotFoundHttpException('Unable to find ActivityReason entity.');
@ -115,7 +115,7 @@ class ActivityReasonController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
$entity = $em->getRepository(ActivityReason::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
@ -135,7 +135,7 @@ class ActivityReasonController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
$entity = $em->getRepository(ActivityReason::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');

View File

@ -36,6 +36,7 @@ use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Context;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName;

View File

@ -404,7 +404,7 @@ class ActivityType extends AbstractType
->setAllowedTypes('center', ['null', Center::class, 'array'])
->setAllowedTypes('role', ['string'])
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']);
->setAllowedTypes('accompanyingPeriod', [AccompanyingPeriod::class, 'null']);
}
public function getBlockPrefix(): string

View File

@ -27,7 +27,7 @@ final readonly class PersonMenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
/** @var \Chill\PersonBundle\Entity\Person $person */
/** @var Person $person */
$person = $parameters['person'];
if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) {

View File

@ -310,7 +310,7 @@ final class ActivityControllerTest extends WebTestCase
}
/**
* @return \Chill\ActivityBundle\Entity\ActivityType
* @return ActivityType
*/
private function getRandomActivityType()
{

View File

@ -35,7 +35,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
$this->filter = self::getContainer()->get('chill.activity.export.person_having_an_activity_between_date_filter');
$request = $this->prophesize()
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
->willExtend(Request::class);
$request->getLocale()->willReturn('fr');

View File

@ -58,7 +58,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
$this->assertTrue($form->isSynchronized());
$this->assertInstanceOf(
\Chill\ActivityBundle\Entity\ActivityType::class,
ActivityType::class,
$form->getData()['type'],
'The data is an instance of Chill\\ActivityBundle\\Entity\\ActivityType'
);
@ -83,7 +83,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
}
/**
* @return \Chill\ActivityBundle\Entity\ActivityType
* @return ActivityType
*/
protected function getRandomType(mixed $active = true)
{

View File

@ -407,7 +407,7 @@ class CalendarController extends AbstractController
}
/** @var Calendar $entity */
$entity = $em->getRepository(\Chill\CalendarBundle\Entity\Calendar::class)->find($id);
$entity = $em->getRepository(Calendar::class)->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Calendar entity.');

View File

@ -86,7 +86,7 @@ class CreateFieldsOnGroupCommand extends Command
$em = $this->entityManager;
$customFieldsGroups = $em
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->getRepository(CustomFieldsGroup::class)
->findAll();
if (0 === \count($customFieldsGroups)) {

View File

@ -121,7 +121,7 @@ class CustomFieldController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomField::class)->find($id);
$entity = $em->getRepository(CustomField::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find CustomField entity.');

View File

@ -37,7 +37,10 @@ class CustomFieldsGroupController extends AbstractController
* CustomFieldsGroupController constructor.
*/
public function __construct(
private readonly CustomFieldProvider $customFieldProvider, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
private readonly CustomFieldProvider $customFieldProvider,
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* Creates a new CustomFieldsGroup entity.
@ -79,7 +82,7 @@ class CustomFieldsGroupController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id);
$entity = $em->getRepository(CustomFieldsGroup::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
@ -102,7 +105,7 @@ class CustomFieldsGroupController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$cfGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->findAll();
$cfGroups = $em->getRepository(CustomFieldsGroup::class)->findAll();
$defaultGroups = $this->getDefaultGroupsId();
$makeDefaultFormViews = [];
@ -134,13 +137,13 @@ class CustomFieldsGroupController extends AbstractController
$em = $this->managerRegistry->getManager();
$cFGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->findOneById($cFGroupId);
$cFGroup = $em->getRepository(CustomFieldsGroup::class)->findOneById($cFGroupId);
if (!$cFGroup) {
throw $this->createNotFoundException('customFieldsGroup not found with '."id {$cFGroupId}");
}
$cFDefaultGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup::class)
$cFDefaultGroup = $em->getRepository(CustomFieldsDefaultGroup::class)
->findOneByEntity($cFGroup->getEntity());
if ($cFDefaultGroup) {
@ -195,7 +198,7 @@ class CustomFieldsGroupController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id);
$entity = $em->getRepository(CustomFieldsGroup::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.');
@ -239,7 +242,7 @@ class CustomFieldsGroupController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id);
$entity = $em->getRepository(CustomFieldsGroup::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
@ -263,7 +266,7 @@ class CustomFieldsGroupController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id);
$entity = $em->getRepository(CustomFieldsGroup::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');

View File

@ -29,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
final class CustomFieldsChoiceTest extends KernelTestCase
{
/**
* @var \Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
* @var CustomFieldChoice
*/
private $cfChoice;

View File

@ -43,7 +43,7 @@ final class CustomFieldsTextTest extends WebTestCase
$customField
);
$this->assertInstanceOf(
\Chill\CustomFieldsBundle\CustomFields\CustomFieldText::class,
CustomFieldText::class,
$customField
);
}

View File

@ -47,7 +47,7 @@ final readonly class OnGenerationFails implements EventSubscriberInterface
return;
}
/** @var \Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage $message */
/** @var RequestGenerationMessage $message */
$message = $event->getEnvelope()->getMessage();
$this->logger->error(self::LOG_PREFIX.'Docgen failed', [

View File

@ -25,9 +25,8 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class DocumentCategoryController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE")
*/
@ -35,7 +34,7 @@ class DocumentCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$documentCategory = $em
->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class)
->getRepository(DocumentCategory::class)
->findOneBy(
['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle]
);
@ -55,7 +54,7 @@ class DocumentCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$documentCategory = $em
->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class)
->getRepository(DocumentCategory::class)
->findOneBy(
['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle]
);
@ -138,7 +137,7 @@ class DocumentCategoryController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$documentCategory = $em
->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class)
->getRepository(DocumentCategory::class)
->findOneBy(
['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle]
);

View File

@ -41,7 +41,7 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*
* @var \Chill\MainBundle\Entity\Scope The document's center
* @var Scope The document's center
*/
private ?\Chill\MainBundle\Entity\Scope $scope = null;

View File

@ -93,7 +93,7 @@ class EventController extends AbstractController
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
$event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->findOneBy([
$event = $em->getRepository(Event::class)->findOneBy([
'id' => $event_id,
]);
@ -147,7 +147,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id);
$entity = $em->getRepository(Event::class)->find($event_id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Event entity.');
@ -174,7 +174,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');
@ -188,11 +188,11 @@ class EventController extends AbstractController
$person->getCenter()
);
$total = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->countByPerson($person_id);
$total = $em->getRepository(Participation::class)->countByPerson($person_id);
$paginator = $this->paginator->create($total);
$participations = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findByPersonInCircle(
$participations = $em->getRepository(Participation::class)->findByPersonInCircle(
$person_id,
$reachablesCircles,
$paginator->getCurrentPage()->getFirstItemNumber(),
@ -353,7 +353,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id);
$entity = $em->getRepository(Event::class)->find($event_id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Event entity.');

View File

@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class EventTypeController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new EventType entity.
*
@ -62,7 +61,7 @@ class EventTypeController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@ -84,7 +83,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@ -109,7 +108,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->findAll();
$entities = $em->getRepository(EventType::class)->findAll();
return $this->render('@ChillEvent/EventType/index.html.twig', [
'entities' => $entities,
@ -141,7 +140,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@ -164,7 +163,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');

View File

@ -34,7 +34,10 @@ class ParticipationController extends AbstractController
* ParticipationController constructor.
*/
public function __construct(
private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
private readonly LoggerInterface $logger,
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
@ -240,7 +243,7 @@ class ParticipationController extends AbstractController
public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$em = $this->managerRegistry->getManager();
$participation = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findOneBy([
$participation = $em->getRepository(Participation::class)->findOneBy([
'id' => $participation_id,
]);
@ -320,7 +323,7 @@ class ParticipationController extends AbstractController
*/
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$event = $this->managerRegistry->getRepository(\Chill\EventBundle\Entity\Event::class)
$event = $this->managerRegistry->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@ -456,8 +459,8 @@ class ParticipationController extends AbstractController
*/
public function updateMultipleAction(mixed $event_id, Request $request)
{
/** @var \Chill\EventBundle\Entity\Event $event */
$event = $this->managerRegistry->getRepository(\Chill\EventBundle\Entity\Event::class)
/** @var Event $event */
$event = $this->managerRegistry->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@ -499,7 +502,7 @@ class ParticipationController extends AbstractController
}
/**
* @return \Symfony\Component\Form\FormInterface
* @return FormInterface
*/
protected function createEditFormMultiple(Collection $participations, Event $event)
{
@ -558,7 +561,7 @@ class ParticipationController extends AbstractController
// prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given`
if (null !== $event_id) {
$event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)
$event = $em->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@ -752,7 +755,7 @@ class ParticipationController extends AbstractController
}
/**
* @return \Symfony\Component\Form\FormInterface
* @return FormInterface
*/
private function createDeleteForm($participation_id)
{

View File

@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class RoleController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new Role entity.
*
@ -62,7 +61,7 @@ class RoleController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@ -84,7 +83,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@ -109,7 +108,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->findAll();
$entities = $em->getRepository(Role::class)->findAll();
return $this->render('@ChillEvent/Role/index.html.twig', [
'entities' => $entities,
@ -141,7 +140,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@ -164,7 +163,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');

View File

@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class StatusController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new Status entity.
*
@ -62,7 +61,7 @@ class StatusController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@ -84,7 +83,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@ -109,7 +108,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->findAll();
$entities = $em->getRepository(Status::class)->findAll();
return $this->render('@ChillEvent/Status/index.html.twig', [
'entities' => $entities,
@ -141,7 +140,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@ -164,7 +163,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');

View File

@ -73,7 +73,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
->findBy(['center' => $center]);
$events = $this->createEvents($center, $manager);
/** @var \Chill\PersonBundle\Entity\Person $person */
/** @var Person $person */
foreach ($people as $person) {
$nb = random_int(0, 3);

View File

@ -52,7 +52,7 @@ final class EventSearchTest extends WebTestCase
/**
* The eventSearch service, which is used to search events.
*
* @var \Chill\EventBundle\Search\EventSearch
* @var EventSearch
*/
protected $eventSearch;

View File

@ -31,9 +31,8 @@ abstract class AbstractCRUDController extends AbstractController
* This configuration si defined by `chill_main['crud']` or `chill_main['apis']`
*/
protected array $crudConfig = [];
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* get the role given from the config.

View File

@ -23,9 +23,8 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
class ApiController extends AbstractCRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Base method for handling api action.
*

View File

@ -60,7 +60,6 @@ class CRUDRoutesLoader extends Loader
/**
* @param null $type
*
*/
public function supports($resource, $type = null): bool
{

View File

@ -83,7 +83,7 @@ class LoadAndUpdateLanguagesCommand extends Command
$languages = [];
foreach ($chillAvailableLanguages as $avLang) {
$languages[$avLang] = \Symfony\Component\Intl\Languages::getNames();
$languages[$avLang] = Languages::getNames();
}
foreach (Languages::getNames() as $code => $lang) {
@ -105,7 +105,7 @@ class LoadAndUpdateLanguagesCommand extends Command
$languageDB = $em->getRepository(Language::class)->find($code);
if (null === $languageDB) {
$languageDB = new \Chill\MainBundle\Entity\Language();
$languageDB = new Language();
$languageDB->setId($code);
$em->persist($languageDB);
}

View File

@ -40,7 +40,7 @@ class LoadCountriesCommand extends Command
$names[$language] = Countries::getName($code, $language);
}
$country = new \Chill\MainBundle\Entity\Country();
$country = new Country();
$country->setName($names)->setCountryCode($code);
$countryEntities[] = $country;
}

View File

@ -36,7 +36,7 @@ class SetPasswordCommand extends Command
public function _getUser($username)
{
return $this->entityManager
->getRepository(\Chill\MainBundle\Entity\User::class)
->getRepository(User::class)
->findOneBy(['username' => $username]);
}

View File

@ -20,9 +20,8 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
class AddressApiController extends ApiController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Duplicate an existing address.
*

View File

@ -70,7 +70,7 @@ class ExportController extends AbstractController
*/
public function downloadResultAction(Request $request, mixed $alias)
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$export = $exportManager->getExport($alias);
$key = $request->query->get('key', null);
@ -108,13 +108,13 @@ class ExportController extends AbstractController
*
* @param string $alias
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
*/
public function generateAction(Request $request, $alias)
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
$savedExport = $this->getSavedExportFromRequest($request);
@ -274,7 +274,7 @@ class ExportController extends AbstractController
*/
protected function createCreateFormExport(string $alias, string $step, array $data, ?SavedExport $savedExport): FormInterface
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$isGenerate = str_starts_with($step, 'generate_');
@ -444,7 +444,7 @@ class ExportController extends AbstractController
*
* @param string $alias
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport)
{
@ -452,7 +452,7 @@ class ExportController extends AbstractController
$dataFormatter = $this->session->get('formatter_step_raw', null);
$dataExport = $this->session->get('export_step_raw', null);
if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
if (null === $dataFormatter && $export instanceof ExportInterface) {
return $this->redirectToRoute('chill_main_export_new', [
'alias' => $alias,
'step' => $this->getNextStep('generate', $export, true),
@ -531,7 +531,7 @@ class ExportController extends AbstractController
]);
}
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$form = $this->createCreateFormExport($alias, 'centers', [], $savedExport);
@ -620,11 +620,11 @@ class ExportController extends AbstractController
return 'export';
case 'export':
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
if ($export instanceof ExportInterface) {
return $reverse ? 'centers' : 'formatter';
}
if ($export instanceof \Chill\MainBundle\Export\DirectExportInterface) {
if ($export instanceof DirectExportInterface) {
return $reverse ? 'centers' : 'generate';
}

View File

@ -26,7 +26,8 @@ use Symfony\Component\HttpFoundation\Response;
class ScopeController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
private readonly EntityManagerInterface $entityManager,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
@ -85,7 +86,7 @@ class ScopeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->findAll();
$entities = $em->getRepository(Scope::class)->findAll();
return $this->render('@ChillMain/Scope/index.html.twig', [
'entities' => $entities,
@ -115,7 +116,7 @@ class ScopeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id);
$scope = $em->getRepository(Scope::class)->find($id);
if (!$scope) {
throw $this->createNotFoundException('Unable to find Scope entity.');

View File

@ -45,7 +45,7 @@ class SearchController extends AbstractController
/** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */
$search = $this->searchProvider
->getHasAdvancedFormByName($name);
} catch (\Chill\MainBundle\Search\UnknowSearchNameException) {
} catch (UnknowSearchNameException) {
throw $this->createNotFoundException('no advanced search for '."{$name}");
}

View File

@ -58,7 +58,7 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
$user = $em->getRepository(User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');
@ -110,13 +110,13 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
$user = $em->getRepository(User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$groupCenter = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
$groupCenter = $em->getRepository(GroupCenter::class)
->find($gcid);
if (!$groupCenter) {
@ -434,7 +434,7 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$groupCenterManaged = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
$groupCenterManaged = $em->getRepository(GroupCenter::class)
->findOneBy([
'center' => $groupCenter->getCenter(),
'permissionsGroup' => $groupCenter->getPermissionsGroup(),

View File

@ -570,7 +570,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\UserJob::class,
'class' => UserJob::class,
'name' => 'user_job',
'base_path' => '/api/1.0/main/user-job',
'base_role' => 'ROLE_USER',
@ -634,7 +634,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\Country::class,
'class' => Country::class,
'name' => 'country',
'base_path' => '/api/1.0/main/country',
'base_role' => 'ROLE_USER',
@ -654,7 +654,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\User::class,
'class' => User::class,
'controller' => \Chill\MainBundle\Controller\UserApiController::class,
'name' => 'user',
'base_path' => '/api/1.0/main/user',
@ -696,7 +696,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\Location::class,
'class' => Location::class,
'controller' => \Chill\MainBundle\Controller\LocationApiController::class,
'name' => 'location',
'base_path' => '/api/1.0/main/location',
@ -718,7 +718,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\LocationType::class,
'class' => LocationType::class,
'controller' => \Chill\MainBundle\Controller\LocationTypeApiController::class,
'name' => 'location_type',
'base_path' => '/api/1.0/main/location-type',
@ -739,7 +739,7 @@ class ChillMainExtension extends Extension implements
],
],
[
'class' => \Chill\MainBundle\Entity\Civility::class,
'class' => Civility::class,
'name' => 'civility',
'base_path' => '/api/1.0/main/civility',
'base_role' => 'ROLE_USER',

View File

@ -73,8 +73,8 @@ class PermissionsGroup
*/
public function __construct()
{
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
$this->roleScopes = new ArrayCollection();
$this->groupCenters = new ArrayCollection();
}
public function addRoleScope(RoleScope $roleScope)

View File

@ -189,7 +189,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
}
/**
* @return \Chill\MainBundle\Entity\User
* @return User
*/
public function addGroupCenter(GroupCenter $groupCenter)
{

View File

@ -100,7 +100,7 @@ class CSVListFormatter implements FormatterInterface
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
*
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
* @return Response The response to be shown
*/
public function getResponse(
$result,

View File

@ -99,7 +99,7 @@ class CSVPivotedListFormatter implements FormatterInterface
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
*
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
* @return Response The response to be shown
*/
public function getResponse(
$result,

View File

@ -112,7 +112,7 @@ class SpreadsheetListFormatter implements FormatterInterface
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
*
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
* @return Response The response to be shown
*/
public function getResponse(
$result,

View File

@ -83,7 +83,7 @@ trait AppendScopeChoiceTypeTrait
{
$resolver
->setRequired(['center', 'role'])
->setAllowedTypes('center', \Chill\MainBundle\Entity\Center::class)
->setAllowedTypes('center', Center::class)
->setAllowedTypes('role', 'string');
}

View File

@ -23,10 +23,10 @@ class ComposedGroupCenterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('permissionsgroup', EntityType::class, [
'class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
'class' => PermissionsGroup::class,
'choice_label' => static fn (PermissionsGroup $group) => $group->getName(),
])->add('center', EntityType::class, [
'class' => \Chill\MainBundle\Entity\Center::class,
'class' => Center::class,
'choice_label' => static fn (Center $center) => $center->getName(),
]);
}

View File

@ -56,7 +56,7 @@ class Select2CountryType extends AbstractType
asort($choices, \SORT_STRING | \SORT_FLAG_CASE);
$resolver->setDefaults([
'class' => \Chill\MainBundle\Entity\Country::class,
'class' => Country::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);

View File

@ -52,7 +52,7 @@ class Select2LanguageType extends AbstractType
asort($choices, \SORT_STRING | \SORT_FLAG_CASE);
$resolver->setDefaults([
'class' => \Chill\MainBundle\Entity\Language::class,
'class' => Language::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);

View File

@ -38,7 +38,7 @@ class WorkflowStepType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
/** @var \Chill\MainBundle\Entity\Workflow\EntityWorkflow $entityWorkflow */
/** @var EntityWorkflow $entityWorkflow */
$entityWorkflow = $options['entity_workflow'];
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());

View File

@ -137,7 +137,7 @@ class Paginator implements PaginatorInterface
}
/**
* @return \Chill\MainBundle\Pagination\Page
* @return Page
*
* @throws \RuntimeException if the next page does not exists
*/

View File

@ -43,7 +43,7 @@ class GeographicalUnitByAddressApiControllerTest extends WebTestCase
$em = self::getContainer()->get(EntityManagerInterface::class);
$nb = $em->createQuery('SELECT COUNT(a) FROM '.Address::class.' a')->getSingleScalarResult();
/** @var \Chill\MainBundle\Entity\Address $random */
/** @var Address $random */
$random = $em->createQuery('SELECT a FROM '.Address::class.' a')
->setFirstResult(random_int(0, $nb))
->setMaxResults(1)

View File

@ -58,7 +58,7 @@ final class ExportManagerTest extends KernelTestCase
{
self::bootKernel();
$this->prophet = new \Prophecy\Prophet();
$this->prophet = new Prophet();
}
protected function tearDown(): void
@ -370,7 +370,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->willImplement(AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
@ -399,7 +399,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->willImplement(AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $centerB)
@ -435,7 +435,7 @@ final class ExportManagerTest extends KernelTestCase
);
$export = $this->prophet->prophesize();
$export->willImplement(\Chill\MainBundle\Export\ExportInterface::class);
$export->willImplement(ExportInterface::class);
$export->requiredRole()->willReturn('CHILL_STAT_DUMMY');
$result = $exportManager->isGrantedForElement($export->reveal(), null, []);

View File

@ -258,8 +258,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->willImplement('\\'.HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@ -383,7 +383,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@ -407,7 +407,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@ -431,8 +431,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->willImplement('\\'.HasScopeInterface::class);
$entity->getCenter()->willReturn($centerB);
$entity->getScope()->willReturn($scope);
@ -452,7 +452,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@ -471,8 +471,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->willImplement('\\'.HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@ -503,7 +503,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.HasCenterInterface::class);
$entity->getCenter()->willReturn($centerA);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@ -577,7 +577,7 @@ final class AuthorizationHelperTest extends KernelTestCase
}
/**
* @return \Chill\MainBundle\Security\Authorization\AuthorizationHelper
* @return AuthorizationHelper
*/
private function getAuthorizationHelper()
{

View File

@ -23,9 +23,8 @@ use Symfony\Component\HttpFoundation\Response;
*/
class EntityPersonCRUDController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Override the base method to add a filtering step to a person.
*

View File

@ -20,9 +20,8 @@ use Symfony\Component\HttpFoundation\Response;
class OneToOneEntityPersonCRUDController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
protected function generateRedirectOnCreateRoute($action, Request $request, $entity): string
{
throw new \BadMethodCallException('Not implemented yet.');

View File

@ -224,7 +224,7 @@ final class AccompanyingCourseWorkController extends AbstractController
if (1 < count($types)) {
$filterBuilder
->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, $types, [
->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', SocialAction::class, $types, [
'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()),
]);
}

View File

@ -432,7 +432,7 @@ class AccompanyingPeriodController extends AbstractController
private function _getPerson(int $id): Person
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($id);
->getRepository(Person::class)->find($id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');

View File

@ -21,9 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class ClosingMotiveController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @param string $action
*/

View File

@ -37,7 +37,7 @@ class PersonAddressController extends AbstractController
public function createAction(mixed $person_id, Request $request)
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->find($person_id);
if (null === $person) {
@ -94,7 +94,7 @@ class PersonAddressController extends AbstractController
public function editAction(mixed $person_id, mixed $address_id)
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->find($person_id);
if (null === $person) {
@ -124,7 +124,7 @@ class PersonAddressController extends AbstractController
public function listAction(mixed $person_id)
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->find($person_id);
if (null === $person) {
@ -148,7 +148,7 @@ class PersonAddressController extends AbstractController
public function newAction(mixed $person_id)
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->find($person_id);
if (null === $person) {
@ -177,7 +177,7 @@ class PersonAddressController extends AbstractController
public function updateAction(mixed $person_id, mixed $address_id, Request $request)
{
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->find($person_id);
if (null === $person) {

View File

@ -106,7 +106,7 @@ final class PersonController extends AbstractController
$cFGroup = null;
$cFDefaultGroup = $this->em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup::class)
->findOneByEntity(\Chill\PersonBundle\Entity\Person::class);
->findOneByEntity(Person::class);
if ($cFDefaultGroup) {
$cFGroup = $cFDefaultGroup->getCustomFieldsGroup();
@ -281,7 +281,7 @@ final class PersonController extends AbstractController
/**
* easy getting a person by his id.
*
* @return \Chill\PersonBundle\Entity\Person
* @return Person
*/
private function _getPerson(int $id)
{

View File

@ -401,16 +401,16 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
'apis' => [
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod::class,
'class' => AccompanyingPeriod::class,
'name' => 'accompanying_course',
'base_path' => '/api/1.0/person/accompanying-course',
'controller' => \Chill\PersonBundle\Controller\AccompanyingCourseApiController::class,
'actions' => [
'_entity' => [
'roles' => [
Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_PUT => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_GET => AccompanyingPeriodVoter::SEE,
Request::METHOD_PATCH => AccompanyingPeriodVoter::SEE,
Request::METHOD_PUT => AccompanyingPeriodVoter::SEE,
],
'methods' => [
Request::METHOD_GET => true,
@ -426,8 +426,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'resource' => [
@ -438,8 +438,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'comment' => [
@ -450,8 +450,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'requestor' => [
@ -462,8 +462,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'scope' => [
@ -474,8 +474,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'socialissue' => [
@ -487,8 +487,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
'controller_action' => 'socialIssueApi',
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE,
],
],
'work' => [
@ -500,7 +500,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
'controller_action' => 'workApi',
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
Request::METHOD_DELETE => 'ALWAYS_FAILS',
],
],
@ -511,7 +511,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_HEAD => false,
],
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
Request::METHOD_POST => AccompanyingPeriodVoter::SEE,
],
],
// 'confidential' => [
@ -618,7 +618,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
'class' => \Chill\PersonBundle\Entity\Person::class,
'name' => 'person',
'base_path' => '/api/1.0/person/person',
'base_role' => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE,
'base_role' => PersonVoter::SEE,
'controller' => \Chill\PersonBundle\Controller\PersonApiController::class,
'actions' => [
'_entity' => [
@ -629,10 +629,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_PATCH => true,
],
'roles' => [
Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE,
Request::METHOD_HEAD => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE,
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\PersonVoter::CREATE,
Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\PersonVoter::CREATE,
Request::METHOD_GET => PersonVoter::SEE,
Request::METHOD_HEAD => PersonVoter::SEE,
Request::METHOD_POST => PersonVoter::CREATE,
Request::METHOD_PATCH => PersonVoter::CREATE,
],
],
'address' => [
@ -1001,7 +1001,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
'property' => 'step',
],
'supports' => [
\Chill\PersonBundle\Entity\AccompanyingPeriod::class,
AccompanyingPeriod::class,
],
'initial_marking' => 'DRAFT',
'places' => [

View File

@ -532,7 +532,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*/
public function __construct()
{
$this->calendars = new \Doctrine\Common\Collections\ArrayCollection();
$this->calendars = new ArrayCollection();
$this->accompanyingPeriodParticipations = new ArrayCollection();
$this->spokenLanguages = new ArrayCollection();
$this->addresses = new ArrayCollection();

View File

@ -29,13 +29,13 @@ class Select2MaritalStatusType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$transformer = new ObjectToIdTransformer($this->em, \Chill\PersonBundle\Entity\MaritalStatus::class);
$transformer = new ObjectToIdTransformer($this->em, MaritalStatus::class);
$builder->addModelTransformer($transformer);
}
public function configureOptions(OptionsResolver $resolver)
{
$maritalStatuses = $this->em->getRepository(\Chill\PersonBundle\Entity\MaritalStatus::class)->findAll();
$maritalStatuses = $this->em->getRepository(MaritalStatus::class)->findAll();
$choices = [];
foreach ($maritalStatuses as $ms) {

View File

@ -196,7 +196,7 @@ final class PersonAddressControllerTest extends WebTestCase
*/
protected function refreshPerson()
{
self::$person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
self::$person = $this->em->getRepository(Person::class)
->find(self::$person->getId());
}
}

View File

@ -89,7 +89,7 @@ final class PersonControllerCreateTest extends WebTestCase
$form = $crawler->selectButton("Créer l'usager")->form();
$this->assertInstanceOf(
\Symfony\Component\DomCrawler\Form::class,
Form::class,
$form,
'The page contains a button'
);

View File

@ -205,7 +205,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
$this->person = $this->em->getRepository(Person::class)
->find($this->person->getId());
}

View File

@ -98,7 +98,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
$this->person = $this->em->getRepository(Person::class)
->find($this->person->getId());
}
}

View File

@ -57,7 +57,7 @@ class ReportController extends AbstractController
$cFGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->find($cf_group_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
$person = $em->getRepository(Person::class)
->find($person_id);
if (null === $person || null === $cFGroup) {
@ -183,7 +183,7 @@ class ReportController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
@ -240,7 +240,7 @@ class ReportController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
$cFGroup = $em
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->find($cf_group_id);
@ -288,7 +288,7 @@ class ReportController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
$person = $em->getRepository(Person::class)
->find($person_id);
if (null === $person) {
@ -310,7 +310,7 @@ class ReportController extends AbstractController
}
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->findByEntity(\Chill\ReportBundle\Entity\Report::class);
->findByEntity(Report::class);
if (1 === \count($cFGroups)) {
return $this->redirectToRoute('report_new', ['person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()]);
@ -332,7 +332,7 @@ class ReportController extends AbstractController
])
->getForm();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
return $this->render('@ChillReport/Report/select_report_type.html.twig', [
'form' => $form->createView(),
@ -359,7 +359,7 @@ class ReportController extends AbstractController
$em = $this->managerRegistry->getManager();
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->findByEntity(\Chill\ReportBundle\Entity\Report::class);
->findByEntity(Report::class);
if (1 === \count($cFGroups)) {
return $this->redirectToRoute('report_export_list', ['cf_group_id' => $cFGroups[0]->getId()]);
@ -459,7 +459,7 @@ class ReportController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
$entity = $em->getRepository('ChillReportBundle:Report')->find($report_id);

View File

@ -43,7 +43,7 @@ final class ReportControllerNextTest extends WebTestCase
->get('doctrine.orm.entity_manager');
$this->person = $em
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->findOneBy(
[
'lastName' => 'Charline',
@ -58,7 +58,7 @@ final class ReportControllerNextTest extends WebTestCase
// get custom fields group from fixture
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->getRepository(CustomFieldsGroup::class)
->findBy(['entity' => \Chill\ReportBundle\Entity\Report::class]);
// filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(

View File

@ -43,7 +43,7 @@ final class ReportControllerTest extends WebTestCase
private static $group;
/**
* @var \Chill\PersonBundle\Entity\Person
* @var Person
*/
private static $person;
@ -59,7 +59,7 @@ final class ReportControllerTest extends WebTestCase
// get a random person
self::$person = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->getRepository(Person::class)
->findOneBy(
[
'lastName' => 'Charline',
@ -73,7 +73,7 @@ final class ReportControllerTest extends WebTestCase
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->getRepository(CustomFieldsGroup::class)
->findBy(['entity' => \Chill\ReportBundle\Entity\Report::class]);
// filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
@ -123,7 +123,7 @@ final class ReportControllerTest extends WebTestCase
$form = $crawlerAddAReportPage->selectButton('Créer un nouveau rapport')->form();
$this->assertInstanceOf(
\Symfony\Component\DomCrawler\Form::class,
Form::class,
$form,
'I can see a form with a button "add a new report" '
);
@ -242,7 +242,7 @@ final class ReportControllerTest extends WebTestCase
$link = $crawlerPersonPage->selectLink("AJOUT D'UN RAPPORT")->link();
$this->assertInstanceOf(
\Symfony\Component\DomCrawler\Link::class,
Link::class,
$link,
'There is a "add a report" link in menu'
);
@ -270,7 +270,7 @@ final class ReportControllerTest extends WebTestCase
->form();
$this->assertInstanceOf(
\Symfony\Component\DomCrawler\Form::class,
Form::class,
$addForm,
'I have a report form'
);

View File

@ -58,7 +58,7 @@ final class TimelineProviderTest extends WebTestCase
$scopesSocial = array_filter(
self::$em
->getRepository(\Chill\MainBundle\Entity\Scope::class)
->getRepository(Scope::class)
->findAll(),
static fn (Scope $scope) => 'social' === $scope->getName()['en']
);

View File

@ -636,7 +636,7 @@ final class SingleTaskController extends AbstractController
}
/**
* @return \Symfony\Component\Form\FormInterface
* @return FormInterface
*/
protected function setCreateForm(SingleTask $task, string $role)
{

View File

@ -103,9 +103,6 @@ class SingleTask extends AbstractTask
private Collection $taskPlaceEvents;
/**
* @var \DateInterval
* and this.getEndDate() === null
*
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
*
* @Serializer\Groups({"read"})

View File

@ -127,7 +127,7 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
],
'apis' => [
[
'class' => \Chill\ThirdPartyBundle\Entity\ThirdParty::class,
'class' => ThirdParty::class,
'name' => 'thirdparty',
'base_path' => '/api/1.0/thirdparty/thirdparty',
// 'base_role' => \Chill\ThirdPartyBundle\Security\Authorization\ThirdPartyVoter::SHOW,
@ -142,11 +142,11 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
Request::METHOD_PATCH => true,
],
'roles' => [
Request::METHOD_GET => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
Request::METHOD_HEAD => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
Request::METHOD_POST => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
Request::METHOD_PUT => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
Request::METHOD_PATCH => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
Request::METHOD_GET => ThirdPartyVoter::SHOW,
Request::METHOD_HEAD => ThirdPartyVoter::SHOW,
Request::METHOD_POST => ThirdPartyVoter::CREATE,
Request::METHOD_PUT => ThirdPartyVoter::CREATE,
Request::METHOD_PATCH => ThirdPartyVoter::CREATE,
],
],
],

View File

@ -149,7 +149,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
*
* @ORM\JoinTable(name="chill_3party.party_center")
*/
private Collection $centers;
private readonly Collection $centers;
/**
* Contact Persons: One Institutional ThirdParty has Many Contact Persons.

View File

@ -100,7 +100,7 @@ class ThirdPartyType extends AbstractType
'label' => 'thirdparty.Contact data are confidential',
]);
// Institutional ThirdParty (parent)
// Institutional ThirdParty (parent)
} else {
$builder
->add('nameCompany', TextType::class, [

View File

@ -19,5 +19,5 @@ return static function (RoutingConfigurator $routes) {
$routes
->add('chill_wopi_object_convert', '/convert/{uuid}')
->controller(\Chill\WopiBundle\Controller\Convert::class);
->controller(Chill\WopiBundle\Controller\Convert::class);
};

View File

@ -10,5 +10,5 @@ declare(strict_types=1);
*/
return static function (Rector\Config\RectorConfig $rectorConfig): void {
$rectorConfig->rule(\Chill\Utils\Rector\Rector\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector::class);
$rectorConfig->rule(Chill\Utils\Rector\Rector\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector::class);
};