update php-cs-fixer and rector + fix rules

This commit is contained in:
2024-01-09 13:50:45 +01:00
parent a63b40fb6c
commit 825cd127d1
79 changed files with 220 additions and 229 deletions

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());
}
}