From 75bca46b981111314afd62725a075bf4bbec1ab7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 17 Aug 2023 14:49:29 +0200 Subject: [PATCH] cs fixer --- docs/source/_static/code/exports/CountPerson.php | 2 +- .../widgets/ChillMainConfiguration.php | 2 +- rector.php | 7 +++++++ .../Controller/ActivityController.php | 5 ++--- .../Repository/ActivityACLAwareRepository.php | 2 +- .../ActivityDocumentACLAwareRepositoryTest.php | 1 - .../src/Export/Aggregator/ByLocationAggregator.php | 12 ++++++++++-- .../src/Export/Filter/ByLocationFilter.php | 11 ++++++++++- .../src/migrations/Version20230816112809.php | 7 +++++++ .../Connector/MSGraph/MSUserAbsenceReader.php | 1 - .../AccompanyingPeriodCalendarGenericDocProvider.php | 2 -- .../Connector/MSGraph/MSUserAbsenceReaderTest.php | 1 - .../GenericDocForAccompanyingPeriodController.php | 1 - .../Controller/GenericDocForPerson.php | 1 - .../ChillDocStoreBundle/GenericDoc/FetchQuery.php | 2 -- ...ericDocForAccompanyingPeriodProviderInterface.php | 1 - .../AccompanyingCourseDocumentGenericDocProvider.php | 1 - .../GenericDoc/Twig/GenericDocExtensionRuntime.php | 1 - .../GenericDoc/Twig/GenericDocRendererInterface.php | 1 - .../Repository/PersonDocumentACLAwareRepository.php | 1 - .../Tests/GenericDoc/FetchQueryToSqlBuilderTest.php | 4 ---- .../PersonDocumentACLAwareRepositoryTest.php | 2 -- src/Bundle/ChillMainBundle/Cron/CronManager.php | 1 - .../Form/Type/Listing/FilterOrderType.php | 2 -- .../Tests/Cron/CronJobDatabaseInteractionTest.php | 1 - ...teAddressWithReferenceOrPostalCodeCronJobTest.php | 1 - .../RelationshipNoDuplicateValidator.php | 6 ++---- .../Repository/SingleTaskStateRepository.php | 1 - .../ChillThirdPartyBundle/Form/ThirdPartyType.php | 2 +- 29 files changed, 42 insertions(+), 40 deletions(-) diff --git a/docs/source/_static/code/exports/CountPerson.php b/docs/source/_static/code/exports/CountPerson.php index be800e52c..5d9cb2c2f 100644 --- a/docs/source/_static/code/exports/CountPerson.php +++ b/docs/source/_static/code/exports/CountPerson.php @@ -94,7 +94,7 @@ class CountPerson implements ExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { // we gather all center the user choose. - $centers = array_map(static fn($el) => $el['center'], $acl); + $centers = array_map(static fn ($el) => $el['center'], $acl); $qb = $this->entityManager->createQueryBuilder(); diff --git a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php index 9eca0ae76..cdad6b42b 100644 --- a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php +++ b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php @@ -56,7 +56,7 @@ class ChillMainConfiguration implements ConfigurationInterface ->end() // end of widgets ->end() // end of root/children ->end() // end of root -; + ; return $treeBuilder; } diff --git a/rector.php b/rector.php index c2e752c32..b8975b970 100644 --- a/rector.php +++ b/rector.php @@ -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. + */ + use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Set\ValueObject\LevelSetList; diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 1e911ff08..1c1f0ab30 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -320,7 +320,6 @@ final class ActivityController extends AbstractController private function buildFilterOrder(AccompanyingPeriod|Person $associated): FilterOrderHelper { - $filterBuilder = $this->filterOrderHelperFactory->create(self::class); $types = $this->activityACLAwareRepository->findActivityTypeByAssociated($associated); $jobs = $this->activityACLAwareRepository->findUserJobByAssociated($associated); @@ -679,8 +678,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'); } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 1544dd764..7925f861b 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -322,7 +322,7 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos $counter++; } - foreach ($person->getAccompanyingPeriodParticipations() as $participation) { + foreach ($person->getAccompanyingPeriodParticipations() as $participation) { if (!$this->security->isGranted(ActivityVoter::SEE, $participation->getAccompanyingPeriod())) { continue; } diff --git a/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityDocumentACLAwareRepositoryTest.php b/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityDocumentACLAwareRepositoryTest.php index ce4f318e3..74f1d2bd0 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityDocumentACLAwareRepositoryTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityDocumentACLAwareRepositoryTest.php @@ -122,5 +122,4 @@ class ActivityDocumentACLAwareRepositoryTest extends KernelTestCase yield [$person, $scopes, true, null, new \DateTimeImmutable("1 week ago"), "content"]; yield [$person, [], true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), "content"]; } - } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php index c87a1078d..c6a35e3d7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php @@ -1,5 +1,14 @@ throw new UserAbsenceSyncException("this status is not documented by Microsoft") }; } - } diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index 6675f7c7e..1040f9f0a 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -190,6 +190,4 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen return $query; } - - } diff --git a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php index 089477fda..2ceab8b1f 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php @@ -172,5 +172,4 @@ class MSUserAbsenceReaderTest extends TestCase "User is absent: absence is always enabled" ]; } - } diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php index 70c41db50..9a0650b2d 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php @@ -94,5 +94,4 @@ final readonly class GenericDocForAccompanyingPeriodController ] )); } - } diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php index 3484e0904..e010c41c5 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php @@ -91,5 +91,4 @@ final readonly class GenericDocForPerson ] )); } - } diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php index 30e07a841..b1631bb24 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php @@ -82,7 +82,6 @@ class FetchQuery implements FetchQueryInterface } unset($this->wheres[$index], $this->whereParams[$index], $this->whereTypes[$index]); - } public function removeJoinClause(int $index): void @@ -92,7 +91,6 @@ class FetchQuery implements FetchQueryInterface } unset($this->joins[$index], $this->joinParams[$index], $this->joinTypes[$index]); - } public function getSelectKeyString(): string diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php index 0d3cb1c32..bffa19b53 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php @@ -27,5 +27,4 @@ interface GenericDocForAccompanyingPeriodProviderInterface * Return true if the user is allowed to see some documents for this provider. */ public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool; - } diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php index fd36f7976..fe03a8b00 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php @@ -143,5 +143,4 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen return $query; } - } diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php index 2dee0ed0b..8bb97a9b9 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php @@ -46,5 +46,4 @@ final readonly class GenericDocExtensionRuntime implements RuntimeExtensionInter throw new \LogicException("no renderer found"); } - } diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocRendererInterface.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocRendererInterface.php index 940001f4a..cdd28ac70 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocRendererInterface.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocRendererInterface.php @@ -20,5 +20,4 @@ interface GenericDocRendererInterface public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string; public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array; - } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index 26a42b894..12506581c 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -98,7 +98,6 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA continue; } $orPersonId[] = $participation->getPerson()->getId(); - } if ([] === $orPersonId) { diff --git a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/FetchQueryToSqlBuilderTest.php b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/FetchQueryToSqlBuilderTest.php index 02be9460f..f55b889a9 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/FetchQueryToSqlBuilderTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/FetchQueryToSqlBuilderTest.php @@ -54,9 +54,6 @@ class FetchQueryToSqlBuilderTest extends KernelTestCase ); self::assertEquals(['foo', 'bar_baz', 'baz'], $params); self::assertEquals([Types::STRING, Types::STRING, Types::STRING], $types); - - - } public function testToSqlWithoutWhere(): void @@ -85,5 +82,4 @@ class FetchQueryToSqlBuilderTest extends KernelTestCase self::assertEquals([], $params); self::assertEquals([], $types); } - } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php index fd611042c..bb372a150 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php @@ -142,7 +142,6 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), null]; yield [$period, null, null, 'test']; yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test']; - } public function provideDataBuildFetchQueryForPerson(): iterable @@ -154,5 +153,4 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase yield [null, null, 'test']; yield [new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test']; } - } diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index a3e82a170..322000cb3 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -88,7 +88,6 @@ class CronManager implements CronManagerInterface foreach ($orderedJobs as $job) { if ($job->canRun($lasts[$job->getKey()] ?? null)) { if (array_key_exists($job->getKey(), $lasts)) { - $executionData = $lasts[$job->getKey()]->getLastExecutionData(); $this->entityManager diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index 51d1b3974..b0d80176b 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -122,7 +122,6 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType foreach ($helper->getUserPickers() as $name => [ 'label' => $label, 'options' => $opts ]) { - $userPickersBuilder->add( $name, PickUserDynamicType::class, @@ -136,7 +135,6 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $builder->add($userPickersBuilder); } - } public static function buildCheckboxChoices(array $choices, array $trans = []): array diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php index 0b80730fe..c8ab200fc 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php @@ -65,7 +65,6 @@ class CronJobDatabaseInteractionTest extends KernelTestCase // run a second time $manager->run(); } - } class JobWithReturn implements CronJobInterface diff --git a/src/Bundle/ChillMainBundle/Tests/Services/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJobTest.php b/src/Bundle/ChillMainBundle/Tests/Services/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJobTest.php index 69eeca2da..9e83f2e7e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJobTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJobTest.php @@ -64,5 +64,4 @@ class CollateAddressWithReferenceOrPostalCodeCronJobTest extends TestCase yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-01T12:00:00'), true]; yield [new \DateTimeImmutable('2023-07-10T12:00:00'), null, true]; } - } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php index 5b1038287..f8538cd09 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php @@ -47,11 +47,9 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator foreach ($relationships as $r) { if (spl_object_hash($r) !== spl_object_hash($value) - and - ( + and ( ($r->getFromPerson() === $fromPerson and $r->getToPerson() === $toPerson) - || - ($r->getFromPerson() === $toPerson and $r->getToPerson() === $fromPerson) + || ($r->getFromPerson() === $toPerson and $r->getToPerson() === $fromPerson) ) ) { $this->context->buildViolation($constraint->message) diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php index 2d64c69a0..c0d596e09 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php @@ -43,5 +43,4 @@ class SingleTaskStateRepository return $states; } - } diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index 6c4984f33..b1446a543 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -117,7 +117,7 @@ class ThirdPartyType extends AbstractType 'label' => 'thirdparty.Contact data are confidential', ]); - // Institutional ThirdParty (parent) + // Institutional ThirdParty (parent) } else { $builder ->add('nameCompany', TextType::class, [