From 264fff5c36e05e3f38cc6480a8ab031e62c4b286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 24 Nov 2023 12:11:29 +0100 Subject: [PATCH 001/251] Implement asynchronous upload feature in Openstack Object Store Those features were previously stored in champs-libres/async-upload-bundle This commit introduces several new classes within the ChillDocStore bundle for handling asynchronous uploads onto an Openstack Object Store. Specifically, the TempUrlOpenstackGenerator, SignedUrl, TempUrlGeneratorInterface, TempUrlGenerateEvent, and TempUrlGeneratorException classes have been created. This implementation will allow for generating "temporary URLs", which assist in securely and temporarily uploading resources to the OpenStack Object Store. This feature enables the handling of file uploads in a more scalable and efficient manner in high-volume environments. Additionally, corresponding unit tests have also been added to ensure the accuracy of this new feature. --- .../TempUrlOpenstackGenerator.php | 192 ++++++++++++++++++ .../Event/TempUrlGenerateEvent.php | 31 +++ .../Exception/TempUrlGeneratorException.php | 14 ++ .../AsyncUpload/SignedUrl.php | 21 ++ .../AsyncUpload/SignedUrlPost.php | 28 +++ .../AsyncUpload/TempUrlGeneratorInterface.php | 23 +++ .../TempUrlOpenstackGeneratorTest.php | 151 ++++++++++++++ 7 files changed, 460 insertions(+) create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Event/TempUrlGenerateEvent.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlGeneratorException.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/TempUrlGeneratorInterface.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php new file mode 100644 index 000000000..742e4285c --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php @@ -0,0 +1,192 @@ +max_expire_delay; + $submit_delay ??= $this->max_submit_delay; + + if ($delay < 2) { + throw new TempUrlGeneratorException("The delay of {$delay} is too ".'short (<2 sec) to properly use this token'); + } + + if ($delay > $this->max_expire_delay) { + throw new TempUrlGeneratorException('The given delay is greater than the max delay authorized.'); + } + + if ($submit_delay < 15) { + throw new TempUrlGeneratorException("The submit delay of {$delay} is too ".'short (<15 sec) to properly use this token'); + } + + if ($submit_delay > $this->max_submit_delay) { + throw new TempUrlGeneratorException('The given submit delay is greater than the max submit delay authorized.'); + } + + if ($max_file_count > $this->max_file_count) { + throw new TempUrlGeneratorException('The number of files is greater than the authorized number of files'); + } + + $expires = $this->clock->now()->add(new \DateInterval('PT'.(string) $delay.'S')); + + $object_name = $this->generateObjectName(); + + $g = new SignedUrlPost( + $url = $this->generateUrl($object_name), + $expires, + $this->max_post_file_size, + $max_file_count, + $submit_delay, + '', + $object_name, + $this->generateSignaturePost($url, $expires) + ); + + $this->event_dispatcher->dispatch( + new TempUrlGenerateEvent($g), + ); + + $this->logger->info( + 'generate signature for url', + (array) $g + ); + + return $g; + } + + /** + * Generate an absolute public url for a GET request on the object. + */ + public function generate(string $method, string $object_name, int $expire_delay = null): SignedUrl + { + if ($expire_delay > $this->max_expire_delay) { + throw new TempUrlGeneratorException(sprintf('The expire delay (%d) is greater than the max_expire_delay (%d)', $expire_delay, $this->max_expire_delay)); + } + $url = $this->generateUrl($object_name); + + $expires = $this->clock->now() + ->add(new \DateInterval(sprintf('PT%dS', $expire_delay ?? $this->max_expire_delay))); + $args = [ + 'temp_url_sig' => $this->generateSignature($method, $url, $expires), + 'temp_url_expires' => $expires->format('U'), + ]; + $url = $url.'?'.\http_build_query($args); + + $signature = new SignedUrl($method, $url, $expires); + + $this->event_dispatcher->dispatch( + new TempUrlGenerateEvent($signature) + ); + + return $signature; + } + + private function generateUrl($relative_path): string + { + return match (str_ends_with($this->base_url, '/')) { + true => $this->base_url.$relative_path, + false => $this->base_url.'/'.$relative_path + }; + } + + private function generateObjectName() + { + // inspiration from https://stackoverflow.com/a/4356295/1572236 + $charactersLength = strlen(self::CHARACTERS); + $randomString = ''; + for ($i = 0; $i < 21; ++$i) { + $randomString .= self::CHARACTERS[random_int(0, $charactersLength - 1)]; + } + + return $randomString; + } + + private function generateSignaturePost($url, \DateTimeImmutable $expires) + { + $path = \parse_url((string) $url, PHP_URL_PATH); + + $body = sprintf( + "%s\n%s\n%s\n%s\n%s", + $path, + '', // redirect is empty + (string) $this->max_post_file_size, + (string) $this->max_file_count, + $expires->format('U') + ) + ; + + $this->logger->debug( + 'generate signature post', + ['url' => $body, 'method' => 'POST'] + ); + + return \hash_hmac('sha512', $body, $this->key, false); + } + + private function generateSignature($method, $url, \DateTimeImmutable $expires) + { + if ('POST' === $method) { + return $this->generateSignaturePost($url, $expires); + } + + $path = \parse_url((string) $url, PHP_URL_PATH); + + $body = sprintf( + "%s\n%s\n%s", + $method, + $expires->format('U'), + $path + ) + ; + + $this->logger->debug( + 'generate signature GET', + ['url' => $body, 'method' => 'GET'] + ); + + return \hash_hmac('sha512', $body, $this->key, false); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Event/TempUrlGenerateEvent.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Event/TempUrlGenerateEvent.php new file mode 100644 index 000000000..619dba4e0 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Event/TempUrlGenerateEvent.php @@ -0,0 +1,31 @@ +data->method; + } + + public function getData(): SignedUrl + { + return $this->data; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlGeneratorException.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlGeneratorException.php new file mode 100644 index 000000000..29c7e78ed --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlGeneratorException.php @@ -0,0 +1,14 @@ +generate($method, $objectName, $expireDelay); + + self::assertEquals($expected, $signedUrl); + } + + /** + * @dataProvider dataProviderGeneratePost + */ + public function testGeneratePost(string $baseUrl, \DateTimeImmutable $now, string $key, string $method, string $objectName, int $expireDelay, SignedUrl $expected): void + { + $logger = new NullLogger(); + $eventDispatcher = new EventDispatcher(); + $clock = new MockClock($now); + + $generator = new TempUrlOpenstackGenerator( + $logger, + $eventDispatcher, + $clock, + $baseUrl, + $key, + 1800, + 1800, + 150 + ); + + $signedUrl = $generator->generatePost(); + + self::assertEquals('POST', $signedUrl->method); + self::assertEquals((int) $clock->now()->format('U') + 1800, $signedUrl->expires->getTimestamp()); + self::assertEquals(150, $signedUrl->max_file_size); + self::assertEquals(1, $signedUrl->max_file_count); + self::assertEquals(1800, $signedUrl->submit_delay); + self::assertEquals('', $signedUrl->redirect); + self::assertGreaterThanOrEqual(20, strlen($signedUrl->prefix)); + } + + public function dataProviderGenerate(): iterable + { + $now = \DateTimeImmutable::createFromFormat('U', '1702041743'); + $expireDelay = 1800; + $baseUrls = [ + 'https://objectstore.example/v1/my_account/container/', + 'https://objectstore.example/v1/my_account/container', + ]; + $objectName = 'object'; + $method = 'GET'; + $key = 'MYKEY'; + + $signedUrl = new SignedUrl( + 'GET', + 'https://objectstore.example/v1/my_account/container/object?temp_url_sig=0aeef353a5f6e22d125c76c6ad8c644a59b222ba1b13eaeb56bf3d04e28b081d11dfcb36601ab3aa7b623d79e1ef03017071bbc842fb7b34afec2baff895bf80&temp_url_expires=1702043543', + \DateTimeImmutable::createFromFormat('U', '1702043543') + ); + + foreach ($baseUrls as $baseUrl) { + yield [ + $baseUrl, + $now, + $key, + $method, + $objectName, + $expireDelay, + $signedUrl, + ]; + } + } + + public function dataProviderGeneratePost(): iterable + { + $now = \DateTimeImmutable::createFromFormat('U', '1702041743'); + $expireDelay = 1800; + $baseUrls = [ + 'https://objectstore.example/v1/my_account/container/', + 'https://objectstore.example/v1/my_account/container', + ]; + $objectName = 'object'; + $method = 'GET'; + $key = 'MYKEY'; + + $signedUrl = new SignedUrlPost( + 'https://objectstore.example/v1/my_account/container/object?temp_url_sig=0aeef353a5f6e22d125c76c6ad8c644a59b222ba1b13eaeb56bf3d04e28b081d11dfcb36601ab3aa7b623d79e1ef03017071bbc842fb7b34afec2baff895bf80&temp_url_expires=1702043543', + \DateTimeImmutable::createFromFormat('U', '1702043543'), + 150, + 1, + 1800, + '', + 'abc', + 'abc' + ); + + foreach ($baseUrls as $baseUrl) { + yield [ + $baseUrl, + $now, + $key, + $method, + $objectName, + $expireDelay, + $signedUrl, + ]; + } + } +} From d68802282552ad02a6ba8ce48d9bfd595f0fbb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 13:45:27 +0100 Subject: [PATCH 002/251] Add Controller to get asyncUpload signatures Added new files for handling asynchronous file uploads in ChillDocStoreBundle. The new files include a controller for generating temporary URLs (AsyncUploadController.php), a security authorization file (AsyncUploadVoter.php), and a corresponding test file (AsyncUploadControllerTest.php). These implementations permit asynchronous uploads via POST, GET, and HEAD methods while maintaining security protocols. --- .../Controller/AsyncUploadController.php | 100 ++++++++++++++++ .../Authorization/AsyncUploadVoter.php | 41 +++++++ .../Controller/AsyncUploadControllerTest.php | 110 ++++++++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php new file mode 100644 index 000000000..decfde596 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php @@ -0,0 +1,100 @@ +tempUrlGenerator + ->generatePost( + $request->query->has('expires_delay') ? $request->query->getInt('expires_delay') : null, + $request->query->has('submit_delay') ? $request->query->getInt('submit_delay') : null + ) + ; + break; + case 'get': + case 'head': + $object_name = $request->query->get('object_name', null); + + if (null === $object_name) { + return (new JsonResponse((object) [ + 'message' => 'the object_name is null', + ])) + ->setStatusCode(JsonResponse::HTTP_BAD_REQUEST); + } + $p = $this->tempUrlGenerator->generate( + $method, + $object_name, + $request->query->has('expires_delay') ? $request->query->getInt('expires_delay') : null + ); + break; + default: + return (new JsonResponse((object) ['message' => 'the method ' + ."{$method} is not valid"])) + ->setStatusCode(JsonResponse::HTTP_BAD_REQUEST); + } + } catch (TempUrlGeneratorException $e) { + $this->logger->warning('The client requested a temp url' + .' which sparkle an error.', [ + 'message' => $e->getMessage(), + 'expire_delay' => $request->query->getInt('expire_delay', 0), + 'file_count' => $request->query->getInt('file_count', 1), + 'method' => $method, + ]); + + $p = new \stdClass(); + $p->message = $e->getMessage(); + $p->status = JsonResponse::HTTP_BAD_REQUEST; + + return new JsonResponse($p, JsonResponse::HTTP_BAD_REQUEST); + } + + if (!$this->security->isGranted(AsyncUploadVoter::GENERATE_SIGNATURE, $p)) { + throw new AccessDeniedHttpException('not allowed to generate this signature'); + } + + return new JsonResponse( + $this->serializer->serialize($p, 'json', [AbstractNormalizer::GROUPS => ['read']]), + Response::HTTP_OK, + [], + true + ); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php new file mode 100644 index 000000000..1d7ad759a --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php @@ -0,0 +1,41 @@ +method, ['POST', 'GET', 'HEAD'], true)) { + return false; + } + + return $this->security->isGranted('ROLE_USER') || $this->security->isGranted('ROLE_ADMIN'); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php new file mode 100644 index 000000000..02150e3be --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php @@ -0,0 +1,110 @@ +expectException(AccessDeniedHttpException::class); + $controller = $this->buildAsyncUploadController(false); + + $controller->getSignedUrl('POST', new Request()); + } + + public function testGeneratePost(): void + { + $controller = $this->buildAsyncUploadController(true); + + $actual = $controller->getSignedUrl('POST', new Request()); + $decodedActual = json_decode($actual->getContent(), true, JSON_THROW_ON_ERROR, JSON_THROW_ON_ERROR); + + self::assertArrayHasKey('method', $decodedActual); + self::assertEquals('POST', $decodedActual['method']); + } + + public function testGenerateGet(): void + { + $controller = $this->buildAsyncUploadController(true); + + $actual = $controller->getSignedUrl('GET', new Request(['object_name' => 'abc'])); + $decodedActual = json_decode($actual->getContent(), true, JSON_THROW_ON_ERROR, JSON_THROW_ON_ERROR); + + self::assertArrayHasKey('method', $decodedActual); + self::assertEquals('GET', $decodedActual['method']); + } + + private function buildAsyncUploadController( + bool $isGranted, + ): AsyncUploadController { + $tempUrlGenerator = new class () implements TempUrlGeneratorInterface { + public function generatePost(int $expire_delay = null, int $submit_delay = null, int $max_file_count = 1): SignedUrlPost + { + return new SignedUrlPost( + 'https://object.store.example', + new \DateTimeImmutable('1 hour'), + 150, + 1, + 1800, + '', + 'abc', + 'abc' + ); + } + + public function generate(string $method, string $object_name, int $expire_delay = null): SignedUrl + { + return new SignedUrl( + $method, + 'https://object.store.example', + new \DateTimeImmutable('1 hour') + ); + } + }; + + $serializer = $this->prophesize(SerializerInterface::class); + $serializer->serialize(Argument::type(SignedUrl::class), 'json', Argument::type('array')) + ->will(fn (array $args): string => json_encode(['method' => $args[0]->method], JSON_THROW_ON_ERROR, 3)); + + $security = $this->prophesize(Security::class); + $security->isGranted(AsyncUploadVoter::GENERATE_SIGNATURE, Argument::type(SignedUrl::class)) + ->willReturn($isGranted); + + return new AsyncUploadController( + $tempUrlGenerator, + $serializer->reveal(), + $security->reveal(), + new NullLogger() + ); + } +} From a70572266f9dea4d715704af9c5ad1c3bed5db87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 16:08:29 +0100 Subject: [PATCH 003/251] Refactor TempUrlOpenstackGenerator to use parameter bag and Bundle configuration The TempUrlOpenstackGenerator now uses a ParameterBag for configuration instead of individual parameters. This simplifies the handling of configuration values and makes the code more maintainable. The parameter configuration has also been included in the chill_doc_store configuration array for a unified approach. --- .../TempUrlOpenstackGenerator.php | 28 +++++--- .../ChillDocStoreExtension.php | 3 +- .../DependencyInjection/Configuration.php | 64 ++++++++++++++++++- .../TempUrlOpenstackGeneratorTest.php | 45 ++++++++++--- 4 files changed, 118 insertions(+), 22 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php index 742e4285c..9d79d3603 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php @@ -18,6 +18,7 @@ use Chill\DocStoreBundle\AsyncUpload\SignedUrlPost; use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Clock\ClockInterface; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** @@ -27,17 +28,28 @@ final readonly class TempUrlOpenstackGenerator implements TempUrlGeneratorInterf { private const CHARACTERS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + private string $base_url; + private string $key; + private int $max_expire_delay; + private int $max_submit_delay; + private int $max_post_file_size; + private int $max_file_count; + public function __construct( private LoggerInterface $logger, private EventDispatcherInterface $event_dispatcher, private ClockInterface $clock, - private string $base_url, - private string $key, - private int $max_expire_delay, - private int $max_submit_delay, - private int $max_post_file_size, - private int $max_file_count = 1 - ) {} + ParameterBagInterface $parameterBag, + ) { + $config = $parameterBag->get('chill_doc_store')['openstack']['temp_url']; + + $this->key = $config['temp_url_key']; + $this->base_url = $config['temp_url_base_path']; + $this->max_expire_delay = $config['max_expires_delay']; + $this->max_submit_delay = $config['max_submit_delay']; + $this->max_post_file_size = $config['max_post_file_size']; + $this->max_file_count = $config['max_post_file_count']; + } /** * @throws TempUrlGeneratorException @@ -115,7 +127,7 @@ final readonly class TempUrlOpenstackGenerator implements TempUrlGeneratorInterf ]; $url = $url.'?'.\http_build_query($args); - $signature = new SignedUrl($method, $url, $expires); + $signature = new SignedUrl(strtoupper($method), $url, $expires); $this->event_dispatcher->dispatch( new TempUrlGenerateEvent($signature) diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php index f57e675dd..70c479456 100644 --- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php +++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php @@ -32,6 +32,8 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); + $container->setParameter('chill_doc_store', $config); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); $loader->load('services/media.yaml'); @@ -94,7 +96,6 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf 'routing' => [ 'resources' => [ '@ChillDocStoreBundle/config/routes.yaml', - '@ChampsLibresAsyncUploaderBundle/config/routes.yaml', ], ], ]); diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php index 466158783..7c6a08f80 100644 --- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\DependencyInjection; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -24,11 +25,68 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('chill_doc_store'); + /** @var ArrayNodeDefinition $rootNode */ $rootNode = $treeBuilder->getRootNode(); - // Here you should define the parameters that are allowed to - // configure your bundle. See the documentation linked above for - // more information on that topic. + /* @phpstan-ignore-next-line As there are inconsistencies in return types, but the code works... */ + $rootNode->children() + // openstack node + ->arrayNode('openstack') + ->info('parameters to authenticate and generate temp url against the openstack object storage service') + ->addDefaultsIfNotSet() + ->children() + // openstack.temp_url + ->arrayNode('temp_url') + ->addDefaultsIfNotSet() + ->children() + // openstack.temp_url.temp_url_key + ->scalarNode('temp_url_key') + ->isRequired()->cannotBeEmpty() + ->info('the temp url key') + ->end() + + ->scalarNode('temp_url_base_path') + ->isRequired()->cannotBeEmpty() + ->info('the base path to add **before** the path to media. Must contains the container') + ->end() + + ->scalarNode('container') + ->info('the container name') + ->isRequired()->cannotBeEmpty() + ->end() + + ->integerNode('max_post_file_size') + ->defaultValue(15_000_000) + ->info('Maximum size of the posted file, in bytes') + ->end() + + ->integerNode('max_post_file_count') + ->defaultValue(1) + ->info('Maximum number of files which may be posted at once using a POST operation using async upload') + ->end() + + ->integerNode('max_expires_delay') + ->defaultValue(180) + ->info('the maximum of seconds a cryptographic signature ' + .'will be valid for submitting a file. This should be ' + .'short, to avoid uploading multiple files') + ->end() + + ->integerNode('max_submit_delay') + ->defaultValue(3600) + ->info('the maximum of seconds between the upload of a file and ' + .'a the submission of the form. This delay will also prevent ' + .'the check of persistence of uploaded file. Should be long ' + .'enough for keeping user-friendly forms') + ->end() + + ->end() // end of children 's temp_url + ->end() // end array temp_url + + ->end() // end of children's openstack + ->end() // end of openstack + ->end() // end of root's children + ->end(); return $treeBuilder; } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php index 25c5a1ebc..77d2f8252 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php @@ -17,6 +17,7 @@ use Chill\DocStoreBundle\AsyncUpload\SignedUrlPost; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; use Symfony\Component\Clock\MockClock; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\EventDispatcher\EventDispatcher; /** @@ -34,16 +35,28 @@ class TempUrlOpenstackGeneratorTest extends TestCase $logger = new NullLogger(); $eventDispatcher = new EventDispatcher(); $clock = new MockClock($now); + $parameters = new ParameterBag( + [ + 'chill_doc_store' => [ + 'openstack' => [ + 'temp_url' => [ + 'temp_url_key' => $key, + 'temp_url_base_path' => $baseUrl, + 'max_post_file_size' => 150, + 'max_post_file_count' => 1, + 'max_expires_delay' => 1800, + 'max_submit_delay' => 1800, + ], + ], + ], + ] + ); $generator = new TempUrlOpenstackGenerator( $logger, $eventDispatcher, $clock, - $baseUrl, - $key, - 1800, - 1800, - 150 + $parameters, ); $signedUrl = $generator->generate($method, $objectName, $expireDelay); @@ -59,16 +72,28 @@ class TempUrlOpenstackGeneratorTest extends TestCase $logger = new NullLogger(); $eventDispatcher = new EventDispatcher(); $clock = new MockClock($now); + $parameters = new ParameterBag( + [ + 'chill_doc_store' => [ + 'openstack' => [ + 'temp_url' => [ + 'temp_url_key' => $key, + 'temp_url_base_path' => $baseUrl, + 'max_post_file_size' => 150, + 'max_post_file_count' => 1, + 'max_expires_delay' => 1800, + 'max_submit_delay' => 1800, + ], + ], + ], + ] + ); $generator = new TempUrlOpenstackGenerator( $logger, $eventDispatcher, $clock, - $baseUrl, - $key, - 1800, - 1800, - 150 + $parameters, ); $signedUrl = $generator->generatePost(); From 450e7c348bf01f6a3b6595827682c48e3641c16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 16:09:06 +0100 Subject: [PATCH 004/251] Fix and clean DI configuration for chill_doc_store for usage with AsyncUpload --- .../Service/StoredObjectManager.php | 7 +++- .../ChillDocStoreBundle/config/services.yaml | 38 +++++++------------ .../src/Resources/config/services.php | 5 --- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php index 34df98fa2..e5f7c4ee4 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Service; use Base64Url\Base64Url; -use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; +use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Exception\StoredObjectManagerException; use Symfony\Component\HttpFoundation\Request; @@ -27,7 +27,10 @@ final class StoredObjectManager implements StoredObjectManagerInterface private array $inMemory = []; - public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator) {} + public function __construct( + private readonly HttpClientInterface $client, + private readonly TempUrlGeneratorInterface $tempUrlGenerator + ) {} public function getLastModified(StoredObject $document): \DateTimeInterface { diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 04fc3ace3..061b0f9c8 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -1,11 +1,12 @@ -parameters: -# cl_chill_person.example.class: Chill\PersonBundle\Example - services: - Chill\DocStoreBundle\Repository\: + _defaults: autowire: true autoconfigure: true + + Chill\DocStoreBundle\Repository\: resource: "../Repository/" + tags: + - { name: doctrine.repository_service } Chill\DocStoreBundle\Form\DocumentCategoryType: class: Chill\DocStoreBundle\Form\DocumentCategoryType @@ -15,8 +16,6 @@ services: Chill\DocStoreBundle\Form\PersonDocumentType: class: Chill\DocStoreBundle\Form\PersonDocumentType - autowire: true - autoconfigure: true # arguments: # - "@chill.main.helper.translatable_string" tags: @@ -24,50 +23,41 @@ services: Chill\DocStoreBundle\Security\Authorization\: resource: "./../Security/Authorization" - autowire: true - autoconfigure: true tags: - { name: chill.role } Chill\DocStoreBundle\Workflow\: resource: './../Workflow/' - autoconfigure: true - autowire: true Chill\DocStoreBundle\Serializer\Normalizer\: - autowire: true resource: '../Serializer/Normalizer/' tags: - - { name: 'serializer.normalizer', priority: 16 } + - { name: serializer.normalizer, priority: 16 } Chill\DocStoreBundle\Service\: - autowire: true - autoconfigure: true resource: '../Service/' Chill\DocStoreBundle\GenericDoc\Manager: - autowire: true - autoconfigure: true arguments: $providersForAccompanyingPeriod: !tagged_iterator chill_doc_store.generic_doc_accompanying_period_provider $providersForPerson: !tagged_iterator chill_doc_store.generic_doc_person_provider - Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtension: - autoconfigure: true - autowire: true + Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtension: ~ Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtensionRuntime: - autoconfigure: true - autowire: true arguments: $renderers: !tagged_iterator chill_doc_store.generic_doc_renderer Chill\DocStoreBundle\GenericDoc\Providers\: - autowire: true - autoconfigure: true resource: '../GenericDoc/Providers/' Chill\DocStoreBundle\GenericDoc\Renderer\: + resource: '../GenericDoc/Renderer/' + + Chill\DocStoreBundle\AsyncUpload\Driver\: autowire: true autoconfigure: true - resource: '../GenericDoc/Renderer/' + resource: '../AsyncUpload/Driver/' + + Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface: + alias: Chill\DocStoreBundle\AsyncUpload\Driver\OpenstackObjectStore\TempUrlOpenstackGenerator diff --git a/src/Bundle/ChillWopiBundle/src/Resources/config/services.php b/src/Bundle/ChillWopiBundle/src/Resources/config/services.php index a962c9e67..005994bb6 100644 --- a/src/Bundle/ChillWopiBundle/src/Resources/config/services.php +++ b/src/Bundle/ChillWopiBundle/src/Resources/config/services.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Symfony\Component\DependencyInjection\Loader\Configurator; -use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; use ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface; use ChampsLibres\WopiBundle\Contracts\UserManagerInterface; use ChampsLibres\WopiBundle\Service\Wopi as CLWopi; @@ -60,8 +59,4 @@ return static function (ContainerConfigurator $container) { ->set(UserManager::class); $services->alias(UserManagerInterface::class, UserManager::class); - - // TODO: Move this into the async bundle (low priority) - $services - ->alias(TempUrlGeneratorInterface::class, 'async_uploader.temp_url_generator'); }; From 4fd5a37df382df3017de292372989855dbe839d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 16:09:26 +0100 Subject: [PATCH 005/251] Add serializer groups to SignedUrl and SignedUrlPost classes, include tests Serializer groups have been added to the SignedUrl and SignedUrlPost classes to ensure correct serialization. Two new test files were also included: SignedUrlNormalizerTest and SignedUrlPostNormalizerTest which test the normalization of instances of the classes. --- .../AsyncUpload/SignedUrl.php | 17 +++++ .../AsyncUpload/SignedUrlPost.php | 26 ++++++++ .../Normalizer/SignedUrlNormalizerTest.php | 55 ++++++++++++++++ .../SignedUrlPostNormalizerTest.php | 66 +++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlNormalizerTest.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlPostNormalizerTest.php diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php index 583325a26..9003a69ea 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php @@ -11,11 +11,28 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\AsyncUpload; +use Symfony\Component\Serializer\Annotation as Serializer; + readonly class SignedUrl { public function __construct( + /** + * @Serializer\Groups({"read"}) + */ public string $method, + + /** + * @Serializer\Groups({"read"}) + */ public string $url, public \DateTimeImmutable $expires, ) {} + + /** + * @Serializer\Groups({"read"}) + */ + public function getExpires(): int + { + return $this->expires->getTimestamp(); + } } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php index 98e273635..4a5b4e0fb 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php @@ -11,16 +11,42 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\AsyncUpload; +use Symfony\Component\Serializer\Annotation as Serializer; + readonly class SignedUrlPost extends SignedUrl { public function __construct( string $url, \DateTimeImmutable $expires, + + /** + * @Serializer\Groups({"read"}) + */ public int $max_file_size, + + /** + * @Serializer\Groups({"read"}) + */ public int $max_file_count, + + /** + * @Serializer\Groups({"read"}) + */ public int $submit_delay, + + /** + * @Serializer\Groups({"read"}) + */ public string $redirect, + + /** + * @Serializer\Groups({"read"}) + */ public string $prefix, + + /** + * @Serializer\Groups({"read"}) + */ public string $signature, ) { parent::__construct('POST', $url, $expires); diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlNormalizerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlNormalizerTest.php new file mode 100644 index 000000000..8cf9c5a6d --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlNormalizerTest.php @@ -0,0 +1,55 @@ +get(NormalizerInterface::class); + } + + public function testNormalizerSignedUrl(): void + { + $signedUrl = new SignedUrl( + 'GET', + 'https://object.store.example/container/object', + \DateTimeImmutable::createFromFormat('U', '1700000') + ); + + $actual = self::$normalizer->normalize($signedUrl, 'json', [AbstractNormalizer::GROUPS => ['read']]); + + self::assertEqualsCanonicalizing( + [ + 'method' => 'GET', + 'expires' => 1_700_000, + 'url' => 'https://object.store.example/container/object', + ], + $actual + ); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlPostNormalizerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlPostNormalizerTest.php new file mode 100644 index 000000000..3d510d22b --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Serializer/Normalizer/SignedUrlPostNormalizerTest.php @@ -0,0 +1,66 @@ +get(NormalizerInterface::class); + } + + public function testNormalizerSignedUrl(): void + { + $signedUrl = new SignedUrlPost( + 'https://object.store.example/container/object', + \DateTimeImmutable::createFromFormat('U', '1700000'), + 15000, + 1, + 180, + '', + 'abc', + 'SiGnaTure' + ); + + $actual = self::$normalizer->normalize($signedUrl, 'json', [AbstractNormalizer::GROUPS => ['read']]); + + self::assertEqualsCanonicalizing( + [ + 'max_file_size' => 15000, + 'max_file_count' => 1, + 'submit_delay' => 180, + 'redirect' => '', + 'prefix' => 'abc', + 'signature' => 'SiGnaTure', + 'method' => 'POST', + 'expires' => 1_700_000, + 'url' => 'https://object.store.example/container/object', + ], + $actual + ); + } +} From 1195767eb3f6641802ea63810a7600f2193b8156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 16:53:38 +0100 Subject: [PATCH 006/251] Add Twig AsyncUploadExtension and its associated test Created AsyncUploadExtension under Chill\DocStoreBundle\AsyncUpload\Templating to provide Twig filter functions for generating URLs for asynchronous file uploads. To ensure correctness, AsyncUploadExtensionTest was implemented in Bundle\ChillDocStoreBundle\Tests\AsyncUpload\Templating. Service definitions were also updated in services.yaml. --- .../Templating/AsyncUploadExtension.php | 69 +++++++++++++++++ .../Templating/AsyncUploadExtensionTest.php | 77 +++++++++++++++++++ .../ChillDocStoreBundle/config/services.yaml | 5 +- 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php new file mode 100644 index 000000000..0464b37b9 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php @@ -0,0 +1,69 @@ +computeSignedUrl(...)), + new TwigFilter('generate_url', $this->computeGenerateUrl(...)), + ]; + } + + public function computeSignedUrl(StoredObject|string $file, string $method = 'GET', int $expiresDelay = null): string + { + if ($file instanceof StoredObject) { + $object_name = $file->getFilename(); + } else { + $object_name = $file; + } + + return $this->tempUrlGenerator->generate($method, $object_name, $expiresDelay)->url; + } + + public function computeGenerateUrl(StoredObject|string $file, string $method = 'GET', int $expiresDelay = null): string + { + if ($file instanceof StoredObject) { + $object_name = $file->getFilename(); + } else { + $object_name = $file; + } + + $args = [ + 'method' => $method, + 'object_name' => $object_name, + ]; + + if (null !== $expiresDelay) { + $args['expires_delay'] = $expiresDelay; + } + + return $this->routingUrlGenerator->generate('async_upload.generate_url', $args); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php new file mode 100644 index 000000000..78ed1a1d9 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php @@ -0,0 +1,77 @@ +prophesize(TempUrlGeneratorInterface::class); + $generator->generate(Argument::in(['GET', 'POST']), Argument::type('string'), Argument::any()) + ->will(fn (array $args): SignedUrl => new SignedUrl($args[0], 'https://object.store.example/container/'.$args[1], new \DateTimeImmutable('1 hours'))); + + $urlGenerator = $this->prophesize(UrlGeneratorInterface::class); + $urlGenerator->generate('async_upload.generate_url', Argument::type('array')) + ->willReturn('url'); + + $this->asyncUploadExtension = new AsyncUploadExtension( + $generator->reveal(), + $urlGenerator->reveal() + ); + } + + /** + * @dataProvider dataProviderStoredObject + */ + public function testComputeSignedUrl(StoredObject|string $storedObject): void + { + $actual = $this->asyncUploadExtension->computeSignedUrl($storedObject); + + self::assertStringContainsString('https://object.store.example/container', $actual); + self::assertStringContainsString(is_string($storedObject) ? $storedObject : $storedObject->getFilename(), $actual); + } + + /** + * @dataProvider dataProviderStoredObject + */ + public function testComputeGenerateUrl(StoredObject|string $storedObject): void + { + $actual = $this->asyncUploadExtension->computeGenerateUrl($storedObject); + + self::assertEquals('url', $actual); + } + + public function dataProviderStoredObject(): iterable + { + yield [(new StoredObject())->setFilename('blabla')]; + + yield ['blabla']; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 061b0f9c8..c510064f1 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -55,9 +55,10 @@ services: resource: '../GenericDoc/Renderer/' Chill\DocStoreBundle\AsyncUpload\Driver\: - autowire: true - autoconfigure: true resource: '../AsyncUpload/Driver/' + Chill\DocStoreBundle\AsyncUpload\Templating\: + resource: '../AsyncUpload/Templating/' + Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface: alias: Chill\DocStoreBundle\AsyncUpload\Driver\OpenstackObjectStore\TempUrlOpenstackGenerator From 28d09a820677f59b6533df510d4d621bf1158898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 18:37:58 +0100 Subject: [PATCH 007/251] Add form and types to handle async files --- .../Entity/StoredObject.php | 2 +- .../Form/AccompanyingCourseDocumentType.php | 33 +------- .../Form/DocumentCategoryType.php | 20 ++--- .../Form/StoredObjectType.php | 12 +-- .../Form/Type/AsyncUploaderType.php | 77 +++++++++++++++++++ .../AsyncFileExistsValidatorTest.php | 67 ++++++++++++++++ .../Validator/Constraints/AsyncFileExists.php | 32 ++++++++ .../Constraints/AsyncFileExistsValidator.php | 67 ++++++++++++++++ .../ChillDocStoreBundle/config/services.yaml | 15 +--- .../config/services/form.yaml | 24 +++--- 10 files changed, 271 insertions(+), 78 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/Form/Type/AsyncUploaderType.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Validator/Constraints/AsyncFileExistsValidatorTest.php create mode 100644 src/Bundle/ChillDocStoreBundle/Validator/Constraints/AsyncFileExists.php create mode 100644 src/Bundle/ChillDocStoreBundle/Validator/Constraints/AsyncFileExistsValidator.php diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index 2ee60d80a..abccdccc7 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Entity; use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface; -use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists; +use Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists; use ChampsLibres\WopiLib\Contract\Entity\Document; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; diff --git a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php index 0fced39d3..7ae41f96e 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php @@ -14,13 +14,10 @@ namespace Chill\DocStoreBundle\Form; use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; use Chill\DocStoreBundle\Entity\Document; use Chill\DocStoreBundle\Entity\DocumentCategory; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillTextareaType; -use Chill\MainBundle\Security\Authorization\AuthorizationHelper; -use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Doctrine\ORM\EntityRepository; -use Doctrine\Persistence\ObjectManager; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -29,33 +26,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class AccompanyingCourseDocumentType extends AbstractType { - /** - * @var AuthorizationHelper - */ - protected $authorizationHelper; - - /** - * @var ObjectManager - */ - protected $om; - - /** - * @var TranslatableStringHelper - */ - protected $translatableStringHelper; - - /** - * the user running this form. - * - * @var User - */ - protected $user; - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; - } + private readonly TranslatableStringHelperInterface $translatableStringHelper + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php index f3506d631..6396314e2 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php @@ -20,23 +20,15 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class DocumentCategoryType extends AbstractType { - private $chillBundlesFlipped; - - public function __construct($kernelBundles) - { - // TODO faire un service dans CHillMain - foreach ($kernelBundles as $key => $value) { - if (str_starts_with((string) $key, 'Chill')) { - $this->chillBundlesFlipped[$value] = $key; - } - } - } - public function buildForm(FormBuilderInterface $builder, array $options) { + $bundles = [ + 'chill-doc-store' => 'chill-doc-store', + ]; + $builder ->add('bundleId', ChoiceType::class, [ - 'choices' => $this->chillBundlesFlipped, + 'choices' => $bundles, 'disabled' => false, ]) ->add('idInsideBundle', null, [ @@ -44,7 +36,7 @@ class DocumentCategoryType extends AbstractType ]) ->add('documentClass', null, [ 'disabled' => false, - ]) // cahcerh par default PersonDocument + ]) ->add('name', TranslatableStringFormType::class); } diff --git a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php index 77484208f..414d94f20 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Form; -use ChampsLibres\AsyncUploaderBundle\Form\Type\AsyncUploaderType; +use Chill\DocStoreBundle\Form\Type\AsyncUploaderType; use Chill\DocStoreBundle\Entity\StoredObject; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\AbstractType; @@ -26,15 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class StoredObjectType extends AbstractType { - /** - * @var EntityManagerInterface - */ - protected $em; - - public function __construct(EntityManagerInterface $em) - { - $this->em = $em; - } + public function __construct(private readonly EntityManagerInterface $em) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocStoreBundle/Form/Type/AsyncUploaderType.php b/src/Bundle/ChillDocStoreBundle/Form/Type/AsyncUploaderType.php new file mode 100644 index 000000000..58d4eebb1 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Form/Type/AsyncUploaderType.php @@ -0,0 +1,77 @@ +get('chill_doc_store')['openstack']['temp_url']; + + $this->expires_delay = $config['max_expires_delay']; + $this->max_submit_delay = $config['max_submit_delay']; + $this->max_post_file_size = $config['max_post_file_size']; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'expires_delay' => $this->expires_delay, + 'max_post_size' => $this->max_post_file_size, + 'submit_delay' => $this->max_submit_delay, + 'max_files' => 1, + 'error_bubbling' => false, + ]); + + $resolver->setAllowedTypes('expires_delay', ['int']); + $resolver->setAllowedTypes('max_post_size', ['int']); + $resolver->setAllowedTypes('max_files', ['int']); + $resolver->setAllowedTypes('submit_delay', ['int']); + } + + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { + $view->vars['attr']['data-async-file-upload'] = true; + $view->vars['attr']['data-generate-temp-url-post'] = $this + ->url_generator->generate('async_upload.generate_url', [ + 'expires_delay' => $options['expires_delay'], + 'method' => 'post', + 'submit_delay' => $options['submit_delay'], + ]); + $view->vars['attr']['data-temp-url-get'] = $this->url_generator + ->generate('async_upload.generate_url', ['method' => 'GET']); + $view->vars['attr']['data-max-files'] = $options['max_files']; + $view->vars['attr']['data-max-post-size'] = $options['max_post_size']; + } + + public function getParent() + { + return HiddenType::class; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Validator/Constraints/AsyncFileExistsValidatorTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Validator/Constraints/AsyncFileExistsValidatorTest.php new file mode 100644 index 000000000..6e46ee370 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Validator/Constraints/AsyncFileExistsValidatorTest.php @@ -0,0 +1,67 @@ + 404]); + } + + return new MockResponse('', ['http_code' => 200]); + }); + + $generator = $this->prophesize(TempUrlGeneratorInterface::class); + $generator->generate(Argument::in(['GET', 'HEAD']), Argument::type('string'), Argument::any()) + ->will(fn (array $args): SignedUrl => new SignedUrl($args[0], 'https://object.store.example/container/'.$args[1], new \DateTimeImmutable('1 hours'))); + + return new AsyncFileExistsValidator($generator->reveal(), $client); + } + + public function testWhenFileExistsIsValid(): void + { + $this->validator->validate((new StoredObject())->setFilename('present'), new AsyncFileExists()); + + $this->assertNoViolation(); + } + + public function testWhenFileIsNotPresent(): void + { + $this->validator->validate( + (new StoredObject())->setFilename('is_404'), + new AsyncFileExists(['message' => 'my_message']) + ); + + $this->buildViolation('my_message')->setParameter('{{ filename }}', 'is_404')->assertRaised(); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Validator/Constraints/AsyncFileExists.php b/src/Bundle/ChillDocStoreBundle/Validator/Constraints/AsyncFileExists.php new file mode 100644 index 000000000..4e251629b --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Validator/Constraints/AsyncFileExists.php @@ -0,0 +1,32 @@ +validateObject($value->getFilename(), $constraint); + } elseif (is_string($value)) { + $this->validateObject($value, $constraint); + } else { + throw new UnexpectedValueException($value, StoredObject::class.' or string'); + } + } + + protected function validateObject(string $file, Constraint $constraint): void + { + if (!$constraint instanceof AsyncFileExists) { + throw new UnexpectedTypeException($constraint, AsyncFileExists::class); + } + + $urlHead = $this->tempUrlGenerator->generate( + 'HEAD', + $file, + 30 + ); + + try { + $response = $this->client->request('HEAD', $urlHead->url); + + if (404 === $response->getStatusCode()) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ filename }}', $file) + ->addViolation(); + } + } catch (HttpExceptionInterface $exception) { + if (404 !== $exception->getResponse()->getStatusCode()) { + throw $exception; + } + } + } +} diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index c510064f1..27c04a60e 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -8,18 +8,6 @@ services: tags: - { name: doctrine.repository_service } - Chill\DocStoreBundle\Form\DocumentCategoryType: - class: Chill\DocStoreBundle\Form\DocumentCategoryType - arguments: [ "%kernel.bundles%" ] - tags: - - { name: form.type } - - Chill\DocStoreBundle\Form\PersonDocumentType: - class: Chill\DocStoreBundle\Form\PersonDocumentType - # arguments: - # - "@chill.main.helper.translatable_string" - tags: - - { name: form.type, alias: chill_docstorebundle_form_document } Chill\DocStoreBundle\Security\Authorization\: resource: "./../Security/Authorization" @@ -54,6 +42,9 @@ services: Chill\DocStoreBundle\GenericDoc\Renderer\: resource: '../GenericDoc/Renderer/' + Chill\DocStoreBundle\Validator\: + resource: '../Validator' + Chill\DocStoreBundle\AsyncUpload\Driver\: resource: '../AsyncUpload/Driver/' diff --git a/src/Bundle/ChillDocStoreBundle/config/services/form.yaml b/src/Bundle/ChillDocStoreBundle/config/services/form.yaml index 8d53d81f1..7515f306a 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services/form.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services/form.yaml @@ -1,13 +1,15 @@ services: - Chill\DocStoreBundle\Form\StoredObjectType: - arguments: - $em: '@Doctrine\ORM\EntityManagerInterface' - tags: - - { name: form.type } + _defaults: + autowire: true + autoconfigure: true - Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType: - class: Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType - arguments: - - "@chill.main.helper.translatable_string" - tags: - - { name: form.type, alias: chill_docstorebundle_form_document } + Chill\DocStoreBundle\Form\: + resource: '../../Form' + + Chill\DocStoreBundle\Form\PersonDocumentType: + tags: + - { name: form.type, alias: chill_docstorebundle_form_document } + + Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType: + tags: + - { name: form.type, alias: chill_docstorebundle_form_document } From 82ca32171570692f115bbc797bf6d58f0aa72b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Dec 2023 22:47:15 +0100 Subject: [PATCH 008/251] Add exceptions for async file handling failures Introduced two new exceptions, `BadCallToRemoteServer` and `TempUrlRemoteServerException`, to improve error handling in asynchronous file operations. These exceptions are thrown when there are issues with the remote server during an async file operation such as HTTP status codes >= 400 and if the server is unreachable. --- .../Exception/BadCallToRemoteServer.php | 20 +++++++++++++++++++ .../TempUrlRemoteServerException.php | 20 +++++++++++++++++++ .../Constraints/AsyncFileExistsValidator.php | 11 +++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlRemoteServerException.php diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php new file mode 100644 index 000000000..58ddfe0b0 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php @@ -0,0 +1,20 @@ +client->request('HEAD', $urlHead->url); - if (404 === $response->getStatusCode()) { + if (404 === $status = $response->getStatusCode()) { $this->context->buildViolation($constraint->message) ->setParameter('{{ filename }}', $file) ->addViolation(); + } elseif (500 <= $status) { + throw new TempUrlRemoteServerException($response->getStatusCode()); + } elseif (400 <= $status) { + throw new BadCallToRemoteServer($response->getContent(false), $response->getStatusCode()); } } catch (HttpExceptionInterface $exception) { if (404 !== $exception->getResponse()->getStatusCode()) { throw $exception; } + } catch (TransportExceptionInterface $e) { + throw new TempUrlRemoteServerException(0, previous: $e); } } } From 45e1ce034a3063b3da35994efb80f787e9900dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 11:35:44 +0100 Subject: [PATCH 009/251] Add ConfigureOpenstackObjectStorageCommand to ChillDocStoreBundle Added new command file "ConfigureOpenstackObjectStorageCommand.php" under ChillDocStoreBundle that helps in setting up OpenStack container for document storage. Along with the command, added corresponding test file "ConfigureOpenstackObjectStorageCommandTest.php" to ensure the functionality is working as expected. --- ...ConfigureOpenstackObjectStorageCommand.php | 90 +++++++++++++++++++ ...igureOpenstackObjectStorageCommandTest.php | 65 ++++++++++++++ .../ChillDocStoreBundle/config/services.yaml | 3 + 3 files changed, 158 insertions(+) create mode 100644 src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommandTest.php diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php new file mode 100644 index 000000000..de6690faf --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php @@ -0,0 +1,90 @@ +get('chill_doc_store')['openstack']['temp_url']; + + $this->tempUrlKey = $config['temp_url_key']; + $this->basePath = $config['temp_url_base_path']; + + parent::__construct(); + } + + protected function configure() + { + $this->setDescription('Configure openstack container to store documents') + ->setName('chill:doc-store:configure-openstack') + ->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token') + ->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name') + ; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->hasOption('os_token')) { + $output->writeln('The option os_token is required'); + + throw new \RuntimeException('The option os_token is required'); + } + + if (0 === count($input->getOption('domain'))) { + $output->writeln('At least one occurence of option domain is required'); + + throw new \RuntimeException('At least one occurence of option domain is required'); + } + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $domains = trim(implode(' ', $input->getOption('domain'))); + + if ($output->isVerbose()) { + $output->writeln(['Domains configured will be', $domains]); + } + + try { + $response = $this->client->request('POST', $this->basePath, [ + 'headers' => [ + 'X-Auth-Token' => $input->getOption('os_token'), + 'X-Container-Meta-Access-Control-Allow-Origin' => $domains, + 'X-Container-Meta-Temp-URL-Key' => $this->tempUrlKey, + ], + ]); + $response->getContent(); + } catch (HttpExceptionInterface $e) { + $output->writeln('Error'); + $output->writeln($e->getMessage()); + + if ($output->isVerbose()) { + $output->writeln($e->getTraceAsString()); + } + } + + return 0; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommandTest.php b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommandTest.php new file mode 100644 index 000000000..e0318313c --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommandTest.php @@ -0,0 +1,65 @@ + 204]); + }); + + $parameters = new ParameterBag([ + 'chill_doc_store' => [ + 'openstack' => [ + 'temp_url' => [ + 'temp_url_key' => '12345679801234567890', + 'temp_url_base_path' => 'https://object.store.example/v1/AUTH/container', + ], + ], + ], + ]); + + $command = new ConfigureOpenstackObjectStorageCommand($client, $parameters); + + $tester = new CommandTester($command); + + $status = $tester->execute([ + '--os_token' => 'abc', + '--domain' => ['https://chill.domain.social', 'https://chill2.domain.social'], + ]); + + self::assertSame(0, $status); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 27c04a60e..55163abb3 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -51,5 +51,8 @@ services: Chill\DocStoreBundle\AsyncUpload\Templating\: resource: '../AsyncUpload/Templating/' + Chill\DocStoreBundle\AsyncUpload\Command\: + resource: '../AsyncUpload/Command/' + Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface: alias: Chill\DocStoreBundle\AsyncUpload\Driver\OpenstackObjectStore\TempUrlOpenstackGenerator From f131572344f175249bdb3ea3e68ae00330ecaaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 12:01:51 +0100 Subject: [PATCH 010/251] Remove references to old async upload bundle --- composer.json | 1 - .../ChillDocStoreExtension.php | 1 - .../Entity/StoredObject.php | 3 +- .../Object/ObjectToAsyncFileTransformer.php | 47 ------------------- .../Object/PersistenceChecker.php | 40 ---------------- .../Tests/StoredObjectManagerTest.php | 10 ++-- .../config/services/media.yaml | 9 ---- 7 files changed, 8 insertions(+), 103 deletions(-) delete mode 100644 src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php delete mode 100644 src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php delete mode 100644 src/Bundle/ChillDocStoreBundle/config/services/media.yaml diff --git a/composer.json b/composer.json index 3195f732b..3a12f5617 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,6 @@ "ext-json": "*", "ext-openssl": "*", "ext-redis": "*", - "champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290", "champs-libres/wopi-bundle": "dev-master@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/doctrine-bundle": "^2.1", diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php index 70c479456..7ae5dcbe1 100644 --- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php +++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php @@ -36,7 +36,6 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); - $loader->load('services/media.yaml'); $loader->load('services/controller.yaml'); $loader->load('services/menu.yaml'); $loader->load('services/fixtures.yaml'); diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index abccdccc7..e937b2539 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Entity; -use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface; use Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists; use ChampsLibres\WopiLib\Contract\Entity\Document; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; @@ -33,7 +32,7 @@ use Symfony\Component\Serializer\Annotation as Serializer; * message="The file is not stored properly" * ) */ -class StoredObject implements AsyncFileInterface, Document, TrackCreationInterface +class StoredObject implements Document, TrackCreationInterface { use TrackCreationTrait; final public const STATUS_READY = 'ready'; diff --git a/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php b/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php deleted file mode 100644 index 8755b1c61..000000000 --- a/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php +++ /dev/null @@ -1,47 +0,0 @@ -em = $em; - } - - public function toAsyncFile($data) - { - if ($data instanceof StoredObject) { - return $data; - } - } - - public function toData(AsyncFileInterface $asyncFile) - { - $object = $this->em - ->getRepository(StoredObject::class) - ->findByFilename($asyncFile->getObjectName()); - - return $object ?? (new StoredObject()) - ->setFilename($asyncFile->getObjectName()); - } -} diff --git a/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php b/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php deleted file mode 100644 index 97dfdfa92..000000000 --- a/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php +++ /dev/null @@ -1,40 +0,0 @@ -em = $em; - } - - public function isPersisted($object_name): bool - { - $qb = $this->em->createQueryBuilder(); - $qb->select('COUNT(m)') - ->from(StoredObject::class, 'm') - ->where($qb->expr()->eq('m.filename', ':object_name')) - ->setParameter('object_name', $object_name); - - return 1 === $qb->getQuery()->getSingleScalarResult(); - } -} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php index bf659ba9b..226f67118 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php @@ -11,7 +11,8 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Tests; -use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; +use Chill\DocStoreBundle\AsyncUpload\SignedUrl; +use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Exception\StoredObjectManagerException; use Chill\DocStoreBundle\Service\StoredObjectManager; @@ -163,8 +164,11 @@ final class StoredObjectManagerTest extends TestCase private function getTempUrlGenerator(StoredObject $storedObject): TempUrlGeneratorInterface { - $response = new \stdClass(); - $response->url = $storedObject->getFilename(); + $response = new SignedUrl( + 'PUT', + 'https://example.com/'.$storedObject->getFilename(), + new \DateTimeImmutable('1 hours') + ); $tempUrlGenerator = $this->createMock(TempUrlGeneratorInterface::class); diff --git a/src/Bundle/ChillDocStoreBundle/config/services/media.yaml b/src/Bundle/ChillDocStoreBundle/config/services/media.yaml deleted file mode 100644 index e6afe2155..000000000 --- a/src/Bundle/ChillDocStoreBundle/config/services/media.yaml +++ /dev/null @@ -1,9 +0,0 @@ -services: - chill_doc_store.persistence_checker: - class: Chill\DocStoreBundle\Object\PersistenceChecker - arguments: - $em: '@Doctrine\ORM\EntityManagerInterface' - - Chill\DocStoreBundle\Object\ObjectToAsyncFileTransformer: - arguments: - $em: '@Doctrine\ORM\EntityManagerInterface' From 1065706e60cfa12ca4e7c6762df6e42a2e677fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 12:08:45 +0100 Subject: [PATCH 011/251] Re-configure test app --- tests/app/config/bundles.php | 1 - tests/app/config/packages/champs-libres.yaml | 14 -------------- tests/app/config/packages/chill_doc_store.yaml | 6 ++++++ 3 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 tests/app/config/packages/champs-libres.yaml create mode 100644 tests/app/config/packages/chill_doc_store.yaml diff --git a/tests/app/config/bundles.php b/tests/app/config/bundles.php index 36e3bcf03..d39a7c469 100644 --- a/tests/app/config/bundles.php +++ b/tests/app/config/bundles.php @@ -10,7 +10,6 @@ declare(strict_types=1); */ return [ - ChampsLibres\AsyncUploaderBundle\ChampsLibresAsyncUploaderBundle::class => ['all' => true], Chill\ActivityBundle\ChillActivityBundle::class => ['all' => true], Chill\AsideActivityBundle\ChillAsideActivityBundle::class => ['all' => true], Chill\CalendarBundle\ChillCalendarBundle::class => ['all' => true], diff --git a/tests/app/config/packages/champs-libres.yaml b/tests/app/config/packages/champs-libres.yaml deleted file mode 100644 index ebea3ef58..000000000 --- a/tests/app/config/packages/champs-libres.yaml +++ /dev/null @@ -1,14 +0,0 @@ -champs_libres_async_uploader: - openstack: - os_username: '%env(resolve:OS_USERNAME)%' # Required - os_password: '%env(resolve:OS_PASSWORD)%' # Required - os_tenant_id: '%env(resolve:OS_TENANT_ID)%' # Required - os_region_name: '%env(resolve:OS_REGION_NAME)%' # Required - os_auth_url: '%env(resolve:OS_AUTH_URL)%' # Required - temp_url: - temp_url_key: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_KEY)%' # Required - container: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_CONTAINER)%' # Required - temp_url_base_path: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_BASE_PATH)%' # Required. Do not forget a trailing slash - max_post_file_size: 15000000 # 15Mo (bytes) - max_expires_delay: 180 - max_submit_delay: 3600 diff --git a/tests/app/config/packages/chill_doc_store.yaml b/tests/app/config/packages/chill_doc_store.yaml new file mode 100644 index 000000000..994e19240 --- /dev/null +++ b/tests/app/config/packages/chill_doc_store.yaml @@ -0,0 +1,6 @@ +chill_doc_store: + openstack: + temp_url: + temp_url_key: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_KEY)%' # Required + container: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_CONTAINER)%' # Required + temp_url_base_path: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_BASE_PATH)%' # Required From 3fb04594eb30b491e52edeb98054e749132d9dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 15:49:37 +0100 Subject: [PATCH 012/251] add changie [ci-skip] --- .changes/unreleased/Feature-20231212-154841.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Feature-20231212-154841.yaml diff --git a/.changes/unreleased/Feature-20231212-154841.yaml b/.changes/unreleased/Feature-20231212-154841.yaml new file mode 100644 index 000000000..14e19345b --- /dev/null +++ b/.changes/unreleased/Feature-20231212-154841.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[DX] move async-upload-bundle features into chill-bundles' +time: 2023-12-12T15:48:41.954970271+01:00 +custom: + Issue: "221" From 16a5745df9558756d0a61cef3179c01770b1b2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 3 Sep 2023 15:24:50 +0200 Subject: [PATCH 013/251] Update composer to symfony 5 (without config) --- composer.json | 45 +++++++++---------- .../SendShortMessageOnEligibleCalendar.php | 7 +-- .../SendTestShortMessageOnCalendarCommand.php | 7 +-- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/composer.json b/composer.json index 3195f732b..90a352958 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "ext-json": "*", "ext-openssl": "*", "ext-redis": "*", - "champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290", + "champs-libres/async-uploader-bundle": "dev-master@dev", "champs-libres/wopi-bundle": "dev-master@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/doctrine-bundle": "^2.1", @@ -33,27 +33,27 @@ "ramsey/uuid-doctrine": "^1.7", "sensio/framework-extra-bundle": "^5.5", "spomky-labs/base64url": "^2.0", - "symfony/browser-kit": "^4.4", + "symfony/browser-kit": "^5.4", "symfony/clock": "^6.2", - "symfony/css-selector": "^4.4", - "symfony/expression-language": "^4.4", - "symfony/form": "^4.4", - "symfony/framework-bundle": "^4.4", - "symfony/http-client": "^4.4 || ^5", - "symfony/http-foundation": "^4.4", - "symfony/intl": "^4.4", + "symfony/css-selector": "^5.4", + "symfony/expression-language": "^5.4", + "symfony/form": "^5.4", + "symfony/framework-bundle": "^5.4", + "symfony/http-client": "^5.4", + "symfony/http-foundation": "^5.4", + "symfony/intl": "^5.4", "symfony/mailer": "^5.4", "symfony/messenger": "^5.4", "symfony/mime": "^5.4", "symfony/monolog-bundle": "^3.5", - "symfony/security-bundle": "^4.4", - "symfony/serializer": "^5.3", - "symfony/translation": "^4.4", - "symfony/twig-bundle": "^4.4", - "symfony/validator": "^4.4", + "symfony/security-bundle": "^5.4", + "symfony/serializer": "^5.4", + "symfony/translation": "^5.4", + "symfony/twig-bundle": "^5.4", + "symfony/validator": "^5.4", "symfony/webpack-encore-bundle": "^1.11", - "symfony/workflow": "^4.4", - "symfony/yaml": "^4.4", + "symfony/workflow": "^5.4", + "symfony/yaml": "^5.4", "thenetworg/oauth2-azure": "^2.0", "twig/extra-bundle": "^3.0", "twig/intl-extra": "^3.0", @@ -73,16 +73,13 @@ "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": ">= 7.5", - "psalm/plugin-phpunit": "^0.18.4", - "psalm/plugin-symfony": "^4.0.2", "rector/rector": "^0.17.7", - "symfony/debug-bundle": "^5.1", - "symfony/dotenv": "^4.4", + "symfony/debug-bundle": "^5.4", + "symfony/dotenv": "^5.4", "symfony/maker-bundle": "^1.20", - "symfony/phpunit-bridge": "^4.4", - "symfony/stopwatch": "^4.4", - "symfony/var-dumper": "^4.4", - "vimeo/psalm": "^4.30.0" + "symfony/phpunit-bridge": "^5.4", + "symfony/stopwatch": "^5.4", + "symfony/var-dumper": "^5.4" }, "conflict": { "symfony/symfony": "*" diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index a027c1bc2..6c1b31b9e 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -27,12 +27,7 @@ class SendShortMessageOnEligibleCalendar extends Command { public function __construct(private readonly BulkCalendarShortMessageSender $messageSender) { - parent::__construct(); - } - - public function getName() - { - return 'chill:calendar:send-short-messages'; + parent::__construct('chill:calendar:send-short-messages'); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php index bfbdd2abd..225b540df 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php @@ -47,12 +47,7 @@ class SendTestShortMessageOnCalendarCommand extends Command private readonly ShortMessageTransporterInterface $transporter, private readonly UserRepositoryInterface $userRepository ) { - parent::__construct(); - } - - public function getName() - { - return 'chill:calendar:test-send-short-message'; + parent::__construct('chill:calendar:test-send-short-message'); } protected function configure() From ceaabfb034dcadc1cc0a06db459148d36d565292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 5 Sep 2023 12:05:29 +0200 Subject: [PATCH 014/251] Downgrade symfony bundle to ^5.4 (some were on 6.3) composer: restrict missing bundle to symfony 5.4 --- composer.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/composer.json b/composer.json index 90a352958..61ccfd73c 100644 --- a/composer.json +++ b/composer.json @@ -33,10 +33,19 @@ "ramsey/uuid-doctrine": "^1.7", "sensio/framework-extra-bundle": "^5.5", "spomky-labs/base64url": "^2.0", + "symfony/asset": "^5.4", "symfony/browser-kit": "^5.4", + "symfony/cache": "^5.4", "symfony/clock": "^6.2", + "symfony/config": "^5.4", + "symfony/console": "^5.4", "symfony/css-selector": "^5.4", + "symfony/dom-crawler": "^5.4", + "symfony/error-handler": "^5.4", + "symfony/event-dispatcher": "^5.4", "symfony/expression-language": "^5.4", + "symfony/filesystem": "^5.4", + "symfony/finder": "^5.4", "symfony/form": "^5.4", "symfony/framework-bundle": "^5.4", "symfony/http-client": "^5.4", @@ -46,8 +55,19 @@ "symfony/messenger": "^5.4", "symfony/mime": "^5.4", "symfony/monolog-bundle": "^3.5", + "symfony/options-resolver": "^5.4", + "symfony/process": "^5.4", + "symfony/property-access": "^5.4", + "symfony/property-info": "^5.4", + "symfony/routing": "^5.4", "symfony/security-bundle": "^5.4", + "symfony/security-core": "^5.4", + "symfony/security-csrf": "^5.4", + "symfony/security-guard": "^5.4", + "symfony/security-http": "^5.4", "symfony/serializer": "^5.4", + "symfony/string": "^5.4", + "symfony/templating": "^5.4", "symfony/translation": "^5.4", "symfony/twig-bundle": "^5.4", "symfony/validator": "^5.4", From 4c52aa366a1d88fa29332e632d900d5f7519f7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 5 Sep 2023 12:05:57 +0200 Subject: [PATCH 015/251] Rector rules: add rules for 5.0 types --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index 0dd8e355c..96bd47710 100644 --- a/rector.php +++ b/rector.php @@ -33,6 +33,7 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->sets([ LevelSetList::UP_TO_PHP_82, \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_44, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, ]); From c6bb7b1d9895784c3448e9e4c761274050bd3dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 5 Sep 2023 12:06:07 +0200 Subject: [PATCH 016/251] Rector rules: apply rules for 5.0 types --- .../ChillMainBundle/Form/DataMapper/AddressDataMapper.php | 4 ++-- .../Form/DataMapper/ExportPickCenterDataMapper.php | 4 ++-- .../Form/DataMapper/PrivateCommentDataMapper.php | 4 ++-- .../ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php | 4 ++-- .../ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php | 4 ++-- .../Form/DataMapper/PersonAltNameDataMapper.php | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php index c88e2275b..8db31c0b1 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php @@ -28,7 +28,7 @@ class AddressDataMapper implements DataMapperInterface * @param Address $address * @param \Iterator $forms */ - public function mapDataToForms($address, $forms) + public function mapDataToForms($address, iterable $forms) { if (null === $address) { return; @@ -78,7 +78,7 @@ class AddressDataMapper implements DataMapperInterface * @param \Iterator $forms * @param Address $address */ - public function mapFormsToData($forms, &$address) + public function mapFormsToData(iterable $forms, &$address) { if (!$address instanceof Address) { $address = new Address(); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php index 73d048c1a..495c5d221 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface; final readonly class ExportPickCenterDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, iterable $forms): void { if (null === $viewData) { return; @@ -31,7 +31,7 @@ final readonly class ExportPickCenterDataMapper implements DataMapperInterface // NOTE: we do not map back the regroupments } - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(iterable $forms, &$viewData): void { /** @var array $forms */ $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 68fad0a99..4f6022afe 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -21,7 +21,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI { public function __construct(private readonly Security $security) {} - public function mapDataToForms($viewData, $forms) + public function mapDataToForms($viewData, iterable $forms) { if (null === $viewData) { return null; @@ -36,7 +36,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI $forms['comments']->setData($viewData->getCommentForUser($this->security->getUser())); } - public function mapFormsToData($forms, &$viewData) + public function mapFormsToData(iterable $forms, &$viewData) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php index 6a139de7b..99dd4b053 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception; class RollingDateDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, $forms) + public function mapDataToForms($viewData, iterable $forms) { if (null === $viewData) { return; @@ -33,7 +33,7 @@ class RollingDateDataMapper implements DataMapperInterface $forms['fixedDate']->setData($viewData->getFixedDate()); } - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(iterable $forms, &$viewData): void { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index cf96292af..ef040d16b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -18,7 +18,7 @@ class ScopePickerDataMapper implements DataMapperInterface { public function __construct(private readonly ?Scope $scope = null) {} - public function mapDataToForms($data, $forms) + public function mapDataToForms($data, iterable $forms) { $forms = iterator_to_array($forms); @@ -37,7 +37,7 @@ class ScopePickerDataMapper implements DataMapperInterface } } - public function mapFormsToData($forms, &$data) + public function mapFormsToData(iterable $forms, &$data) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php index 0fc25eefe..ab36e3e9b 100644 --- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php +++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class PersonAltNameDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, $forms) + public function mapDataToForms($viewData, iterable $forms) { if (null === $viewData) { return; @@ -47,7 +47,7 @@ class PersonAltNameDataMapper implements DataMapperInterface * @param FormInterface[] $forms * @param Collection $viewData */ - public function mapFormsToData($forms, &$viewData) + public function mapFormsToData(iterable $forms, &$viewData) { $mapIndexToKey = []; From 2f8de4bf010c03e7565e7ed9adada17b479d34d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Sep 2023 13:26:40 +0200 Subject: [PATCH 017/251] Upgrade recipes: symfony/security-bundle --- src/Bundle/ChillMainBundle/config/services/form.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index 226af2afe..86e78edfa 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -93,12 +93,12 @@ services: Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer: ~ - chill.main.form.advanced_search_type: - class: Chill\MainBundle\Form\AdvancedSearchType - arguments: - - "@chill_main.search_provider" - tags: - - { name: form.type } + #chill.main.form.advanced_search_type: + # class: Chill\MainBundle\Form\AdvancedSearchType + # arguments: + # - "@chill_main.search_provider" + # tags: + # - { name: form.type } Chill\MainBundle\Form\UserPasswordType: arguments: From f9a2d7f2d5c87e1058060dc79b63240bd192ab6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Sep 2023 14:42:00 +0200 Subject: [PATCH 018/251] Add symfony runtime to composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 61ccfd73c..9a17a8257 100644 --- a/composer.json +++ b/composer.json @@ -98,6 +98,7 @@ "symfony/dotenv": "^5.4", "symfony/maker-bundle": "^1.20", "symfony/phpunit-bridge": "^5.4", + "symfony/runtime": "^5.4", "symfony/stopwatch": "^5.4", "symfony/var-dumper": "^5.4" }, From f68deca99298e07f0d116ed3337651667621d2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Sep 2023 14:42:11 +0200 Subject: [PATCH 019/251] Fix icu message --- src/Bundle/ChillMainBundle/Entity/User.php | 10 +++--- .../ChillTaskBundle/Menu/UserMenuBuilder.php | 36 ++++--------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 23dfe6926..07724b1c3 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -18,7 +18,8 @@ use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Mapping as ORM; -use libphonenumber\PhoneNumber; +use RuntimeException; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -37,7 +38,7 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; * "user": User::class * }) */ -class User implements UserInterface, \Stringable +class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface { /** * @ORM\Id @@ -306,10 +307,7 @@ class User implements UserInterface, \Stringable return new ArrayCollection($sortedScopeHistories); } - /** - * @return string - */ - public function getPassword() + public function getPassword(): ?string { return $this->password; } diff --git a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php index a8c299680..e744ddb24 100644 --- a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php @@ -19,38 +19,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class UserMenuBuilder implements LocalMenuBuilderInterface +final readonly class UserMenuBuilder implements LocalMenuBuilderInterface { - /** - * @var AuthorizationCheckerInterface - */ - public $authorizationChecker; - - /** - * @var CountNotificationTask - */ - public $counter; - - /** - * @var TokenStorageInterface - */ - public $tokenStorage; - - /** - * @var TranslatorInterface - */ - public $translator; - public function __construct( - CountNotificationTask $counter, - TokenStorageInterface $tokenStorage, - TranslatorInterface $translator, - AuthorizationCheckerInterface $authorizationChecker + private CountNotificationTask $counter, + private TokenStorageInterface $tokenStorage, + private TranslatorInterface $translator, + private AuthorizationCheckerInterface $authorizationChecker ) { - $this->counter = $counter; - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; - $this->authorizationChecker = $authorizationChecker; } public function buildMenu($menuId, MenuItem $menu, array $parameters) @@ -99,7 +75,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface return ['user']; } - protected function addItemInMenu(MenuItem $menu, $message, $number, $order, array $states = [], array $status = []) + private function addItemInMenu(MenuItem $menu, string $message, int $number, $order, array $states = [], array $status = []) { if (0 < $number) { $menu->addChild( From e2a37fd80b135b1d369417a91e2113844738cb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 17:12:01 +0100 Subject: [PATCH 020/251] fix typo in classname (Phonenumber => PhoneNumber) --- src/Bundle/ChillMainBundle/Entity/User.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 07724b1c3..58efc8326 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Mapping as ORM; -use RuntimeException; +use libphonenumber\PhoneNumber; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Serializer\Annotation as Serializer; @@ -428,7 +428,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter } } - public function getPhonenumber(): ?PhoneNumber + public function getPhonenumber(): PhoneNumber { return $this->phonenumber; } From 99b7b2ec8802da53377d88bfa5efc492916d4ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 17:17:15 +0100 Subject: [PATCH 021/251] upgrade rector rules and apply them --- rector.php | 2 +- .../Tests/Controller/PersonControllerCreateTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rector.php b/rector.php index 96bd47710..72a7cb9f5 100644 --- a/rector.php +++ b/rector.php @@ -32,7 +32,7 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ LevelSetList::UP_TO_PHP_82, - \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_44, + \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_50, \Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php index 572374bc1..ed3d44120 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php @@ -134,7 +134,7 @@ final class PersonControllerCreateTest extends WebTestCase return $form; } - public function testReviewExistingDetectionInversedLastNameWithFirstName() + public function testReviewExistingDetectionInversedLastNameWithFirstName(): never { $this->markTestSkipped(); $client = $this->getClientAuthenticated(); From f35f5f0876201177b5ace4a896b19c62acf4023e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 17:19:28 +0100 Subject: [PATCH 022/251] fixup! fix typo in classname (Phonenumber => PhoneNumber) --- src/Bundle/ChillMainBundle/Entity/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 58efc8326..fe1489337 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -428,7 +428,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter } } - public function getPhonenumber(): PhoneNumber + public function getPhonenumber(): ?PhoneNumber { return $this->phonenumber; } From ac98ba4555b1d08da5a4e056fb5ce37fe419b1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 17:56:27 +0100 Subject: [PATCH 023/251] re-organize phpstan deprecations files, with a baseline of deprecations for symfony 5.4 --- phpstan-baseline.neon | 25 ++ phpstan-deprecations-sf54.neon | 575 +++++++++++++++++++++++++++++++++ phpstan-deprecations.neon | 422 +----------------------- phpstan.neon.dist | 2 +- 4 files changed, 602 insertions(+), 422 deletions(-) create mode 100644 phpstan-deprecations-sf54.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a89386f29..8af07174d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,30 @@ parameters: ignoreErrors: + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php + + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Form/PersonType.php + + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php + + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php + + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/Repository/NotificationRepository.php + - message: "#^Foreach overwrites \\$key with its key variable\\.$#" count: 1 diff --git a/phpstan-deprecations-sf54.neon b/phpstan-deprecations-sf54.neon new file mode 100644 index 000000000..019df1022 --- /dev/null +++ b/phpstan-deprecations-sf54.neon @@ -0,0 +1,575 @@ +parameters: + ignoreErrors: + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 5 + path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 5 + path: src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 2 + path: src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillCalendarBundle/Controller/CalendarController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 2 + path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 9 + path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 7 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 2 + path: src/Bundle/ChillEventBundle/Controller/EventController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillEventBundle/Controller/EventController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillEventBundle/Controller/EventTypeController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 10 + path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillEventBundle/Controller/RoleController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillEventBundle/Controller/StatusController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 7 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 7 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php + + - + message: """ + #^Parameter \\$passwordEncoder of method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\UserPasswordEncoderInterface\\: + since Symfony 5\\.3, use \\{@link UserPasswordHasherInterface\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\EncoderFactory\\: + since Symfony 5\\.3, use \\{@link PasswordHasherFactory\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\MessageDigestPasswordEncoder\\: + since Symfony 5\\.3, use \\{@link MessageDigestPasswordHasher\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/Controller/AbsenceController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/AddressApiController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/MenuController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/NotificationController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 5 + path: src/Bundle/ChillMainBundle/Controller/PasswordController.php + + - + message: """ + #^Parameter \\$passwordEncoder of method Chill\\\\MainBundle\\\\Controller\\\\PasswordController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\UserPasswordEncoderInterface\\: + since Symfony 5\\.3, use \\{@link UserPasswordHasherInterface\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/PasswordController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/PostalCodeController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 5 + path: src/Bundle/ChillMainBundle/Controller/ScopeController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/SearchController.php + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: """ + #^Parameter \\$passwordEncoder of method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\UserPasswordEncoderInterface\\: + since Symfony 5\\.3, use \\{@link UserPasswordHasherInterface\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserProfileController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/WorkflowController.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\EncoderFactory\\: + since Symfony 5\\.3, use \\{@link PasswordHasherFactory\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\MessageDigestPasswordEncoder\\: + since Symfony 5\\.3, use \\{@link MessageDigestPasswordHasher\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php + + - + message: """ + #^Parameter \\$passwordEncoder of method Chill\\\\MainBundle\\\\Form\\\\UserPasswordType\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\UserPasswordEncoderInterface\\: + since Symfony 5\\.3, use \\{@link UserPasswordHasherInterface\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Form/UserPasswordType.php + + - + message: """ + #^Call to deprecated method isMasterRequest\\(\\) of class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\KernelEvent\\: + since symfony/http\\-kernel 5\\.3, use isMainRequest\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Exception\\\\UsernameNotFoundException\\: + since Symfony 5\\.3 to be removed in 6\\.0, use UserNotFoundException instead\\.$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 3 + path: src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 5 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 13 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 6 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Controller/ClosingMotiveController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillPersonBundle/Controller/HouseholdController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 8 + path: src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillPersonBundle/Controller/PersonController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 8 + path: src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 7 + path: src/Bundle/ChillReportBundle/Controller/ReportController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 9 + path: src/Bundle/ChillReportBundle/Controller/ReportController.php + + - + message: """ + #^Call to deprecated method getDoctrine\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, inject an instance of ManagerRegistry in your controller instead$# + """ + count: 8 + path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index c83feeb59..7f47e9c71 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -1,36 +1,5 @@ parameters: ignoreErrors: - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 2 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - - message: "#^Call to deprecated method setType\\(\\) of class Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Entity/ActivityReason.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillActivityBundle/Form/ActivityType.php - - message: """ @@ -40,201 +9,10 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php - - - - message: "#^Used function LogicException not found\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php - - - - message: """ - #^Parameter \\$twigEngine of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 6 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillEventBundle/Form/EventType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillEventBundle/Form/Type/PickEventType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php - - - - message: """ - #^Parameter \\$role of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php - - - - message: """ - #^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php - - - - message: """ - #^Call to deprecated method getRegionBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Countries\\} instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - - - message: """ - #^Parameter \\$role of anonymous function has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - - - message: """ - #^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$# - """ - count: 2 - path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php - - - - message: """ - #^Return type of method Chill\\\\MainBundle\\\\Entity\\\\User\\:\\:getRoles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Entity/User.php - - - - message: """ - #^Class Chill\\\\MainBundle\\\\Form\\\\Event\\\\CustomizeFormEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Repository/NotificationRepository.php - - - - message: """ - #^Parameter \\$attribute of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:userHasAccess\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php - message: """ @@ -244,14 +22,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php - - - message: """ - #^Parameter \\$role of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:getReachableCircles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\DefaultVoterHelper\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -276,14 +46,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php - - - message: """ - #^Class Chill\\\\MainBundle\\\\Security\\\\PasswordRecover\\\\PasswordRecoverEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php - - message: """ #^Class Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcher implements deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -292,35 +54,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php - - - - message: """ - #^Class Chill\\\\MainBundle\\\\Templating\\\\Events\\\\DelegatedBlockRenderingEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Actions\\\\ActionEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Actions/ActionEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\: - since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php - - message: """ #^Call to deprecated method getCurrentAccompanyingPeriod\\(\\) of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\: @@ -329,56 +62,10 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Controller\\\\PersonDuplicateController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\: - since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php - - message: "#^Access to deprecated property \\$proxyAccompanyingPeriodOpenState of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\.$#" count: 2 path: src/Bundle/ChillPersonBundle/Entity/Person.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/PersonType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Privacy\\\\AccompanyingPeriodPrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Privacy\\\\PrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriodACLAwareRepository\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -387,48 +74,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 3 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - - message: """ - #^Parameter \\$role of method Chill\\\\ReportBundle\\\\Form\\\\ReportType\\:\\:appendScopeChoices\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillReportBundle/Form/ReportType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillReportBundle/Search/ReportSearch.php - - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 2 - path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -437,46 +82,6 @@ parameters: count: 1 path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - - message: """ - #^Parameter \\$role of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:setCreateForm\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Event\\\\TaskEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Event/TaskEvent.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Event\\\\UI\\\\UIEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 4 - path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Form\\\\SingleTaskType\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -484,28 +89,3 @@ parameters: """ count: 1 path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Security\\\\Authorization\\\\AuthorizationEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 3 - path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php - diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 62dbe0468..648e4e608 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -31,4 +31,4 @@ includes: - phpstan-baseline-level-3.neon - phpstan-baseline-level-4.neon - phpstan-baseline-level-5.neon - + - phpstan-deprecations-sf54.neon From af663cf27cf7cd92a2eed265eda98a67d793488b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 22:33:57 +0100 Subject: [PATCH 024/251] Create the helper ChillSecurity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En symfony 5.4 le typage a été vraiment amélioré, et phpstan peut détecter plus d'erreur potentielles. Mais le problème est que Symfony "type" les `User` avec son propre `Symfony\Component\Security\Core\User\UserInterface` alors qu'on a besoin de `Chill\MainBundle\Entity\User`. Imaginons qu'on a ceci: ```php namespace Chill\Bundle\Service; final readonly class SomeService { public function myMethod(\Chill\MainBundle\Entity\User $user): void { // ... } } ``` Quand on l'appelle dans un contrôleur ou dans un service: ```php namespace Chill\Bundle\Service; use Symfony\Component\Security\Core\Security; final readonly OtherService { public function __construct(private Security $security, private SomeService $service) {} public function __invoke(): void { $this->service->myMethod($this->security->getUser()); } } ``` PHPstan va se plaindre: ``` Parameter #1 $user of method SomeService::myMethod() expects Chill\MainBundle\Entity\User, Symfony\Component\Security\Core\User\UserInterface|null given. ``` Du coup, j'ai créé ce service: ```php service->myMethod($this->security->getUser()); } } ``` Et tout va bien se passer. Ca sera dans la version de chill qui fait passer à symfony 5.4. --- .../Security/ChillSecurity.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Security/ChillSecurity.php diff --git a/src/Bundle/ChillMainBundle/Security/ChillSecurity.php b/src/Bundle/ChillMainBundle/Security/ChillSecurity.php new file mode 100644 index 000000000..eb21d00df --- /dev/null +++ b/src/Bundle/ChillMainBundle/Security/ChillSecurity.php @@ -0,0 +1,54 @@ +security->getUser(); + } + + public function getUser(): User + { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new \LogicException(sprintf('authenticated user should be an instance of %s, %s given', User::class, null !== $user ? $user::class : self::class)); + } + + return $user; + } + + public function isGranted($attribute, $subject = null): bool + { + return $this->security->isGranted($attribute, $subject); + } + + public function getToken(): ?TokenInterface + { + return $this->security->getToken(); + } +} From da997badd92646d74128816268895728604e9366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 22:34:26 +0100 Subject: [PATCH 025/251] Fix phpstan issues --- .../Controller/ActivityController.php | 12 ++-- .../DataFixtures/ORM/LoadActivity.php | 2 +- .../Controller/AsideActivityController.php | 12 +++- .../Event/ListenToActivityCreate.php | 2 +- .../DocGeneratorTemplateController.php | 15 ++++- .../Controller/AbsenceController.php | 7 ++- .../Controller/NotificationController.php | 29 ++++------ .../Controller/PasswordController.php | 57 +++---------------- .../Controller/SearchController.php | 2 +- .../Controller/UserApiController.php | 10 +++- .../Controller/UserController.php | 13 ++++- .../Controller/UserProfileController.php | 11 +++- .../Controller/WorkflowController.php | 34 +++++------ src/Bundle/ChillMainBundle/Entity/User.php | 5 ++ .../AccompanyingCourseController.php | 53 +++++++++++------ .../AccompanyingCourseWorkApiController.php | 18 +++++- .../Controller/HouseholdMemberController.php | 57 ++++++++++++------- .../Controller/PersonDuplicateController.php | 25 ++++++-- .../DataMapper/PersonAltNameDataMapper.php | 8 +-- .../Form/Type/PickPersonType.php | 56 +++++------------- .../Privacy/PrivacyEventSubscriber.php | 37 ++++++------ .../config/services/controller.yaml | 6 -- .../ChillReportBundle/Form/ReportType.php | 46 +++++---------- .../Controller/SingleTaskController.php | 12 +++- .../Controller/TaskController.php | 4 +- .../ChillTaskBundle/Menu/UserMenuBuilder.php | 3 +- 26 files changed, 275 insertions(+), 261 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 06489010c..25dd3fedd 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -24,6 +24,7 @@ use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\LocationRepository; use Chill\MainBundle\Repository\UserRepositoryInterface; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; @@ -67,6 +68,7 @@ final class ActivityController extends AbstractController private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly PaginatorFactory $paginatorFactory, + private readonly ChillSecurity $security ) {} /** @@ -384,7 +386,7 @@ final class ActivityController extends AbstractController } $entity = new Activity(); - $entity->setUser($this->getUser()); + $entity->setUser($this->security->getUser()); if ($person instanceof Person) { $entity->setPerson($person); @@ -399,7 +401,7 @@ final class ActivityController extends AbstractController $entity->setDate(new \DateTime('now')); if ($request->query->has('activityData')) { - $activityData = $request->query->get('activityData'); + $activityData = $request->query->all('activityData'); if (\array_key_exists('durationTime', $activityData) && $activityType->getDurationTimeVisible() > 0) { $durationTimeInMinutes = $activityData['durationTime']; @@ -452,7 +454,7 @@ final class ActivityController extends AbstractController if (\array_key_exists('comment', $activityData) && $activityType->getCommentVisible() > 0) { $comment = new CommentEmbeddable(); $comment->setComment($activityData['comment']); - $comment->setUserId($this->getUser()->getid()); + $comment->setUserId($this->security->getUser()->getId()); $comment->setDate(new \DateTime('now')); $entity->setComment($comment); } @@ -513,7 +515,7 @@ final class ActivityController extends AbstractController $activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']); - $defaultLocation = $this->getUser()->getCurrentLocation(); + $defaultLocation = $this->security->getUser()->getCurrentLocation(); return $this->render($view, [ 'person' => $person, @@ -568,7 +570,7 @@ final class ActivityController extends AbstractController 'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, 'data' => $data, - 'activityData' => $request->query->get('activityData', []), + 'activityData' => $request->query->all('activityData'), ]); } diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index b205384e6..a547ab21e 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -64,7 +64,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface ->setPerson($person) ->setDate($this->faker->dateTimeThisYear()) ->setDurationTime($this->faker->dateTime(36000)) - ->setType($this->getRandomActivityType()) + ->setActivityType($this->getRandomActivityType()) ->setScope($this->getRandomScope()); // ->setAttendee($this->faker->boolean()) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index c29a5a6dc..e0d553327 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -15,19 +15,25 @@ use Chill\AsideActivityBundle\Entity\AsideActivity; use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository; use Chill\MainBundle\CRUD\Controller\CRUDController; use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; final class AsideActivityController extends CRUDController { - public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository) {} + public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository, private readonly ChillSecurity $security) {} public function createEntity(string $action, Request $request): object { + if (!$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + $asideActivity = new AsideActivity(); - $asideActivity->setAgent($this->getUser()); - $asideActivity->setLocation($this->getUser()->getCurrentLocation()); + $asideActivity->setAgent($this->security->getUser()); + $asideActivity->setLocation($this->security->getUser()->getCurrentLocation()); $duration = $request->query->get('duration', '300'); $duration = \DateTime::createFromFormat('U', $duration); diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index 82c76eea4..79629bfbb 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -29,7 +29,7 @@ class ListenToActivityCreate } if ($request->query->has('activityData')) { - $activityData = $request->query->get('activityData'); + $activityData = $request->query->all('activityData'); if (\array_key_exists('calendarId', $activityData)) { $calendarId = $activityData['calendarId']; diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index c9e1873b2..5f8d99f7c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -20,6 +20,7 @@ use Chill\DocGeneratorBundle\Service\Generator\GeneratorInterface; use Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\MainBundle\Pagination\PaginatorFactory; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Serializer\Model\Collection; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -37,7 +38,15 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class DocGeneratorTemplateController extends AbstractController { - public function __construct(private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager) {} + public function __construct( + private readonly ContextManager $contextManager, + private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, + private readonly GeneratorInterface $generator, + private readonly MessageBusInterface $messageBus, + private readonly PaginatorFactory $paginatorFactory, + private readonly EntityManagerInterface $entityManager, + private readonly ChillSecurity $security + ) {} /** * @Route( @@ -217,7 +226,7 @@ final class DocGeneratorTemplateController extends AbstractController : []; // if is test, render the data or generate the doc - if ($isTest && isset($form) && $form['show_data']->getData()) { + if ($isTest && isset($form) && true === $form['show_data']->getData()) { return $this->render('@ChillDocGenerator/Generator/debug_value.html.twig', [ 'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), \JSON_PRETTY_PRINT), ]); @@ -265,7 +274,7 @@ final class DocGeneratorTemplateController extends AbstractController $this->messageBus->dispatch( new RequestGenerationMessage( - $this->getUser(), + $this->security->getUser(), $template, $entityId, $storedObject, diff --git a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php index 809b7b901..8664dbde5 100644 --- a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php +++ b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php @@ -12,12 +12,15 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; use Chill\MainBundle\Form\AbsenceType; +use Chill\MainBundle\Security\ChillSecurity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; class AbsenceController extends AbstractController { + public function __construct(private readonly ChillSecurity $security) {} + /** * @Route( * "/{_locale}/absence", @@ -27,7 +30,7 @@ class AbsenceController extends AbstractController */ public function setAbsence(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $form = $this->createForm(AbsenceType::class, $user); $form->handleRequest($request); @@ -54,7 +57,7 @@ class AbsenceController extends AbstractController */ public function unsetAbsence(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $user->setAbsenceStart(null); $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index 4131ba714..37b715ebd 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -13,7 +13,6 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Entity\NotificationComment; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\NotificationCommentType; use Chill\MainBundle\Form\NotificationType; use Chill\MainBundle\Notification\Exception\NotificationHandlerNotFound; @@ -22,6 +21,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Security\Authorization\NotificationVoter; +use Chill\MainBundle\Security\ChillSecurity; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -32,7 +32,6 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; @@ -41,7 +40,7 @@ use function in_array; */ class NotificationController extends AbstractController { - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly Security $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository) {} /** * @Route("/create", name="chill_main_notification_create") @@ -50,10 +49,6 @@ class NotificationController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - if (!$this->security->getUser() instanceof User) { - throw new AccessDeniedHttpException('You must be authenticated and a user to create a notification'); - } - if (!$request->query->has('entityClass')) { throw new BadRequestHttpException('Missing entityClass parameter'); } @@ -68,13 +63,13 @@ class NotificationController extends AbstractController ->setRelatedEntityId($request->query->getInt('entityId')) ->setSender($this->security->getUser()); - if ($request->query->has('tos')) { - foreach ($request->query->get('tos') as $toId) { - if (null === $to = $this->userRepository->find($toId)) { - throw new NotFoundHttpException("user with id {$toId} is not found"); - } - $notification->addAddressee($to); + $tos = $request->query->all('tos'); + + foreach ($tos as $toId) { + if (null === $to = $this->userRepository->find($toId)) { + throw new NotFoundHttpException("user with id {$toId} is not found"); } + $notification->addAddressee($to); } try { @@ -144,10 +139,6 @@ class NotificationController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - if (!$this->security->getUser() instanceof User) { - throw new AccessDeniedHttpException('You must be authenticated and a user to create a notification'); - } - foreach (['accessKey'/* , 'email' */] as $param) { if (!$request->query->has($param)) { throw new BadRequestHttpException("Missing {$param} parameter"); @@ -308,8 +299,8 @@ class NotificationController extends AbstractController ]); // we mark the notification as read after having computed the response - if ($this->getUser() instanceof User && !$notification->isReadBy($this->getUser())) { - $notification->markAsReadBy($this->getUser()); + if (!$notification->isReadBy($this->security->getUser())) { + $notification->markAsReadBy($this->security->getUser()); $this->em->flush(); } diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index 04ec22977..c6815f2cf 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\UserPasswordType; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverEvent; use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverVoter; use Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper; @@ -24,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Constraints\Callback; @@ -33,56 +35,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Class PasswordController. */ -class PasswordController extends AbstractController +final class PasswordController extends AbstractController { - /** - * @var LoggerInterface - */ - protected $chillLogger; - - /** - * @var EventDispatcherInterface - */ - protected $eventDispatcher; - - /** - * @var UserPasswordEncoderInterface - */ - protected $passwordEncoder; - - /** - * @var RecoverPasswordHelper - */ - protected $recoverPasswordHelper; - - /** - * @var TokenManager - */ - protected $tokenManager; - - /** - * @var TranslatorInterface - */ - protected $translator; - /** * PasswordController constructor. */ - public function __construct( - LoggerInterface $chillLogger, - UserPasswordEncoderInterface $passwordEncoder, - RecoverPasswordHelper $recoverPasswordHelper, - TokenManager $tokenManager, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher - ) { - $this->chillLogger = $chillLogger; - $this->passwordEncoder = $passwordEncoder; - $this->translator = $translator; - $this->tokenManager = $tokenManager; - $this->recoverPasswordHelper = $recoverPasswordHelper; - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security) {} /** * @return Response @@ -250,8 +208,11 @@ class PasswordController extends AbstractController */ public function UserPasswordAction(Request $request) { + if (!$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } // get authentified user - $user = $this->getUser(); + $user = $this->security->getUser(); // create a form for password_encoder $form = $this->passwordForm($user); @@ -269,7 +230,7 @@ class PasswordController extends AbstractController 'update password for an user', [ 'method' => $request->getMethod(), - 'user' => $user->getUsername(), + 'user' => $user->getUserIdentifier(), ] ); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 6324561cc..e81e3d9dc 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -199,7 +199,7 @@ class SearchController extends AbstractController { // TODO this is an incomplete implementation $query = $request->query->get('q', ''); - $types = $request->query->get('type', []); + $types = $request->query->all('type'); if (0 === \count($types)) { throw new BadRequestHttpException('The request must contains at one type'); diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php index 6809d3289..ae764c9d2 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -13,13 +13,17 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\MainBundle\Security\ChillSecurity; use Doctrine\ORM\QueryBuilder; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; class UserApiController extends ApiController { + public function __construct(private readonly ChillSecurity $security) {} + /** * @Route( * "/api/1.0/main/user-current-location.{_format}", @@ -31,8 +35,12 @@ class UserApiController extends ApiController */ public function currentLocation(mixed $_format): JsonResponse { + if (!$this->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + return $this->json( - $this->getUser()->getCurrentLocation(), + $this->security->getUser()->getCurrentLocation(), JsonResponse::HTTP_OK, [], ['groups' => ['read']] diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 1a25c4ad4..8e0e8ad1b 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\UserPasswordType; use Chill\MainBundle\Form\UserType; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; @@ -38,7 +39,15 @@ class UserController extends CRUDController { final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter'; - public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator) {} + public function __construct( + private readonly LoggerInterface $logger, + private readonly ValidatorInterface $validator, + private readonly UserPasswordEncoderInterface $passwordEncoder, + private readonly UserRepository $userRepository, + protected ParameterBagInterface $parameterBag, + private readonly TranslatorInterface $translator, + private readonly ChillSecurity $security + ) {} /** * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", @@ -197,7 +206,7 @@ class UserController extends CRUDController */ public function editCurrentLocationAction(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $form = $this->createForm(UserCurrentLocationType::class, $user) ->add('submit', SubmitType::class, ['label' => 'Save']) ->handleRequest($request); diff --git a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php index 52aba1a48..0867bf2cd 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -12,18 +12,21 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; use Chill\MainBundle\Form\UserPhonenumberType; +use Chill\MainBundle\Security\ChillSecurity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Component\Routing\Annotation\Route; -class UserProfileController extends AbstractController +final class UserProfileController extends AbstractController { public function __construct( private readonly TranslatorInterface $translator, + private readonly ChillSecurity $security, ) {} /** @@ -33,7 +36,11 @@ class UserProfileController extends AbstractController */ public function __invoke(Request $request) { - $user = $this->getUser(); + if (!$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + + $user = $this->security->getUser(); $editForm = $this->createPhonenumberEditForm($user); $editForm->handleRequest($request); diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index b641ed46a..1e93d6f49 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\WorkflowStepType; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository; use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Workflow\EntityWorkflowManager; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -27,10 +28,9 @@ use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Workflow\Registry; use Symfony\Component\Workflow\TransitionBlocker; @@ -38,7 +38,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class WorkflowController extends AbstractController { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly Security $security) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly ChillSecurity $security) {} /** * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") @@ -62,7 +62,7 @@ class WorkflowController extends AbstractController ->setRelatedEntityClass($request->query->get('entityClass')) ->setRelatedEntityId($request->query->getInt('entityId')) ->setWorkflowName($request->query->get('workflow')) - ->addSubscriberToFinal($this->getUser()); + ->addSubscriberToFinal($this->security->getUser()); $errors = $this->validator->validate($entityWorkflow, null, ['creation']); @@ -123,17 +123,17 @@ class WorkflowController extends AbstractController } if (!$this->getUser() instanceof User) { - throw new AccessDeniedException('Not a valid user'); + throw new AccessDeniedHttpException('Not a valid user'); } if ($entityWorkflowStep->getAccessKey() !== $accessKey) { - throw new AccessDeniedException('Access key is invalid'); + throw new AccessDeniedHttpException('Access key is invalid'); } if (!$entityWorkflowStep->isWaitingForTransition()) { $this->addFlash('error', $this->translator->trans('workflow.Steps is not waiting for transition. Maybe someone apply the transition before you ?')); } else { - $entityWorkflowStep->addDestUserByAccessKey($this->getUser()); + $entityWorkflowStep->addDestUserByAccessKey($this->security->getUser()); $this->entityManager->flush(); $this->addFlash('success', $this->translator->trans('workflow.You get access to this step')); } @@ -150,11 +150,11 @@ class WorkflowController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByPreviousTransitionned($this->getUser()); + $total = $this->entityWorkflowRepository->countByPreviousTransitionned($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByPreviousTransitionned( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -180,11 +180,11 @@ class WorkflowController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByPreviousDestWithoutReaction($this->getUser()); + $total = $this->entityWorkflowRepository->countByPreviousDestWithoutReaction($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByPreviousDestWithoutReaction( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -208,11 +208,11 @@ class WorkflowController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByDest($this->getUser()); + $total = $this->entityWorkflowRepository->countByDest($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByCc( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -235,11 +235,11 @@ class WorkflowController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByDest($this->getUser()); + $total = $this->entityWorkflowRepository->countByDest($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByDest( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -262,11 +262,11 @@ class WorkflowController extends AbstractController { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countBySubscriber($this->getUser()); + $total = $this->entityWorkflowRepository->countBySubscriber($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findBySubscriber( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index fe1489337..d0debee73 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -364,6 +364,11 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter return $this->username; } + public function getUserIdentifier(): string + { + return $this->username; + } + /** * @return string */ diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index af4da0bae..870f07cb4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -12,32 +12,41 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; use Chill\ActivityBundle\Entity\Activity; +use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\AccompanyingCourseType; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; +use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Chill\PersonBundle\Security\Authorization\PersonVoter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Serializer\SerializerInterface; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Workflow\Registry; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * Class AccompanyingCourseController. */ -class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController +final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { - public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator) {} + public function __construct( + private readonly ValidatorInterface $validator, + private readonly AccompanyingPeriodWorkRepository $workRepository, + private readonly Registry $registry, + private readonly TranslatorInterface $translator, + private readonly Security $security, + private readonly PersonRepository $personRepository, + ) {} /** * @Route("/{_locale}/parcours/{accompanying_period_id}/close", name="chill_person_accompanying_course_close") @@ -223,26 +232,29 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr */ public function newAction(Request $request): Response { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new AccessDeniedHttpException(); + } + $period = new AccompanyingPeriod(); $em = $this->getDoctrine()->getManager(); - if ($request->query->has('person_id')) { - $personIds = $request->query->get('person_id'); + $personIds = $request->query->all('person_id'); - if (false === \is_array($personIds)) { - throw new BadRequestHttpException('person_id parameter should be an array'); - } + foreach ($personIds as $personId) { + $person = $this->personRepository->find($personId); - foreach ($personIds as $personId) { - $person = $em->getRepository(Person::class)->find($personId); - - if (null !== $person) { - $period->addPerson($person); + if (null !== $person) { + if (!$this->isGranted(PersonVoter::SEE, $person)) { + throw new AccessDeniedHttpException(sprintf('person with id %d cannot be seen', $person->getId())); } + $period->addPerson($person); } } - $userLocation = $this->getUser()->getCurrentLocation(); + $userLocation = $user->getCurrentLocation(); $period->setAdministrativeLocation($userLocation); $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::CREATE, $period); @@ -260,6 +272,12 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr */ public function newHouseholdParcoursAction(Request $request): Response { + $user = $this->getUser(); + + if (!$user instanceof User || !$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + $period = new AccompanyingPeriod(); $em = $this->getDoctrine()->getManager(); @@ -276,8 +294,7 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr } } - $userLocation = $this->getUser()->getCurrentLocation(); - $period->setAdministrativeLocation($userLocation); + $period->setAdministrativeLocation($user->getCurrentLocation()); $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::CREATE, $period); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index 2a9e4e9da..9999257a3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -12,28 +12,40 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Counter; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Security\Core\Security; class AccompanyingCourseWorkApiController extends ApiController { - public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {} + public function __construct( + private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, + private readonly Security $security, + ) {} /** * @Route("/api/1.0/person/accompanying-period/work/my-near-end") */ public function myWorksNearEndDate(Request $request): JsonResponse { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new AccessDeniedHttpException(); + } + $since = (new \DateTimeImmutable('now')) ->sub(new \DateInterval('P'.$request->query->getInt('since', 15).'D')); $until = (new \DateTimeImmutable('now')) ->add(new \DateInterval('P'.$request->query->getInt('since', 15).'D')); $total = $this->accompanyingPeriodWorkRepository - ->countNearEndDateByUser($this->getUser(), $since, $until); + ->countNearEndDateByUser($user, $since, $until); if ($request->query->getBoolean('countOnly', false)) { return $this->json( @@ -46,7 +58,7 @@ class AccompanyingCourseWorkApiController extends ApiController $paginator = $this->getPaginatorFactory()->create($total); $works = $this->accompanyingPeriodWorkRepository - ->findNearEndDateByUser($this->getUser(), $since, $until, $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber()); + ->findNearEndDateByUser($user, $since, $until, $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber()); $collection = new Collection($works, $paginator); diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index 7f895d478..0b7326636 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -14,23 +14,37 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\HouseholdMember; -use Chill\PersonBundle\Entity\Household\Position; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\HouseholdMemberType; use Chill\PersonBundle\Household\MembersEditor; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; +use Chill\PersonBundle\Repository\Household\HouseholdRepository; +use Chill\PersonBundle\Repository\Household\PositionRepository; +use Chill\PersonBundle\Repository\PersonRepository; +use Chill\PersonBundle\Security\Authorization\HouseholdVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Serializer\Exception; use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMemberController extends ApiController { - public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly AccompanyingPeriodRepository $periodRepository) {} + public function __construct( + private readonly UrlGeneratorInterface $generator, + private readonly TranslatorInterface $translator, + private readonly AccompanyingPeriodRepository $periodRepository, + private readonly PersonRepository $personRepository, + private readonly HouseholdRepository $householdRepository, + private readonly Security $security, + private readonly PositionRepository $positionRepository, + ) {} /** * @Route( @@ -83,43 +97,50 @@ class HouseholdMemberController extends ApiController */ public function editor(Request $request) { - $em = $this->getDoctrine()->getManager(); + $ids = $request->query->all('persons'); - if ($request->query->has('persons')) { - $ids = $request->query->get('persons', []); + if ([] !== $ids) { + $persons = []; - if (0 === \count($ids)) { - throw new BadRequestHttpException('parameters persons in query is not an array or empty'); - } + foreach ($ids as $id) { + if (!is_numeric($id)) { + throw new BadRequestHttpException(sprintf('persons with id %s is not numeric', $id)); + } - $persons = $em->getRepository(Person::class) - ->findById($ids); + $person = $this->personRepository->find((int) $id); + + if (null === $person) { + throw new NotFoundHttpException(sprintf('person with id %d not found', $id)); + } - foreach ($persons as $person) { $this->denyAccessUnlessGranted( PersonVoter::SEE, $person, "You are not allowed to see person with id {$person->getId()}" ); + + $persons[] = $person; } } if ($request->query->has('household')) { $householdId = $request->query->get('household', false); - $household = $em->getRepository(Household::class) + $household = $this->householdRepository ->find($householdId); $allowHouseholdCreate = false; $allowHouseholdSearch = false; $allowLeaveWithoutHousehold = false; if (null === $household) { - throw $this->createNotFoundException('household not found'); + throw new NotFoundHttpException('household not found'); + } + + if (!$this->security->isGranted(HouseholdVoter::EDIT, $household)) { + throw new AccessDeniedHttpException('not allowed to edit this household'); } - // TODO ACL on household } - $positions = $this->getDoctrine()->getManager() - ->getRepository(Position::class) + $positions = $this->positionRepository ->findAll(); $data = [ @@ -140,10 +161,8 @@ class HouseholdMemberController extends ApiController ); if (null === $period) { - throw $this->createNotFoundException('period not found'); + throw new NotFoundHttpException('accompanying period not found'); } - - // TODO add acl on accompanying Course } return $this->render('@ChillPerson/Household/members_editor.html.twig', [ diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 3b7188513..7444dce5a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Controller; use Chill\ActivityBundle\Entity\Activity; use Chill\DocStoreBundle\Entity\PersonDocument; use Chill\EventBundle\Entity\Participation; +use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Actions\Remove\PersonMove; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonNotDuplicate; @@ -24,15 +25,21 @@ use Chill\PersonBundle\Repository\PersonNotDuplicateRepository; use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Search\SimilarPersonMatcher; use Chill\TaskBundle\Entity\SingleTask; -use http\Exception\InvalidArgumentException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\Security\Core\Security; use function count; class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { - public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher) {} + public function __construct( + private readonly SimilarPersonMatcher $similarPersonMatcher, + private readonly PersonRepository $personRepository, + private readonly PersonMove $personMove, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly Security $security, + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") @@ -40,7 +47,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll public function confirmAction(mixed $person1_id, mixed $person2_id, Request $request) { if ($person1_id === $person2_id) { - throw new InvalidArgumentException('Can not merge same person'); + throw new \InvalidArgumentException('Can not merge same person'); } $person1 = $this->_getPerson($person1_id); @@ -152,6 +159,12 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll */ public function notDuplicateAction(mixed $person1_id, mixed $person2_id) { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new AccessDeniedHttpException(); + } + [$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id); $this->denyAccessUnlessGranted( @@ -167,7 +180,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll $personNotDuplicate = new PersonNotDuplicate(); $personNotDuplicate->setPerson1($person1); $personNotDuplicate->setPerson2($person2); - $personNotDuplicate->setUser($this->getUser()); + $personNotDuplicate->setUser($user); $this->getDoctrine()->getManager()->persist($personNotDuplicate); $this->getDoctrine()->getManager()->flush(); @@ -259,7 +272,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll private function _getPersonsByPriority($person1_id, $person2_id) { if ($person1_id === $person2_id) { - throw new InvalidArgumentException('Can not merge same person'); + throw new \InvalidArgumentException('Can not merge same person'); } if ($person1_id > $person2_id) { diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php index ab36e3e9b..d2a7aba55 100644 --- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php +++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class PersonAltNameDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, iterable $forms) + public function mapDataToForms($viewData, iterable $forms): void { if (null === $viewData) { return; @@ -43,11 +43,7 @@ class PersonAltNameDataMapper implements DataMapperInterface } } - /** - * @param FormInterface[] $forms - * @param Collection $viewData - */ - public function mapFormsToData(iterable $forms, &$viewData) + public function mapFormsToData(iterable $forms, &$viewData): void { $mapIndexToKey = []; diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php index d29b4cd41..f8086369f 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Form\Type; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\GroupCenter; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\ChoiceLoader\PersonChoiceLoader; @@ -25,7 +26,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Core\Role\Role; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -41,46 +41,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; * - with the `role` option, only the people belonging to the reachable center for the * given role are displayed. */ -class PickPersonType extends AbstractType +final class PickPersonType extends AbstractType { - /** - * @var AuthorizationHelper - */ - protected $authorizationHelper; - - /** - * @var PersonRepository - */ - protected $personRepository; - - /** - * @var TranslatorInterface - */ - protected $translator; - - /** - * @var UrlGeneratorInterface - */ - protected $urlGenerator; - - /** - * @var \Chill\MainBundle\Entity\User - */ - protected $user; - public function __construct( - PersonRepository $personRepository, - TokenStorageInterface $tokenStorage, - AuthorizationHelper $authorizationHelper, - UrlGeneratorInterface $urlGenerator, - TranslatorInterface $translator - ) { - $this->personRepository = $personRepository; - $this->user = $tokenStorage->getToken()->getUser(); - $this->authorizationHelper = $authorizationHelper; - $this->urlGenerator = $urlGenerator; - $this->translator = $translator; - } + private readonly PersonRepository $personRepository, + private readonly TokenStorageInterface $tokenStorage, + private readonly AuthorizationHelper $authorizationHelper, + private readonly UrlGeneratorInterface $urlGenerator, + private readonly TranslatorInterface $translator + ) {} public function buildView(\Symfony\Component\Form\FormView $view, \Symfony\Component\Form\FormInterface $form, array $options) { @@ -130,11 +99,16 @@ class PickPersonType extends AbstractType protected function filterCentersfom(Options $options) { + $user = $this->tokenStorage->getToken()->getUser(); + if (!$user instanceof User) { + throw new \UnexpectedValueException('user should be an instance of '.User::class); + } + if (null === $options['role']) { - $centers = array_map(static fn (GroupCenter $g) => $g->getCenter(), $this->user->getGroupCenters()->toArray()); + $centers = array_map(static fn (GroupCenter $g) => $g->getCenter(), $user->getGroupCenters()->toArray()); } else { $centers = $this->authorizationHelper - ->getReachableCenters($this->user, $options['role']->getRole()); + ->getReachableCenters($user, $options['role']->getRole()); } if (null === $options['centers']) { diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php index 88eb2b172..00ffa47f5 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php @@ -31,31 +31,21 @@ namespace Chill\PersonBundle\Privacy; * along with this program. If not, see . */ +use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\Person; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -class PrivacyEventSubscriber implements EventSubscriberInterface +final readonly class PrivacyEventSubscriber implements EventSubscriberInterface { - /** - * @var LoggerInterface - */ - protected $logger; - - /** - * @var TokenStorageInterface - */ - protected $token; - /** * PrivacyEventSubscriber constructor. */ - public function __construct(LoggerInterface $logger, TokenStorageInterface $token) - { - $this->logger = $logger; - $this->token = $token; - } + public function __construct( + private LoggerInterface $logger, + private TokenStorageInterface $token + ) {} public static function getSubscribedEvents() { @@ -109,11 +99,20 @@ class PrivacyEventSubscriber implements EventSubscriberInterface ); } - protected function getInvolved(): array + private function getInvolved(): array { + $user = $this->token->getToken()->getUser(); + + if ($user instanceof User) { + return [ + 'by_user' => $user->getUserIdentifier(), + 'by_user_id' => $user->getId(), + ]; + } + return [ - 'by_user' => $this->token->getToken()->getUser()->getUsername(), - 'by_user_id' => $this->token->getToken()->getUser()->getId(), + 'by_user' => $user->getUsername(), + 'by_user_id' => $user->getUserIdentifier(), ]; } } diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml index 434d1ea08..9691db298 100644 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml @@ -26,12 +26,6 @@ services: Chill\PersonBundle\Controller\AdminController: ~ Chill\PersonBundle\Controller\PersonDuplicateController: - arguments: - $similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher' - $translator: '@Symfony\Contracts\Translation\TranslatorInterface' - $personRepository: '@Chill\PersonBundle\Repository\PersonRepository' - $personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove' - $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface' tags: ['controller.service_arguments'] Chill\PersonBundle\Controller\AccompanyingCourseController: diff --git a/src/Bundle/ChillReportBundle/Form/ReportType.php b/src/Bundle/ChillReportBundle/Form/ReportType.php index 8d6551443..9d979458a 100644 --- a/src/Bundle/ChillReportBundle/Form/ReportType.php +++ b/src/Bundle/ChillReportBundle/Form/ReportType.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\ReportBundle\Form; use Chill\CustomFieldsBundle\Form\Type\CustomFieldType; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\AppendScopeChoiceTypeTrait; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; @@ -22,41 +23,16 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -class ReportType extends AbstractType +final class ReportType extends AbstractType { use AppendScopeChoiceTypeTrait; - /** - * @var AuthorizationHelper - */ - protected $authorizationHelper; - - /** - * @var \Doctrine\Persistence\ObjectManager - */ - protected $om; - - /** - * @var TranslatableStringHelper - */ - protected $translatableStringHelper; - - /** - * @var \Chill\MainBundle\Entity\User - */ - protected $user; - public function __construct( - AuthorizationHelper $helper, - TokenStorageInterface $tokenStorage, - TranslatableStringHelper $translatableStringHelper, - ObjectManager $om - ) { - $this->authorizationHelper = $helper; - $this->user = $tokenStorage->getToken()->getUser(); - $this->translatableStringHelper = $translatableStringHelper; - $this->om = $om; - } + private readonly AuthorizationHelper $authorizationHelper, + private readonly TokenStorageInterface $tokenStorage, + private readonly TranslatableStringHelper $translatableStringHelper, + private readonly ObjectManager $om + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -74,11 +50,17 @@ class ReportType extends AbstractType 'group' => $options['cFGroup'], ] ); + $user = $this->tokenStorage->getToken()->getUser(); + + if (!$user instanceof User) { + throw new \RuntimeException('user must be a regular user'); + } + $this->appendScopeChoices( $builder, $options['role'], $options['center'], - $this->user, + $user, $this->authorizationHelper, $this->translatableStringHelper, $this->om diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 16c520c75..4c1687b5f 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\TaskBundle\Controller; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; use Chill\MainBundle\Serializer\Model\Collection; @@ -38,8 +39,10 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; final class SingleTaskController extends AbstractController @@ -55,6 +58,7 @@ final class SingleTaskController extends AbstractController private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly SingleTaskStateRepository $singleTaskStateRepository, private readonly SingleTaskRepository $singleTaskRepository, + private readonly Security $security, ) {} /** @@ -487,8 +491,14 @@ final class SingleTaskController extends AbstractController */ public function newAction(Request $request) { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new AccessDeniedHttpException(); + } + $task = (new SingleTask()) - ->setAssignee($this->getUser()) + ->setAssignee($user) ->setType('task_default'); $entityType = $this->getEntityContext($request); diff --git a/src/Bundle/ChillTaskBundle/Controller/TaskController.php b/src/Bundle/ChillTaskBundle/Controller/TaskController.php index e5d060de7..5ffc202de 100644 --- a/src/Bundle/ChillTaskBundle/Controller/TaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/TaskController.php @@ -66,7 +66,7 @@ class TaskController extends AbstractController 'chill_task_single_task_show', [ 'id' => $task->getId(), - 'list_params' => $request->query->get('list_params', []), + 'list_params' => $request->query->all('list_params'), ] ); null === $task->getCourse() ? $defaultTemplate = '@ChillTask/SingleTask/Person/transition.html.twig' : $defaultTemplate = '@ChillTask/SingleTask/AccompanyingCourse/transition.html.twig'; @@ -134,8 +134,6 @@ class TaskController extends AbstractController } /** - * @param \Chill\TaskBundle\Controller\AbstractTask $task - * * @return \Symfony\Component\Form\FormInterface */ protected function createTransitionForm(AbstractTask $task) diff --git a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php index e744ddb24..7f1f8fde8 100644 --- a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php @@ -26,8 +26,7 @@ final readonly class UserMenuBuilder implements LocalMenuBuilderInterface private TokenStorageInterface $tokenStorage, private TranslatorInterface $translator, private AuthorizationCheckerInterface $authorizationChecker - ) { - } + ) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { From de6277494a5ffc853cf58a52e4b7b35bb08ccfaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Dec 2023 23:06:42 +0100 Subject: [PATCH 026/251] update configuration of app for internal testing app --- .env.test | 2 + tests/app/config/packages/framework.yaml | 21 +++++++-- tests/app/config/packages/security.yaml | 46 +++++++++++++++++--- tests/app/config/packages/test/security.yaml | 11 ++--- 4 files changed, 64 insertions(+), 16 deletions(-) diff --git a/.env.test b/.env.test index 9245579c0..f84920e54 100644 --- a/.env.test +++ b/.env.test @@ -4,6 +4,8 @@ KERNEL_CLASS='App\Kernel' APP_SECRET='$ecretf0rt3st' +TRUSTED_HOSTS= + ADMIN_PASSWORD=password LOCALE=fr diff --git a/tests/app/config/packages/framework.yaml b/tests/app/config/packages/framework.yaml index 01c554356..011f5760c 100644 --- a/tests/app/config/packages/framework.yaml +++ b/tests/app/config/packages/framework.yaml @@ -2,13 +2,17 @@ framework: secret: '%env(APP_SECRET)%' - # DIRTY FIX un bug dans symfony4 empêche de récupérer un tableau de variables depuis .env - # cfr. https://github.com/symfony/symfony/issues/28599 + http_client: + default_options: + verify_peer: false + verify_host: false + trusted_hosts: - - '^(localhost|127.0.0.1)$' + - '^(localhost|127.0.0.1|web)$' + - '%env(resolve:TRUSTED_HOSTS)%' #csrf_protection: true - #http_method_override: true + http_method_override: false # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. @@ -16,12 +20,21 @@ framework: handler_id: null cookie_secure: auto cookie_samesite: lax + storage_factory_id: session.storage.factory.native #esi: true #fragments: true php_errors: log: true + #error_controller: App\Controller\ErrorController::show + ## sf4 check: ou à déplacer dans un chill.yaml assets: json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' + +when@test: + framework: + test: true + session: + storage_factory_id: session.storage.factory.mock_file diff --git a/tests/app/config/packages/security.yaml b/tests/app/config/packages/security.yaml index f93eb04c3..b028b50e5 100644 --- a/tests/app/config/packages/security.yaml +++ b/tests/app/config/packages/security.yaml @@ -1,6 +1,14 @@ security: - # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers + access_decision_manager: + strategy: unanimous + allow_if_all_abstain: false + + enable_authenticator_manager: true + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider providers: chain_provider: @@ -9,12 +17,11 @@ security: in_memory: memory: users: - admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'] } + admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH', 'ROLE_USER'] } users: id: chill.main.user_provider encoders: - Chill\MainBundle\Entity\User: algorithm: bcrypt Symfony\Component\Security\Core\User\User: plaintext @@ -25,19 +32,30 @@ security: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false + wopi: + pattern: ^/wopi + provider: chain_provider + stateless: true + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + default: - anonymous: ~ + # remove during upgrade from symfony 4 to symfony 5 TODO check this + #anonymous: ~ provider: chain_provider form_login: csrf_parameter: _csrf_token csrf_token_id: authenticate #csrf_provider: security.csrf.token_manager - logout_on_user_change: true - logout: ~ + # remove during upgrade from symfony 4 to symfony 5 TODO check this + # logout_on_user_change: true + logout: + path: /logout # uncomment to enable impersonate mode in Chill # https://symfony.com/doc/current/security/impersonating_user.html - # switch_user: true + switch_user: true # activate different ways to authenticate # https://symfony.com/doc/current/security.html#firewalls-authentication @@ -47,6 +65,7 @@ security: access_control: - { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/wopi, roles: IS_AUTHENTICATED_FULLY } # access for homepage, the homepage redirect admin to admin section - { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] } - { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] } @@ -56,3 +75,16 @@ security: - { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN } # other pages, only for regular user (no admin) - { path: ^/, roles: ROLE_USER } + +when@test: + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # are not important, waste resources and increase test times. The following + # reduces the work factor to the lowest possible values. + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/tests/app/config/packages/test/security.yaml b/tests/app/config/packages/test/security.yaml index 4ff914485..5aaa34ce0 100644 --- a/tests/app/config/packages/test/security.yaml +++ b/tests/app/config/packages/test/security.yaml @@ -1,8 +1,9 @@ --- # config/packages/test/security.yaml security: - firewalls: - default: - http_basic: ~ - role_hierarchy: - CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1] + firewalls: + default: + entry_point: http_basic + http_basic: ~ + role_hierarchy: + CHILL_MASTER_ROLE: [ CHILL_INHERITED_ROLE_1 ] From b4063bf1df5a320095cf046094d430909bf7622e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 13 Dec 2023 15:27:27 +0100 Subject: [PATCH 027/251] Update path for Symfony container XML in rector.php The path for Symfony container XML in the rector configuration file has been updated. This adjustment specifically refers to the internal testing application. By updating this path, consistency and efficiency within the testing process will be promoted. --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index 72a7cb9f5..a40000b1e 100644 --- a/rector.php +++ b/rector.php @@ -19,7 +19,7 @@ return static function (RectorConfig $rectorConfig): void { __DIR__ . '/src', ]); - $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/testsApp_KernelDevDebugContainer.xml'); + $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/test/App_KernelTestDebugContainer.xml '); $rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php'); //$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class); From 8c2dc490d04f1639be5af0c00bd5732021071a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 13 Dec 2023 15:47:38 +0100 Subject: [PATCH 028/251] re-configure test app with new scripts (wip) --- .env | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/Kernel.php | 38 +++----------------- tests/console | 39 ++++---------------- 3 files changed, 105 insertions(+), 66 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 000000000..1714966d4 --- /dev/null +++ b/.env @@ -0,0 +1,94 @@ +# * .env contains default values for the environment variables needed by the app +# * .env.local uncommitted file with local overrides +# * .env.$APP_ENV committed environment-specific defaults +# * .env.$APP_ENV.local uncommitted environment-specific overrides +# +# Real environment variables win over .env files. +# +# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. +# https://symfony.com/doc/current/configuration/secrets.html +# +# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). +# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration + +## Locale +LOCALE=fr + +###> symfony/framework-bundle ### +# this should be set in docker-compose.yml file +APP_ENV=prod +APP_SECRET=ChangeItf2b58287ef7f9976409d3f6c72529e99ChangeIt +TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 +TRUSTED_HOSTS='^(localhost|example\.com|nginx)$' +###< symfony/framework-bundle ### + +## Wopi server for editing documents online +WOPI_SERVER=http://collabora:9980 + +# must be manually set in .env.local +# ADMIN_PASSWORD= + +###> symfony/mailer ### +# MAILER_DSN=null://null +###< symfony/mailer ### + +## Notifications +NOTIFICATION_HOST=localhost:8001 +NOTIFICATION_FROM_EMAIL=admin@chill.social +NOTIFICATION_FROM_NAME="Chill " + +## Pgadmin credential +PGADMIN_DEFAULT_EMAIL= +PGADMIN_DEFAULT_PASSWORD= + +## OVH OpenStack Storage Container +ASYNC_UPLOAD_TEMP_URL_KEY= +ASYNC_UPLOAD_TEMP_URL_BASE_PATH= +ASYNC_UPLOAD_TEMP_URL_CONTAINER= + +## Redis Cache +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT} + +## Twilio +TWILIO_SID=~ +TWILIO_SECRET=~ +DEFAULT_CARRIER_CODE=BE + +ADD_ADDRESS_DEFAULT_COUNTRY=BE + +ADD_ADDRESS_MAP_CENTER_X=50.8443 +ADD_ADDRESS_MAP_CENTER_Y=4.3523 +ADD_ADDRESS_MAP_CENTER_Z=15 + +SHORT_MESSAGE_DSN=null://null + +## DOCKER IMAGES REGISTRY +#IMAGE_PHP= +#IMAGE_NGINX= + +## DOCKER IMAGES TAG +#VERSION=test +#VERSION=prod + +###> symfony/messenger ### +# Choose one of the transports below +# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages +# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages +MESSENGER_TRANSPORT_DSN=sync:// +MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 +###< symfony/messenger ### + +###> doctrine/doctrine-bundle ### +# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +# +DATABASE_URL="postgresql://postgres:postgres@db:5432/postgres?serverVersion=14&charset=utf8" +###< doctrine/doctrine-bundle ### + +###> lexik/jwt-authentication-bundle ### +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=2a30f6ba26521a2613821da35f28386e +###< lexik/jwt-authentication-bundle ### diff --git a/tests/Kernel.php b/tests/Kernel.php index a0ede51ac..fab37c6dd 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -22,43 +22,13 @@ class Kernel extends BaseKernel { use MicroKernelTrait; - private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; - - public function registerBundles(): iterable + private function getBundlesPath(): string { - $contents = require __DIR__ . '/app/config/bundles.php'; - - foreach ($contents as $class => $envs) { - if ($envs[$this->environment] ?? $envs['all'] ?? false) { - yield new $class(); - } - } + return $this->getConfigDir().'/bundles.php'; } - public function getProjectDir() + private function getConfigDir(): string { - return \dirname(__DIR__); - } - - protected function configureRoutes(RouteCollectionBuilder $routes) - { - $confDir = $this->getProjectDir().'/tests/app/config'; - - $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); - } - - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) - { - $container->addResource(new FileResource($this->getProjectDir().'/tests/app/config/bundles.php')); - $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); - $container->setParameter('container.dumper.inline_factories', true); - $confDir = $this->getProjectDir().'/tests/app/config'; - - $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); + return $this->getProjectDir().'/tests/app/config'; } } diff --git a/tests/console b/tests/console index 264e064a1..c933dc535 100755 --- a/tests/console +++ b/tests/console @@ -3,40 +3,15 @@ use App\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\ErrorHandler\Debug; -if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { - echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; +if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); } -set_time_limit(0); +require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; -require dirname(__DIR__).'/vendor/autoload.php'; +return function (array $context) { + $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); -if (!class_exists(Application::class)) { - throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.'); -} - -$input = new ArgvInput(); -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/tests/app/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); + return new Application($kernel); +}; From 9c17261175cb746701c5106ddd1e9032e7961efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 13 Dec 2023 15:54:33 +0100 Subject: [PATCH 029/251] update phpunit configuration file --- phpunit.xml.dist | 116 +++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 64 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aa519e376..cb9d70a8a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,85 +1,73 @@ - - - - - - - - - - - - - - src/Bundle/ChillAsideActivityBundle/src/Tests/ - - - src/Bundle/ChillBudgetBundle/Tests/ - - - src/Bundle/ChillCalendarBundle/Tests/ - - - - src/Bundle/ChillDocGeneratorBundle/tests/ - - - src/Bundle/ChillDocStoreBundle/Tests/ - - + + src/Bundle/ChillDocGeneratorBundle/tests/ + + + src/Bundle/ChillDocStoreBundle/Tests/ + + - - src/Bundle/ChillMainBundle/Tests/ - - - src/Bundle/ChillPersonBundle/Tests/ - - src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php - - + src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php + + - - - src/Bundle/ChillThirdPartyBundle/Tests - - - src/Bundle/ChillWopiBundle/tests/ - - - - - - - - - + + Wed, 13 Sep 2023 14:15:00 +0200 + + HTTP/1.1 200 OK + + + + XML, + "test getting the last modified date" + ]; + + yield [ + <<<'XML' + + + + + XML, + 207, + <<<'XML' + + + + /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + + + + + Wed, 13 Sep 2023 14:15:00 +0200 + + 5 + + "ab56b4d92b40713acc5af89985d4b786" + + + application/vnd.oasis.opendocument.text + + HTTP/1.1 200 OK + + + + XML, + "test finding all properties" + ]; + } + + public static function generateDataPropfindDirectory(): iterable + { + yield [ + <<<'XML' + + + XML, + 207, + <<<'XML' + + + + /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/ + + + + httpd/unix-directory + + + HTTP/1.1 200 OK + + + + + + HTTP/1.1 404 Not Found + + + + XML, + "test resourceType and IsReadOnly " + ]; + + yield [ + <<<'XML' + + + XML, + 207, + <<<'XML' + + + + /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/ + + + + + HTTP/1.1 404 Not Found + + + + XML, + "test creatableContentsInfo" + ]; + } + +} + +class MockedStoredObjectManager implements StoredObjectManagerInterface +{ + public function getLastModified(StoredObject $document): DateTimeInterface + { + return new \DateTimeImmutable('2023-09-13T14:15'); + } + + public function getContentLength(StoredObject $document): int + { + return 5; + } + + public function read(StoredObject $document): string + { + return 'abcde'; + } + + public function write(StoredObject $document, string $clearContent): void {} + + public function etag(StoredObject $document): string + { + return 'ab56b4d92b40713acc5af89985d4b786'; + } + +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php new file mode 100644 index 000000000..3cc2f19fe --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php @@ -0,0 +1,134 @@ +loadXML($xml); + $actual = $analyzer->getRequestedProperties($request); + + foreach ($expected as $key => $value) { + if ($key === 'unknowns') { + continue; + } + + self::assertArrayHasKey($key, $actual, "Check that key {$key} does exists in list of expected values"); + self::assertEquals($value, $actual[$key], "Does the value match expected for key {$key}"); + } + + if (array_key_exists('unknowns', $expected)) { + self::assertEquals(count($expected['unknowns']), count($actual['unknowns'])); + self::assertEqualsCanonicalizing($expected['unknowns'], $actual['unknowns']); + } + } + + public function provideRequestedProperties(): iterable + { + yield [ + <<<'XML' + + + + + + + XML, + [ + "resourceType" => false, + "contentType" => false, + "lastModified" => false, + "creationDate" => false, + "contentLength" => false, + "etag" => false, + "supportedLock" => false, + 'unknowns' => [ + ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'BaseURI'] + ] + ] + ]; + + yield [ + <<<'XML' + + + + + XML, + [ + "resourceType" => true, + "contentType" => true, + "lastModified" => true, + "creationDate" => true, + "contentLength" => true, + "etag" => true, + "supportedLock" => true, + "unknowns" => [], + ] + ]; + + yield [ + <<<'XML' + + + + + + + XML, + [ + "resourceType" => false, + "contentType" => false, + "lastModified" => true, + "creationDate" => false, + "contentLength" => false, + "etag" => false, + "supportedLock" => false, + 'unknowns' => [] + ] + ]; + + yield [ + <<<'XML' + + + XML, + [ + "resourceType" => true, + "contentType" => true, + "lastModified" => false, + "creationDate" => false, + "contentLength" => false, + "etag" => false, + "supportedLock" => false, + 'unknowns' => [ + ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'IsReadOnly'] + ] + ] + ]; + } +} diff --git a/utils/http/docstore/dav.http b/utils/http/docstore/dav.http new file mode 100644 index 000000000..c566358cd --- /dev/null +++ b/utils/http/docstore/dav.http @@ -0,0 +1,16 @@ + +### Get a document +GET http://{{ host }}/dav/get/{{ uuid }}/d + +### OPTIONS on a document +OPTIONS http://{{ host }}/dav/get/{{ uuid }}/d + +### HEAD ona document +HEAD http://{{ host }}/dav/get/{{ uuid }}/d + +### Get the directory of a document +GET http://{{ host }}/dav/get/{{ uuid }}/ + +### Option the directory of a document +OPTIONS http://{{ host }}/dav/get/{{ uuid }}/ + diff --git a/utils/http/docstore/http-client.env.json b/utils/http/docstore/http-client.env.json new file mode 100644 index 000000000..0b78e77ed --- /dev/null +++ b/utils/http/docstore/http-client.env.json @@ -0,0 +1,6 @@ +{ + "dev": { + "host": "localhost:8001", + "uuid": "0bf3b8e7-b25b-4227-aae9-a3263af0766f" + } +} From ff05f9f48aca9e760be3ef9ac92e5a7403576923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 14 Sep 2023 21:54:30 +0200 Subject: [PATCH 046/251] Dav: implements JWT extraction from the URL, and add the access_token in dav urls --- .../Controller/WebdavController.php | 52 ++++++++++-------- .../views/Webdav/directory.html.twig | 2 +- .../views/Webdav/directory_propfind.xml.twig | 4 +- .../Resources/views/Webdav/doc_props.xml.twig | 2 +- .../views/Webdav/open_in_browser.html.twig | 4 +- .../Security/Guard/DavOnUrlTokenExtractor.php | 49 +++++++++++++++++ .../Guard/JWTOnDavUrlAuthenticator.php | 38 +++++++++++++ .../Tests/Controller/WebdavControllerTest.php | 22 ++++---- .../Guard/DavOnUrlTokenExtractorTest.php | 54 +++++++++++++++++++ .../ChillDocStoreBundle/config/services.yaml | 5 ++ 10 files changed, 193 insertions(+), 39 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index 30a7e4eb2..dbd4e11ec 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -15,6 +15,7 @@ use Chill\DocStoreBundle\Dav\Request\PropfindRequestAnalyzer; use Chill\DocStoreBundle\Dav\Response\DavResponse; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; +use DateTimeInterface; use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -30,41 +31,44 @@ final readonly class WebdavController public function __construct( private \Twig\Environment $engine, private StoredObjectManagerInterface $storedObjectManager, + private Security $security, + private ?JWTTokenManagerInterface $JWTTokenManager = null, ) { $this->requestAnalyzer = new PropfindRequestAnalyzer(); } /** - * @Route("/dav/open/{uuid}") + * @Route("/chdoc/open/{uuid}") */ public function open(StoredObject $storedObject): Response { - /*$accessToken = $this->JWTTokenManager->createFromPayload($this->security->getUser(), [ + $accessToken = $this->JWTTokenManager?->createFromPayload($this->security->getUser(), [ 'UserCanWrite' => true, 'UserCanAttend' => true, 'UserCanPresent' => true, 'fileId' => $storedObject->getUuid(), - ]);*/ + ]); return new DavResponse($this->engine->render('@ChillDocStore/Webdav/open_in_browser.html.twig', [ - 'stored_object' => $storedObject, 'access_token' => '', + 'stored_object' => $storedObject, 'access_token' => $accessToken, ])); } /** - * @Route("/dav/get/{uuid}/", methods={"GET", "HEAD"}, name="chill_docstore_dav_directory_get") + * @Route("/dav/{access_token}/get/{uuid}/", methods={"GET", "HEAD"}, name="chill_docstore_dav_directory_get") */ - public function getDirectory(StoredObject $storedObject): Response + public function getDirectory(StoredObject $storedObject, string $access_token): Response { return new DavResponse( $this->engine->render('@ChillDocStore/Webdav/directory.html.twig', [ - 'stored_object' => $storedObject + 'stored_object' => $storedObject, + 'access_token' => $access_token, ]) ); } /** - * @Route("/dav/get/{uuid}/", methods={"OPTIONS"}) + * @Route("/dav/{access_token}/get/{uuid}/", methods={"OPTIONS"}) */ public function optionsDirectory(StoredObject $storedObject): Response { @@ -78,9 +82,9 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/", methods={"PROPFIND"}) + * @Route("/dav/{access_token}/get/{uuid}/", methods={"PROPFIND"}) */ - public function propfindDirectory(StoredObject $storedObject, Request $request): Response + public function propfindDirectory(StoredObject $storedObject, string $access_token, Request $request): Response { $depth = $request->headers->get('depth'); @@ -111,10 +115,11 @@ final readonly class WebdavController $this->engine->render('@ChillDocStore/Webdav/directory_propfind.xml.twig', [ 'stored_object' => $storedObject, 'properties' => $properties, - 'last_modified' => $lastModified ?? null, - 'etag' => $etag ?? null, - 'content_length' => $length ?? null, - 'depth' => (int) $depth + 'last_modified' => $lastModified , + 'etag' => $etag, + 'content_length' => $length, + 'depth' => (int) $depth, + 'access_token' => $access_token, ]), 207 ); @@ -127,7 +132,7 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/d", name="chill_docstore_dav_document_get", methods={"GET"}) + * @Route("/dav/{access_token}/get/{uuid}/d", name="chill_docstore_dav_document_get", methods={"GET"}) */ public function getDocument(StoredObject $storedObject): Response { @@ -136,7 +141,7 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/d", methods={"HEAD"}) + * @Route("/dav/{access_token}/get/{uuid}/d", methods={"HEAD"}) */ public function headDocument(StoredObject $storedObject): Response { @@ -154,7 +159,7 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/d", methods={"OPTIONS"}) + * @Route("/dav/{access_token}/get/{uuid}/d", methods={"OPTIONS"}) */ public function optionsDocument(StoredObject $storedObject): Response { @@ -176,9 +181,9 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/d", methods={"PROPFIND"}) + * @Route("/dav/{access_token}/get/{uuid}/d", methods={"PROPFIND"}) */ - public function propfindDocument(StoredObject $storedObject, Request $request): Response + public function propfindDocument(StoredObject $storedObject, string $access_token, Request $request): Response { $content = $request->getContent(); $xml = new \DOMDocument(); @@ -204,9 +209,10 @@ final readonly class WebdavController [ 'stored_object' => $storedObject, 'properties' => $properties, - 'etag' => $etag ?? null, - 'last_modified' => $lastModified ?? null, - 'content_length' => $length ?? null, + 'etag' => $etag, + 'last_modified' => $lastModified, + 'content_length' => $length, + 'access_token' => $access_token, ] ), 207 @@ -221,7 +227,7 @@ final readonly class WebdavController } /** - * @Route("/dav/get/{uuid}/d", methods={"PUT"}) + * @Route("/dav/{access_token}/get/{uuid}/d", methods={"PUT"}) */ public function putDocument(StoredObject $storedObject, Request $request): Response { diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory.html.twig index 5a95e894a..90e19dd13 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory.html.twig @@ -6,7 +6,7 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory_propfind.xml.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory_propfind.xml.twig index 6edbb76e0..23a8da064 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory_propfind.xml.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/directory_propfind.xml.twig @@ -1,7 +1,7 @@ - {{ path('chill_docstore_dav_directory_get', { 'uuid': stored_object.uuid } ) }} + {{ path('chill_docstore_dav_directory_get', { 'uuid': stored_object.uuid, 'access_token': access_token } ) }} {% if properties.resourceType or properties.contentType %} @@ -28,7 +28,7 @@ {% if depth == 1 %} - {{ path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid}) }} + {{ path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid, 'access_token':access_token}) }} {% if properties.lastModified or properties.contentLength or properties.resourceType or properties.etag or properties.contentType or properties.creationDate %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/doc_props.xml.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/doc_props.xml.twig index 3d320295b..7cde5a5de 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/doc_props.xml.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/doc_props.xml.twig @@ -1,7 +1,7 @@ - {{ path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid}) }} + {{ path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid, 'access_token': access_token}) }} {% if properties.lastModified or properties.contentLength or properties.resourceType or properties.etag or properties.contentType or properties.creationDate %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/open_in_browser.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/open_in_browser.html.twig index 37d137047..2a32681e7 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/open_in_browser.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Webdav/open_in_browser.html.twig @@ -2,6 +2,6 @@ {% block content %}

document uuid: {{ stored_object.uuid }}

-

{{ absolute_url(path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid })) }}

-Open document +

{{ absolute_url(path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid, 'access_token': access_token })) }}

+Open document {% endblock %} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php new file mode 100644 index 000000000..eb030f799 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php @@ -0,0 +1,49 @@ +getRequestUri(); + + $segments = array_values( + array_filter( + explode('/', $uri), + fn ($item) => '' !== trim($item) + ) + ); + + if (2 > count($segments)) { + $this->logger->info("not enough segment for parsing URL"); + + return false; + } + + if ('dav' !== $segments[0]) { + $this->logger->info("the first segment of the url must be DAV"); + + return false; + } + + return $segments[1]; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php new file mode 100644 index 000000000..b4ae04afc --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php @@ -0,0 +1,38 @@ +davOnUrlTokenExtractor; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php index 959e9ed71..9064d8419 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php @@ -21,6 +21,7 @@ use Prophecy\PhpUnit\ProphecyTrait; use Ramsey\Uuid\Uuid; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Templating\EngineInterface; /** @@ -43,8 +44,9 @@ class WebdavControllerTest extends KernelTestCase private function buildController(): WebdavController { $storedObjectManager = new MockedStoredObjectManager(); + $security = $this->prophesize(Security::class); - return new WebdavController($this->engine, $storedObjectManager); + return new WebdavController($this->engine, $storedObjectManager, $security->reveal()); } private function buildDocument(): StoredObject @@ -115,7 +117,7 @@ class WebdavControllerTest extends KernelTestCase $request = new Request([], [], [], [], [], [], $requestContent); $request->setMethod('PROPFIND'); - $response = $controller->propfindDocument($this->buildDocument(), $request); + $response = $controller->propfindDocument($this->buildDocument(), '1234', $request); self::assertEquals($expectedStatusCode, $response->getStatusCode()); self::assertContains('content-type', $response->headers->keys()); @@ -134,7 +136,7 @@ class WebdavControllerTest extends KernelTestCase $request = new Request([], [], [], [], [], [], $requestContent); $request->setMethod('PROPFIND'); $request->headers->add(["Depth" => "0"]); - $response = $controller->propfindDirectory($this->buildDocument(), $request); + $response = $controller->propfindDirectory($this->buildDocument(), '1234', $request); self::assertEquals($expectedStatusCode, $response->getStatusCode()); self::assertContains('content-type', $response->headers->keys()); @@ -170,7 +172,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/d @@ -205,7 +207,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/d @@ -232,7 +234,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/d @@ -259,7 +261,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/d @@ -285,7 +287,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/d + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/d @@ -323,7 +325,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/ + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/ @@ -365,7 +367,7 @@ class WebdavControllerTest extends KernelTestCase - /dav/get/716e6688-4579-4938-acf3-c4ab5856803b/ + /dav/1234/get/716e6688-4579-4938-acf3-c4ab5856803b/ diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php new file mode 100644 index 000000000..b9e046b28 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php @@ -0,0 +1,54 @@ +prophesize(Request::class); + $request->getRequestUri()->willReturn($uri); + + $extractor = new DavOnUrlTokenExtractor(new NullLogger()); + + $actual = $extractor->extract($request->reveal()); + + self::assertEquals($expected, $actual); + } + + /** + * @phpstan-pure + */ + public static function provideDataUri(): iterable + { + yield ['/dav/123456789/get/d07d2230-5326-11ee-8fd4-93696acf5ea1/d', '123456789']; + yield ['/dav/123456789', '123456789']; + yield ['/not-dav/123456978', false]; + yield ['/dav', false]; + yield ['/', false]; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 04fc3ace3..390abbf25 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -34,6 +34,11 @@ services: autoconfigure: true autowire: true + Chill\DocStoreBundle\Security\: + resource: './../Security' + autoconfigure: true + autowire: true + Chill\DocStoreBundle\Serializer\Normalizer\: autowire: true resource: '../Serializer/Normalizer/' From a35f7656cb5b841b98bd460004fa417136153848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 15 Sep 2023 14:16:58 +0200 Subject: [PATCH 047/251] Dav: refactor WebdavController --- .../Controller/WebdavController.php | 67 +++++++++---------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index dbd4e11ec..8ef4ee71a 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -92,24 +92,7 @@ final readonly class WebdavController throw new BadRequestHttpException("only 1 and 0 are accepted for Depth header"); } - $content = $request->getContent(); - $xml = new \DOMDocument(); - $xml->loadXML($content); - - $properties = $this->requestAnalyzer->getRequestedProperties($xml); - $requested = array_keys(array_filter($properties, fn ($item) => true === $item)); - - if ( - in_array('lastModified', $requested, true) - || in_array('etag', $requested, true) - ) { - $lastModified = $this->storedObjectManager->getLastModified($storedObject); - $etag = $this->storedObjectManager->etag($storedObject); - - } - if (in_array('contentLength', $requested, true)) { - $length = $this->storedObjectManager->getContentLength($storedObject); - } + [$properties, $lastModified, $etag, $length] = $this->parseDavRequest($request->getContent(), $storedObject); $response = new DavResponse( $this->engine->render('@ChillDocStore/Webdav/directory_propfind.xml.twig', [ @@ -185,23 +168,7 @@ final readonly class WebdavController */ public function propfindDocument(StoredObject $storedObject, string $access_token, Request $request): Response { - $content = $request->getContent(); - $xml = new \DOMDocument(); - $xml->loadXML($content); - - $properties = $this->requestAnalyzer->getRequestedProperties($xml); - $requested = array_keys(array_filter($properties, fn ($item) => true === $item)); - - if ( - in_array('lastModified', $requested, true) - || in_array('etag', $requested, true) - ) { - $lastModified = $this->storedObjectManager->getLastModified($storedObject); - $etag = $this->storedObjectManager->etag($storedObject); - } - if (in_array('contentLength', $requested, true)) { - $length = $this->storedObjectManager->getContentLength($storedObject); - } + [$properties, $lastModified, $etag, $length] = $this->parseDavRequest($request->getContent(), $storedObject); $response = new DavResponse( $this->engine->render( @@ -235,4 +202,34 @@ final readonly class WebdavController return (new DavResponse("", Response::HTTP_NO_CONTENT)); } + + /** + * @return array{0: array, 1: DateTimeInterface, 2: string, 3: int} properties, lastModified, etag, length + */ + private function parseDavRequest(string $content, StoredObject $storedObject): array + { + $xml = new \DOMDocument(); + $xml->loadXML($content); + + $properties = $this->requestAnalyzer->getRequestedProperties($xml); + $requested = array_keys(array_filter($properties, fn ($item) => true === $item)); + + if ( + in_array('lastModified', $requested, true) + || in_array('etag', $requested, true) + ) { + $lastModified = $this->storedObjectManager->getLastModified($storedObject); + $etag = $this->storedObjectManager->etag($storedObject); + } + if (in_array('contentLength', $requested, true)) { + $length = $this->storedObjectManager->getContentLength($storedObject); + } + + return [ + $properties, + $lastModified ?? null, + $etag ?? null, + $length ?? null + ]; + } } From 18fd1dbc4a6efd8856a78e17ecaa9bb2f4ff8c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 15 Sep 2023 22:21:56 +0200 Subject: [PATCH 048/251] Dav: Introduce access control inside de dav controller --- ...TokenAuthenticationEventSubscriberTest.php | 65 +++++++++ .../Controller/WebdavController.php | 61 ++++++--- .../Authorization/StoredObjectRoleEnum.php | 19 +++ .../Authorization/StoredObjectVoter.php | 52 ++++++++ .../DavTokenAuthenticationEventSubscriber.php | 50 +++++++ .../Security/Guard/JWTDavTokenProvider.php | 41 ++++++ .../Guard/JWTDavTokenProviderInterface.php | 23 ++++ .../Tests/Controller/WebdavControllerTest.php | 6 +- .../Authorization/StoredObjectVoterTest.php | 124 ++++++++++++++++++ 9 files changed, 419 insertions(+), 22 deletions(-) create mode 100644 src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php create mode 100644 src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php create mode 100644 src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php diff --git a/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php b/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php new file mode 100644 index 000000000..03cea7d29 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php @@ -0,0 +1,65 @@ + 1, + 'so' => '1234', + 'e' => 1, + ], $token); + + $eventSubscriber->onJWTAuthenticated($event); + + self::assertTrue($token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)); + self::assertTrue($token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)); + self::assertEquals('1234', $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)); + self::assertEquals(StoredObjectRoleEnum::EDIT, $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)); + } + + public function testOnJWTAuthenticatedWithDavNoDataInPayload(): void + { + $eventSubscriber = new DavTokenAuthenticationEventSubscriber(); + $token = new class () extends AbstractToken { + public function getCredentials() + { + return null; + } + }; + $event = new JWTAuthenticatedEvent([], $token); + + $eventSubscriber->onJWTAuthenticated($event); + + self::assertFalse($token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)); + self::assertFalse($token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)); + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index 8ef4ee71a..471aec99f 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -14,15 +14,16 @@ namespace Chill\DocStoreBundle\Controller; use Chill\DocStoreBundle\Dav\Request\PropfindRequestAnalyzer; use Chill\DocStoreBundle\Dav\Response\DavResponse; use Chill\DocStoreBundle\Entity\StoredObject; +use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; +use Chill\DocStoreBundle\Security\Guard\JWTDavTokenProviderInterface; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; use DateTimeInterface; -use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; -use Symfony\Component\Templating\EngineInterface; final readonly class WebdavController { @@ -31,8 +32,8 @@ final readonly class WebdavController public function __construct( private \Twig\Environment $engine, private StoredObjectManagerInterface $storedObjectManager, - private Security $security, - private ?JWTTokenManagerInterface $JWTTokenManager = null, + private Security $security, + private ?JWTDavTokenProviderInterface $davTokenProvider = null, ) { $this->requestAnalyzer = new PropfindRequestAnalyzer(); } @@ -42,12 +43,7 @@ final readonly class WebdavController */ public function open(StoredObject $storedObject): Response { - $accessToken = $this->JWTTokenManager?->createFromPayload($this->security->getUser(), [ - 'UserCanWrite' => true, - 'UserCanAttend' => true, - 'UserCanPresent' => true, - 'fileId' => $storedObject->getUuid(), - ]); + $accessToken = $this->davTokenProvider?->createToken($storedObject, StoredObjectRoleEnum::EDIT); return new DavResponse($this->engine->render('@ChillDocStore/Webdav/open_in_browser.html.twig', [ 'stored_object' => $storedObject, 'access_token' => $accessToken, @@ -59,6 +55,10 @@ final readonly class WebdavController */ public function getDirectory(StoredObject $storedObject, string $access_token): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + return new DavResponse( $this->engine->render('@ChillDocStore/Webdav/directory.html.twig', [ 'stored_object' => $storedObject, @@ -72,11 +72,16 @@ final readonly class WebdavController */ public function optionsDirectory(StoredObject $storedObject): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + $response = (new DavResponse("")) ->setEtag($this->storedObjectManager->etag($storedObject)) ; - $response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT,PATCH,POST,TRACE']); + //$response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT,PATCH,POST,TRACE']); + $response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT']); return $response; } @@ -86,6 +91,10 @@ final readonly class WebdavController */ public function propfindDirectory(StoredObject $storedObject, string $access_token, Request $request): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + $depth = $request->headers->get('depth'); if ("0" !== $depth && "1" !== $depth) { @@ -119,6 +128,10 @@ final readonly class WebdavController */ public function getDocument(StoredObject $storedObject): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + return (new DavResponse($this->storedObjectManager->read($storedObject))) ->setEtag($this->storedObjectManager->etag($storedObject)); } @@ -128,6 +141,10 @@ final readonly class WebdavController */ public function headDocument(StoredObject $storedObject): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + $response = new DavResponse(""); $response->headers->add( @@ -146,19 +163,15 @@ final readonly class WebdavController */ public function optionsDocument(StoredObject $storedObject): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + $response = (new DavResponse("")) ->setEtag($this->storedObjectManager->etag($storedObject)) ; - $response->headers->add(['Allow' => /*sprintf( - '%s, %s, %s, %s, %s', - Request::METHOD_OPTIONS, - Request::METHOD_GET, - Request::METHOD_HEAD, - Request::METHOD_PUT, - 'PROPFIND' - ) */ 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT,PATCH,POST,TRACE' - ]); + $response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT']); return $response; } @@ -168,6 +181,10 @@ final readonly class WebdavController */ public function propfindDocument(StoredObject $storedObject, string $access_token, Request $request): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + [$properties, $lastModified, $etag, $length] = $this->parseDavRequest($request->getContent(), $storedObject); $response = new DavResponse( @@ -198,6 +215,10 @@ final readonly class WebdavController */ public function putDocument(StoredObject $storedObject, Request $request): Response { + if (!$this->security->isGranted(StoredObjectRoleEnum::EDIT->value, $storedObject)) { + throw new AccessDeniedHttpException(); + } + $this->storedObjectManager->write($storedObject, $request->getContent()); return (new DavResponse("", Response::HTTP_NO_CONTENT)); diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php new file mode 100644 index 000000000..6a5a22da0 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php @@ -0,0 +1,19 @@ +hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) + || + $subject->getUuid()->toString() !== $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) + ) { + return false; + } + + if (!$token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)) { + return false; + } + + $askedRole = StoredObjectRoleEnum::from($attribute); + $tokenRoleAuthorization = + $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS); + + return match ($askedRole) { + StoredObjectRoleEnum::SEE => + $tokenRoleAuthorization === StoredObjectRoleEnum::EDIT || $tokenRoleAuthorization === StoredObjectRoleEnum::SEE, + StoredObjectRoleEnum::EDIT => $tokenRoleAuthorization === StoredObjectRoleEnum::EDIT + }; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php new file mode 100644 index 000000000..3c1b3e2a9 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php @@ -0,0 +1,50 @@ + ['onJWTAuthenticated', 0], + ]; + } + + public function onJWTAuthenticated(JWTAuthenticatedEvent $event): void + { + $payload = $event->getPayload(); + + if (!(array_key_exists('dav', $payload) && 1 === $payload['dav'])) { + return; + } + + $token = $event->getToken(); + $token->setAttribute(self::ACTIONS, match ($payload['e']) { + 0 => StoredObjectRoleEnum::SEE, + 1 => StoredObjectRoleEnum::EDIT, + default => throw new \UnexpectedValueException("unsupported value for e parameter") + }); + + $token->setAttribute(self::STORED_OBJECT, $payload['so']); + } + + +} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php new file mode 100644 index 000000000..30b25dd0b --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php @@ -0,0 +1,41 @@ +JWTTokenManager->createFromPayload($this->security->getUser(), [ + 'dav' => 1, + 'e' => match ($roleEnum) { + StoredObjectRoleEnum::SEE => 0, + StoredObjectRoleEnum::EDIT => 1, + }, + 'so' => $storedObject->getUuid(), + ]); + } + +} diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php new file mode 100644 index 000000000..6be91a39c --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php @@ -0,0 +1,23 @@ +prophesize(Security::class); + $security->isGranted(Argument::in(['EDIT', 'SEE']), Argument::type(StoredObject::class)) + ->willReturn(true); return new WebdavController($this->engine, $storedObjectManager, $security->reveal()); } @@ -83,7 +85,7 @@ class WebdavControllerTest extends KernelTestCase self::assertEquals(200, $response->getStatusCode()); self::assertContains('allow', $response->headers->keys()); - foreach (explode(',', 'OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT') as $method) { + foreach (explode(',', 'OPTIONS,GET,HEAD,PROPFIND') as $method) { self::assertStringContainsString($method, $response->headers->get('allow')); } @@ -100,7 +102,7 @@ class WebdavControllerTest extends KernelTestCase self::assertEquals(200, $response->getStatusCode()); self::assertContains('allow', $response->headers->keys()); - foreach (explode(',', 'OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT') as $method) { + foreach (explode(',', 'OPTIONS,GET,HEAD,PROPFIND') as $method) { self::assertStringContainsString($method, $response->headers->get('allow')); } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php new file mode 100644 index 000000000..c4518586f --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php @@ -0,0 +1,124 @@ +vote($token, $subject, [$attribute])); + } + + public function provideDataVote(): iterable + { + yield [ + $this->buildToken(StoredObjectRoleEnum::EDIT, new StoredObject()), + new \stdClass(), + 'SOMETHING', + VoterInterface::ACCESS_ABSTAIN + ]; + + yield [ + $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), + $so, + 'SOMETHING', + VoterInterface::ACCESS_ABSTAIN + ]; + + yield [ + $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), + $so, + StoredObjectRoleEnum::SEE->value, + VoterInterface::ACCESS_GRANTED + ]; + + yield [ + $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), + $so, + StoredObjectRoleEnum::EDIT->value, + VoterInterface::ACCESS_GRANTED + ]; + + yield [ + $this->buildToken(StoredObjectRoleEnum::SEE, $so = new StoredObject()), + $so, + StoredObjectRoleEnum::EDIT->value, + VoterInterface::ACCESS_DENIED, + ]; + + yield [ + $this->buildToken(StoredObjectRoleEnum::SEE, $so = new StoredObject()), + $so, + StoredObjectRoleEnum::SEE->value, + VoterInterface::ACCESS_GRANTED + ]; + + yield [ + $this->buildToken(null, null), + new StoredObject(), + StoredObjectRoleEnum::SEE->value, + VoterInterface::ACCESS_DENIED, + ]; + + yield [ + $this->buildToken(null, null), + new StoredObject(), + StoredObjectRoleEnum::SEE->value, + VoterInterface::ACCESS_DENIED, + ]; + } + + + private function buildToken(?StoredObjectRoleEnum $storedObjectRoleEnum = null, ?StoredObject $storedObject = null): TokenInterface + { + $token = $this->prophesize(TokenInterface::class); + + if (null !== $storedObjectRoleEnum) { + $token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)->willReturn(true); + $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)->willReturn($storedObjectRoleEnum); + } else { + $token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)->willReturn(false); + $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)->willThrow(new \InvalidArgumentException()); + } + + + if (null !== $storedObject) { + $token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willReturn(true); + $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willReturn($storedObject->getUuid()->toString()); + } else { + $token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willReturn(false); + $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willThrow(new \InvalidArgumentException()); + } + + return $token->reveal(); + } +} From ab95bb157eb940bb7fd25bcc615de8835817e7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 15 Sep 2023 22:32:25 +0200 Subject: [PATCH 049/251] Dav: add some documentation on classes --- .../Controller/WebdavController.php | 24 +++++++++---------- .../Authorization/StoredObjectRoleEnum.php | 3 +++ .../Authorization/StoredObjectVoter.php | 5 ++++ .../Security/Guard/DavOnUrlTokenExtractor.php | 8 +++++++ .../DavTokenAuthenticationEventSubscriber.php | 3 +++ .../Guard/JWTOnDavUrlAuthenticator.php | 3 +++ 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index 471aec99f..ff22e6046 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -25,6 +25,17 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; +/** + * Provide endpoint for editing a document on the desktop using dav. + * + * This controller implements the minimal required methods to edit a document on a desktop software (i.e. LibreOffice) + * and save the document online. + * + * To avoid to ask for a password, the endpoints are protected using a JWT access token, which is inside the + * URL. This avoid the DAV Client (LibreOffice) to keep an access token in query parameter or in some header (which + * they are not able to understand). The JWT Guard is adapted with a dedicated token extractor which is going to read + * the segments (separation of "/"): the first segment must be the string "dav", and the second one must be the JWT. + */ final readonly class WebdavController { private PropfindRequestAnalyzer $requestAnalyzer; @@ -33,23 +44,10 @@ final readonly class WebdavController private \Twig\Environment $engine, private StoredObjectManagerInterface $storedObjectManager, private Security $security, - private ?JWTDavTokenProviderInterface $davTokenProvider = null, ) { $this->requestAnalyzer = new PropfindRequestAnalyzer(); } - /** - * @Route("/chdoc/open/{uuid}") - */ - public function open(StoredObject $storedObject): Response - { - $accessToken = $this->davTokenProvider?->createToken($storedObject, StoredObjectRoleEnum::EDIT); - - return new DavResponse($this->engine->render('@ChillDocStore/Webdav/open_in_browser.html.twig', [ - 'stored_object' => $storedObject, 'access_token' => $accessToken, - ])); - } - /** * @Route("/dav/{access_token}/get/{uuid}/", methods={"GET", "HEAD"}, name="chill_docstore_dav_directory_get") */ diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php index 6a5a22da0..af2813240 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectRoleEnum.php @@ -11,6 +11,9 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Security\Authorization; +/** + * Role to edit or see the stored object content. + */ enum StoredObjectRoleEnum: string { case SEE = 'SEE'; diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php index 55c9b3ca1..570a2be13 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php @@ -16,6 +16,11 @@ use Chill\DocStoreBundle\Security\Guard\DavTokenAuthenticationEventSubscriber; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Voter; +/** + * Voter for the content of a stored object. + * + * This is in use to allow or disallow the edition of the stored object's content. + */ class StoredObjectVoter extends Voter { protected function supports($attribute, $subject): bool diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php index eb030f799..0b2cc6a0a 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php @@ -15,6 +15,14 @@ use Lexik\Bundle\JWTAuthenticationBundle\TokenExtractor\TokenExtractorInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; +/** + * Extract the JWT Token from the segment of the dav endpoints. + * + * A segment is a separation inside the string, using the character "/". + * + * For recognizing the JWT, the first segment must be "dav", and the second one must be + * the JWT endpoint. + */ final readonly class DavOnUrlTokenExtractor implements TokenExtractorInterface { public function __construct( diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php index 3c1b3e2a9..c3f527e71 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php @@ -16,6 +16,9 @@ use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTAuthenticatedEvent; use Lexik\Bundle\JWTAuthenticationBundle\Events; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +/** + * Store some data from the JWT's payload inside the token's attributes. + */ class DavTokenAuthenticationEventSubscriber implements EventSubscriberInterface { final public const STORED_OBJECT = 'stored_object'; diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php index b4ae04afc..ceb44949a 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php @@ -18,6 +18,9 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * Alter the base JWTTokenAuthenticator to add the special extractor for dav url endpoints. + */ class JWTOnDavUrlAuthenticator extends JWTTokenAuthenticator { public function __construct( From 813a80d6f9b46286ba68315cb2ee5a382e3cadce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 17 Sep 2023 15:44:57 +0200 Subject: [PATCH 050/251] Dav: add UI to edit document --- .../Controller/WebdavController.php | 1 - .../document_action_buttons_group/index.ts | 10 ++- .../vuejs/DocumentActionButtonsGroup.vue | 16 ++++- .../StoredObjectButton/DesktopEditButton.vue | 66 +++++++++++++++++++ .../views/Button/button_group.html.twig | 2 + .../Security/Guard/JWTDavTokenProvider.php | 7 ++ .../Guard/JWTDavTokenProviderInterface.php | 2 + .../WopiEditTwigExtensionRuntime.php | 33 ++++++++-- 8 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index ff22e6046..b4624d463 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -15,7 +15,6 @@ use Chill\DocStoreBundle\Dav\Request\PropfindRequestAnalyzer; use Chill\DocStoreBundle\Dav\Response\DavResponse; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; -use Chill\DocStoreBundle\Security\Guard\JWTDavTokenProviderInterface; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; use DateTimeInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts index 4180808dd..77eb8c2c9 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts @@ -17,18 +17,22 @@ window.addEventListener('DOMContentLoaded', function (e) { canEdit: string, storedObject: string, buttonSmall: string, + davLink: string, + davLinkExpiration: string, }; const storedObject = JSON.parse(datasets.storedObject) as StoredObject, filename = datasets.filename, canEdit = datasets.canEdit === '1', - small = datasets.buttonSmall === '1' + small = datasets.buttonSmall === '1', + davLink = 'davLink' in datasets && datasets.davLink !== '' ? datasets.davLink : null, + davLinkExpiration = 'davLinkExpiration' in datasets ? Number.parseInt(datasets.davLinkExpiration) : null ; - return { storedObject, filename, canEdit, small }; + return { storedObject, filename, canEdit, small, davLink, davLinkExpiration }; }, - template: '', + template: '', methods: { onStoredObjectStatusChange: function(newStatus: StoredObjectStatusChange): void { this.$data.storedObject.status = newStatus.status; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue index 88587e90f..284ae0f1f 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue @@ -7,6 +7,9 @@
  • +
  • + +
  • @@ -36,6 +39,7 @@ import { StoredObjectStatusChange, WopiEditButtonExecutableBeforeLeaveFunction } from "../types"; +import DesktopEditButton from "ChillDocStoreAssets/vuejs/StoredObjectButton/DesktopEditButton.vue"; interface DocumentActionButtonsGroupConfig { storedObject: StoredObject, @@ -57,6 +61,16 @@ interface DocumentActionButtonsGroupConfig { * If set, will execute this function before leaving to the editor */ executeBeforeLeave?: WopiEditButtonExecutableBeforeLeaveFunction, + + /** + * a link to download and edit file using webdav + */ + davLink?: string, + + /** + * the expiration date of the download, as a unix timestamp + */ + davLinkExpiration?: number, } const emit = defineEmits<{ @@ -68,7 +82,7 @@ const props = withDefaults(defineProps(), { canEdit: true, canDownload: true, canConvertPdf: true, - returnPath: window.location.pathname + window.location.search + window.location.hash, + returnPath: window.location.pathname + window.location.search + window.location.hash }); /** diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue new file mode 100644 index 000000000..ef0d0d376 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Button/button_group.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Button/button_group.html.twig index 2babe1ad9..6248cbd20 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Button/button_group.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Button/button_group.html.twig @@ -3,5 +3,7 @@ data-download-buttons data-stored-object="{{ document_json|json_encode|escape('html_attr') }}" data-can-edit="{{ can_edit ? '1' : '0' }}" + data-dav-link="{{ dav_link|escape('html_attr') }}" + data-dav-link-expiration="{{ dav_link_expiration|escape('html_attr') }}" {% if options['small'] is defined %}data-button-small="{{ options['small'] ? '1' : '0' }}"{% endif %} {% if title|default(document.title)|default(null) is not null %}data-filename="{{ title|default(document.title)|escape('html_attr') }}"{% endif %}> diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php index 30b25dd0b..a297ed613 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php @@ -38,4 +38,11 @@ final readonly class JWTDavTokenProvider implements JWTDavTokenProviderInterface ]); } + public function getTokenExpiration(string $tokenString): \DateTimeImmutable + { + $jwt = $this->JWTTokenManager->parse($tokenString); + + return \DateTimeImmutable::createFromFormat('U', (string) $jwt['exp']); + } + } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php index 6be91a39c..b93b658b0 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php @@ -20,4 +20,6 @@ use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; interface JWTDavTokenProviderInterface { public function createToken(StoredObject $storedObject, StoredObjectRoleEnum $roleEnum): string; + + public function getTokenExpiration(string $tokenString): \DateTimeImmutable; } diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index 969e4f95e..c26e7d3fc 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -13,6 +13,10 @@ namespace Chill\DocStoreBundle\Templating; use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface; use Chill\DocStoreBundle\Entity\StoredObject; +use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; +use Chill\DocStoreBundle\Security\Guard\JWTDavTokenProviderInterface; +use Namshi\JOSE\JWS; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Twig\Environment; @@ -120,9 +124,12 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt private const TEMPLATE_BUTTON_GROUP = '@ChillDocStore/Button/button_group.html.twig'; - public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) - { - } + public function __construct( + private DiscoveryInterface $discovery, + private NormalizerInterface $normalizer, + private JWTDavTokenProviderInterface $davTokenProvider, + private UrlGeneratorInterface $urlGenerator, + ) {} /** * return true if the document is editable. @@ -132,7 +139,7 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt */ public function isEditable(StoredObject $document): bool { - return \in_array($document->getType(), self::SUPPORTED_MIMES, true); + return in_array($document->getType(), self::SUPPORTED_MIMES, true); } /** @@ -142,18 +149,32 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt * @throws \Twig\Error\RuntimeError * @throws \Twig\Error\SyntaxError */ - public function renderButtonGroup(Environment $environment, StoredObject $document, string $title = null, bool $canEdit = true, array $options = []): string + public function renderButtonGroup(Environment $environment, StoredObject $document, ?string $title = null, bool $canEdit = true, array $options = []): string { + $accessToken = $this->davTokenProvider->createToken( + $document, + $canEdit ? StoredObjectRoleEnum::EDIT : StoredObjectRoleEnum::SEE + ); + return $environment->render(self::TEMPLATE_BUTTON_GROUP, [ 'document' => $document, 'document_json' => $this->normalizer->normalize($document, 'json', [AbstractNormalizer::GROUPS => ['read']]), 'title' => $title, 'can_edit' => $canEdit, 'options' => [...self::DEFAULT_OPTIONS_TEMPLATE_BUTTON_GROUP, ...$options], + 'dav_link' => $this->urlGenerator->generate( + 'chill_docstore_dav_document_get', + [ + 'uuid' => $document->getUuid(), + 'access_token' => $accessToken, + ], + UrlGeneratorInterface::ABSOLUTE_URL, + ), + 'dav_link_expiration' => $this->davTokenProvider->getTokenExpiration($accessToken)->format('U'), ]); } - public function renderEditButton(Environment $environment, StoredObject $document, array $options = null): string + public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string { return $environment->render(self::TEMPLATE, [ 'document' => $document, From a0328b9d68093cad82072c1c0475006e4f6538e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 15 Jan 2024 20:38:03 +0100 Subject: [PATCH 051/251] Apply new CS rules on the webdav feature --- ...TokenAuthenticationEventSubscriberTest.php | 1 + .../Controller/WebdavController.php | 29 ++++--- .../Dav/Exception/ParseRequestException.php | 4 +- .../Dav/Request/PropfindRequestAnalyzer.php | 9 +-- .../Authorization/StoredObjectVoter.php | 8 +- .../Security/Guard/DavOnUrlTokenExtractor.php | 9 ++- .../DavTokenAuthenticationEventSubscriber.php | 4 +- .../Security/Guard/JWTDavTokenProvider.php | 6 +- .../Guard/JWTDavTokenProviderInterface.php | 2 +- .../WopiEditTwigExtensionRuntime.php | 8 +- .../Tests/Controller/WebdavControllerTest.php | 32 ++++---- .../Request/PropfindRequestAnalyzerTest.php | 80 +++++++++---------- .../Authorization/StoredObjectVoterTest.php | 17 ++-- .../Guard/DavOnUrlTokenExtractorTest.php | 3 +- 14 files changed, 104 insertions(+), 108 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php b/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php index 03cea7d29..875e40a65 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Tests/Chill/DocStoreBundle/Tests/Security/Guard/DavTokenAuthenticationEventSubscriberTest.php @@ -19,6 +19,7 @@ use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; /** * @internal + * * @coversNothing */ class DavTokenAuthenticationEventSubscriberTest extends TestCase diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php index b4624d463..70aecbe1e 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php @@ -16,7 +16,6 @@ use Chill\DocStoreBundle\Dav\Response\DavResponse; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; -use DateTimeInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -42,7 +41,7 @@ final readonly class WebdavController public function __construct( private \Twig\Environment $engine, private StoredObjectManagerInterface $storedObjectManager, - private Security $security, + private Security $security, ) { $this->requestAnalyzer = new PropfindRequestAnalyzer(); } @@ -73,11 +72,11 @@ final readonly class WebdavController throw new AccessDeniedHttpException(); } - $response = (new DavResponse("")) + $response = (new DavResponse('')) ->setEtag($this->storedObjectManager->etag($storedObject)) ; - //$response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT,PATCH,POST,TRACE']); + // $response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT,PROPPATCH,COPY,MOVE,REPORT,PATCH,POST,TRACE']); $response->headers->add(['Allow' => 'OPTIONS,GET,HEAD,DELETE,PROPFIND,PUT']); return $response; @@ -94,8 +93,8 @@ final readonly class WebdavController $depth = $request->headers->get('depth'); - if ("0" !== $depth && "1" !== $depth) { - throw new BadRequestHttpException("only 1 and 0 are accepted for Depth header"); + if ('0' !== $depth && '1' !== $depth) { + throw new BadRequestHttpException('only 1 and 0 are accepted for Depth header'); } [$properties, $lastModified, $etag, $length] = $this->parseDavRequest($request->getContent(), $storedObject); @@ -104,7 +103,7 @@ final readonly class WebdavController $this->engine->render('@ChillDocStore/Webdav/directory_propfind.xml.twig', [ 'stored_object' => $storedObject, 'properties' => $properties, - 'last_modified' => $lastModified , + 'last_modified' => $lastModified, 'etag' => $etag, 'content_length' => $length, 'depth' => (int) $depth, @@ -114,7 +113,7 @@ final readonly class WebdavController ); $response->headers->add([ - 'Content-Type' => 'text/xml' + 'Content-Type' => 'text/xml', ]); return $response; @@ -142,13 +141,13 @@ final readonly class WebdavController throw new AccessDeniedHttpException(); } - $response = new DavResponse(""); + $response = new DavResponse(''); $response->headers->add( [ 'Content-Length' => $this->storedObjectManager->getContentLength($storedObject), 'Content-Type' => $storedObject->getType(), - 'Etag' => $this->storedObjectManager->etag($storedObject) + 'Etag' => $this->storedObjectManager->etag($storedObject), ] ); @@ -164,7 +163,7 @@ final readonly class WebdavController throw new AccessDeniedHttpException(); } - $response = (new DavResponse("")) + $response = (new DavResponse('')) ->setEtag($this->storedObjectManager->etag($storedObject)) ; @@ -201,7 +200,7 @@ final readonly class WebdavController $response ->headers->add([ - 'Content-Type' => 'text/xml' + 'Content-Type' => 'text/xml', ]); return $response; @@ -218,11 +217,11 @@ final readonly class WebdavController $this->storedObjectManager->write($storedObject, $request->getContent()); - return (new DavResponse("", Response::HTTP_NO_CONTENT)); + return new DavResponse('', Response::HTTP_NO_CONTENT); } /** - * @return array{0: array, 1: DateTimeInterface, 2: string, 3: int} properties, lastModified, etag, length + * @return array{0: array, 1: \DateTimeInterface, 2: string, 3: int} properties, lastModified, etag, length */ private function parseDavRequest(string $content, StoredObject $storedObject): array { @@ -247,7 +246,7 @@ final readonly class WebdavController $properties, $lastModified ?? null, $etag ?? null, - $length ?? null + $length ?? null, ]; } } diff --git a/src/Bundle/ChillDocStoreBundle/Dav/Exception/ParseRequestException.php b/src/Bundle/ChillDocStoreBundle/Dav/Exception/ParseRequestException.php index 0c740be17..70fff1866 100644 --- a/src/Bundle/ChillDocStoreBundle/Dav/Exception/ParseRequestException.php +++ b/src/Bundle/ChillDocStoreBundle/Dav/Exception/ParseRequestException.php @@ -11,4 +11,6 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Dav\Exception; -class ParseRequestException extends \UnexpectedValueException {} +class ParseRequestException extends \UnexpectedValueException +{ +} diff --git a/src/Bundle/ChillDocStoreBundle/Dav/Request/PropfindRequestAnalyzer.php b/src/Bundle/ChillDocStoreBundle/Dav/Request/PropfindRequestAnalyzer.php index 3abf43c62..e6c52a193 100644 --- a/src/Bundle/ChillDocStoreBundle/Dav/Request/PropfindRequestAnalyzer.php +++ b/src/Bundle/ChillDocStoreBundle/Dav/Request/PropfindRequestAnalyzer.php @@ -36,17 +36,17 @@ class PropfindRequestAnalyzer $propfinds = $request->getElementsByTagNameNS('DAV:', 'propfind'); if (0 === $propfinds->count()) { - throw new ParseRequestException("any propfind element found"); + throw new ParseRequestException('any propfind element found'); } if (1 < $propfinds->count()) { - throw new ParseRequestException("too much propfind element found"); + throw new ParseRequestException('too much propfind element found'); } $propfind = $propfinds->item(0); if (0 === $propfind->childNodes->count()) { - throw new ParseRequestException("no element under propfind"); + throw new ParseRequestException('no element under propfind'); } $unknows = []; @@ -79,7 +79,6 @@ class PropfindRequestAnalyzer default => '', }; } - } $props = array_filter(array_values($props), fn (string $item) => '' !== $item); @@ -98,7 +97,7 @@ class PropfindRequestAnalyzer self::KNOWN_PROPS, array_fill(0, count(self::KNOWN_PROPS), $default) ), - 'unknowns' => [] + 'unknowns' => [], ]; } } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php index 570a2be13..2e253cf3c 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php @@ -34,8 +34,7 @@ class StoredObjectVoter extends Voter /** @var StoredObject $subject */ if ( !$token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) - || - $subject->getUuid()->toString() !== $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) + || $subject->getUuid()->toString() !== $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) ) { return false; } @@ -49,9 +48,8 @@ class StoredObjectVoter extends Voter $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS); return match ($askedRole) { - StoredObjectRoleEnum::SEE => - $tokenRoleAuthorization === StoredObjectRoleEnum::EDIT || $tokenRoleAuthorization === StoredObjectRoleEnum::SEE, - StoredObjectRoleEnum::EDIT => $tokenRoleAuthorization === StoredObjectRoleEnum::EDIT + StoredObjectRoleEnum::SEE => StoredObjectRoleEnum::EDIT === $tokenRoleAuthorization || StoredObjectRoleEnum::SEE === $tokenRoleAuthorization, + StoredObjectRoleEnum::EDIT => StoredObjectRoleEnum::EDIT === $tokenRoleAuthorization }; } } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php index 0b2cc6a0a..543996f57 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavOnUrlTokenExtractor.php @@ -27,9 +27,10 @@ final readonly class DavOnUrlTokenExtractor implements TokenExtractorInterface { public function __construct( private LoggerInterface $logger, - ) {} + ) { + } - public function extract(Request $request): string|false + public function extract(Request $request): false|string { $uri = $request->getRequestUri(); @@ -41,13 +42,13 @@ final readonly class DavOnUrlTokenExtractor implements TokenExtractorInterface ); if (2 > count($segments)) { - $this->logger->info("not enough segment for parsing URL"); + $this->logger->info('not enough segment for parsing URL'); return false; } if ('dav' !== $segments[0]) { - $this->logger->info("the first segment of the url must be DAV"); + $this->logger->info('the first segment of the url must be DAV'); return false; } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php index c3f527e71..7b33c0eec 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/DavTokenAuthenticationEventSubscriber.php @@ -43,11 +43,9 @@ class DavTokenAuthenticationEventSubscriber implements EventSubscriberInterface $token->setAttribute(self::ACTIONS, match ($payload['e']) { 0 => StoredObjectRoleEnum::SEE, 1 => StoredObjectRoleEnum::EDIT, - default => throw new \UnexpectedValueException("unsupported value for e parameter") + default => throw new \UnexpectedValueException('unsupported value for e parameter') }); $token->setAttribute(self::STORED_OBJECT, $payload['so']); } - - } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php index a297ed613..24e89a3ba 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProvider.php @@ -17,14 +17,15 @@ use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; use Symfony\Component\Security\Core\Security; /** - * Provide a JWT Token which will be valid for viewing or editing a document + * Provide a JWT Token which will be valid for viewing or editing a document. */ final readonly class JWTDavTokenProvider implements JWTDavTokenProviderInterface { public function __construct( private JWTTokenManagerInterface $JWTTokenManager, private Security $security, - ) {} + ) { + } public function createToken(StoredObject $storedObject, StoredObjectRoleEnum $roleEnum): string { @@ -44,5 +45,4 @@ final readonly class JWTDavTokenProvider implements JWTDavTokenProviderInterface return \DateTimeImmutable::createFromFormat('U', (string) $jwt['exp']); } - } diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php index b93b658b0..95c62c86e 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTDavTokenProviderInterface.php @@ -15,7 +15,7 @@ use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; /** - * Provide a JWT Token which will be valid for viewing or editing a document + * Provide a JWT Token which will be valid for viewing or editing a document. */ interface JWTDavTokenProviderInterface { diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index c26e7d3fc..fd6c718b9 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -15,7 +15,6 @@ use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum; use Chill\DocStoreBundle\Security\Guard\JWTDavTokenProviderInterface; -use Namshi\JOSE\JWS; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -129,7 +128,8 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt private NormalizerInterface $normalizer, private JWTDavTokenProviderInterface $davTokenProvider, private UrlGeneratorInterface $urlGenerator, - ) {} + ) { + } /** * return true if the document is editable. @@ -149,7 +149,7 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt * @throws \Twig\Error\RuntimeError * @throws \Twig\Error\SyntaxError */ - public function renderButtonGroup(Environment $environment, StoredObject $document, ?string $title = null, bool $canEdit = true, array $options = []): string + public function renderButtonGroup(Environment $environment, StoredObject $document, string $title = null, bool $canEdit = true, array $options = []): string { $accessToken = $this->davTokenProvider->createToken( $document, @@ -174,7 +174,7 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt ]); } - public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string + public function renderEditButton(Environment $environment, StoredObject $document, array $options = null): string { return $environment->render(self::TEMPLATE, [ 'document' => $document, diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php index 93d4d85e8..9254efc2d 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Controller/WebdavControllerTest.php @@ -14,18 +14,16 @@ namespace Chill\DocStoreBundle\Tests\Controller; use Chill\DocStoreBundle\Controller\WebdavController; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; -use DateTimeInterface; -use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Ramsey\Uuid\Uuid; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Security; -use Symfony\Component\Templating\EngineInterface; /** * @internal + * * @coversNothing */ class WebdavControllerTest extends KernelTestCase @@ -124,7 +122,7 @@ class WebdavControllerTest extends KernelTestCase self::assertEquals($expectedStatusCode, $response->getStatusCode()); self::assertContains('content-type', $response->headers->keys()); self::assertStringContainsString('text/xml', $response->headers->get('content-type')); - self::assertTrue((new \DOMDocument())->loadXML($response->getContent()), $message . " test that the xml response is a valid xml"); + self::assertTrue((new \DOMDocument())->loadXML($response->getContent()), $message.' test that the xml response is a valid xml'); self::assertXmlStringEqualsXmlString($expectedXmlResponse, $response->getContent(), $message); } @@ -137,13 +135,13 @@ class WebdavControllerTest extends KernelTestCase $request = new Request([], [], [], [], [], [], $requestContent); $request->setMethod('PROPFIND'); - $request->headers->add(["Depth" => "0"]); + $request->headers->add(['Depth' => '0']); $response = $controller->propfindDirectory($this->buildDocument(), '1234', $request); self::assertEquals($expectedStatusCode, $response->getStatusCode()); self::assertContains('content-type', $response->headers->keys()); self::assertStringContainsString('text/xml', $response->headers->get('content-type')); - self::assertTrue((new \DOMDocument())->loadXML($response->getContent()), $message . " test that the xml response is a valid xml"); + self::assertTrue((new \DOMDocument())->loadXML($response->getContent()), $message.' test that the xml response is a valid xml'); self::assertXmlStringEqualsXmlString($expectedXmlResponse, $response->getContent(), $message); } @@ -192,7 +190,7 @@ class WebdavControllerTest extends KernelTestCase
    XML; - yield [$content, 207, $response, "get IsReadOnly and contenttype from server"]; + yield [$content, 207, $response, 'get IsReadOnly and contenttype from server']; $content = <<<'XML' @@ -220,7 +218,7 @@ class WebdavControllerTest extends KernelTestCase
    XML; - yield [$content, 207, $response, "get property IsReadOnly"]; + yield [$content, 207, $response, 'get property IsReadOnly']; yield [ <<<'XML' @@ -246,7 +244,7 @@ class WebdavControllerTest extends KernelTestCase
    XML, - "Test requesting an unknow property" + 'Test requesting an unknow property', ]; yield [ @@ -274,7 +272,7 @@ class WebdavControllerTest extends KernelTestCase
    XML, - "test getting the last modified date" + 'test getting the last modified date', ]; yield [ @@ -311,7 +309,7 @@ class WebdavControllerTest extends KernelTestCase
    XML, - "test finding all properties" + 'test finding all properties', ]; } @@ -356,7 +354,7 @@ class WebdavControllerTest extends KernelTestCase
    XML, - "test resourceType and IsReadOnly " + 'test resourceType and IsReadOnly ', ]; yield [ @@ -379,15 +377,14 @@ class WebdavControllerTest extends KernelTestCase
    XML, - "test creatableContentsInfo" + 'test creatableContentsInfo', ]; } - } class MockedStoredObjectManager implements StoredObjectManagerInterface { - public function getLastModified(StoredObject $document): DateTimeInterface + public function getLastModified(StoredObject $document): \DateTimeInterface { return new \DateTimeImmutable('2023-09-13T14:15'); } @@ -402,11 +399,12 @@ class MockedStoredObjectManager implements StoredObjectManagerInterface return 'abcde'; } - public function write(StoredObject $document, string $clearContent): void {} + public function write(StoredObject $document, string $clearContent): void + { + } public function etag(StoredObject $document): string { return 'ab56b4d92b40713acc5af89985d4b786'; } - } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php index 3cc2f19fe..babe9932a 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Dav/Request/PropfindRequestAnalyzerTest.php @@ -12,11 +12,11 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Tests\Dav\Request; use Chill\DocStoreBundle\Dav\Request\PropfindRequestAnalyzer; -use phpseclib3\Crypt\DSA\Formats\Keys\XML; use PHPUnit\Framework\TestCase; /** * @internal + * * @coversNothing */ class PropfindRequestAnalyzerTest extends TestCase @@ -33,7 +33,7 @@ class PropfindRequestAnalyzerTest extends TestCase $actual = $analyzer->getRequestedProperties($request); foreach ($expected as $key => $value) { - if ($key === 'unknowns') { + if ('unknowns' === $key) { continue; } @@ -59,17 +59,17 @@ class PropfindRequestAnalyzerTest extends TestCase XML, [ - "resourceType" => false, - "contentType" => false, - "lastModified" => false, - "creationDate" => false, - "contentLength" => false, - "etag" => false, - "supportedLock" => false, + 'resourceType' => false, + 'contentType' => false, + 'lastModified' => false, + 'creationDate' => false, + 'contentLength' => false, + 'etag' => false, + 'supportedLock' => false, 'unknowns' => [ - ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'BaseURI'] - ] - ] + ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'BaseURI'], + ], + ], ]; yield [ @@ -80,15 +80,15 @@ class PropfindRequestAnalyzerTest extends TestCase XML, [ - "resourceType" => true, - "contentType" => true, - "lastModified" => true, - "creationDate" => true, - "contentLength" => true, - "etag" => true, - "supportedLock" => true, - "unknowns" => [], - ] + 'resourceType' => true, + 'contentType' => true, + 'lastModified' => true, + 'creationDate' => true, + 'contentLength' => true, + 'etag' => true, + 'supportedLock' => true, + 'unknowns' => [], + ], ]; yield [ @@ -101,15 +101,15 @@ class PropfindRequestAnalyzerTest extends TestCase XML, [ - "resourceType" => false, - "contentType" => false, - "lastModified" => true, - "creationDate" => false, - "contentLength" => false, - "etag" => false, - "supportedLock" => false, - 'unknowns' => [] - ] + 'resourceType' => false, + 'contentType' => false, + 'lastModified' => true, + 'creationDate' => false, + 'contentLength' => false, + 'etag' => false, + 'supportedLock' => false, + 'unknowns' => [], + ], ]; yield [ @@ -118,17 +118,17 @@ class PropfindRequestAnalyzerTest extends TestCase XML, [ - "resourceType" => true, - "contentType" => true, - "lastModified" => false, - "creationDate" => false, - "contentLength" => false, - "etag" => false, - "supportedLock" => false, + 'resourceType' => true, + 'contentType' => true, + 'lastModified' => false, + 'creationDate' => false, + 'contentLength' => false, + 'etag' => false, + 'supportedLock' => false, 'unknowns' => [ - ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'IsReadOnly'] - ] - ] + ['xmlns' => 'http://ucb.openoffice.org/dav/props/', 'prop' => 'IsReadOnly'], + ], + ], ]; } } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php index c4518586f..477427078 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Security/Authorization/StoredObjectVoterTest.php @@ -22,6 +22,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; /** * @internal + * * @coversNothing */ class StoredObjectVoterTest extends TestCase @@ -31,7 +32,7 @@ class StoredObjectVoterTest extends TestCase /** * @dataProvider provideDataVote */ - public function testVote(TokenInterface $token, object|null $subject, string $attribute, mixed $expected): void + public function testVote(TokenInterface $token, null|object $subject, string $attribute, mixed $expected): void { $voter = new StoredObjectVoter(); @@ -44,28 +45,28 @@ class StoredObjectVoterTest extends TestCase $this->buildToken(StoredObjectRoleEnum::EDIT, new StoredObject()), new \stdClass(), 'SOMETHING', - VoterInterface::ACCESS_ABSTAIN + VoterInterface::ACCESS_ABSTAIN, ]; yield [ $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), $so, 'SOMETHING', - VoterInterface::ACCESS_ABSTAIN + VoterInterface::ACCESS_ABSTAIN, ]; yield [ $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), $so, StoredObjectRoleEnum::SEE->value, - VoterInterface::ACCESS_GRANTED + VoterInterface::ACCESS_GRANTED, ]; yield [ $this->buildToken(StoredObjectRoleEnum::EDIT, $so = new StoredObject()), $so, StoredObjectRoleEnum::EDIT->value, - VoterInterface::ACCESS_GRANTED + VoterInterface::ACCESS_GRANTED, ]; yield [ @@ -79,7 +80,7 @@ class StoredObjectVoterTest extends TestCase $this->buildToken(StoredObjectRoleEnum::SEE, $so = new StoredObject()), $so, StoredObjectRoleEnum::SEE->value, - VoterInterface::ACCESS_GRANTED + VoterInterface::ACCESS_GRANTED, ]; yield [ @@ -97,8 +98,7 @@ class StoredObjectVoterTest extends TestCase ]; } - - private function buildToken(?StoredObjectRoleEnum $storedObjectRoleEnum = null, ?StoredObject $storedObject = null): TokenInterface + private function buildToken(StoredObjectRoleEnum $storedObjectRoleEnum = null, StoredObject $storedObject = null): TokenInterface { $token = $this->prophesize(TokenInterface::class); @@ -110,7 +110,6 @@ class StoredObjectVoterTest extends TestCase $token->getAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)->willThrow(new \InvalidArgumentException()); } - if (null !== $storedObject) { $token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willReturn(true); $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT)->willReturn($storedObject->getUuid()->toString()); diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php index b9e046b28..e1e0a3b36 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Security/Guard/DavOnUrlTokenExtractorTest.php @@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Request; /** * @internal + * * @coversNothing */ class DavOnUrlTokenExtractorTest extends TestCase @@ -28,7 +29,7 @@ class DavOnUrlTokenExtractorTest extends TestCase /** * @dataProvider provideDataUri */ - public function testExtract(string $uri, string|false $expected): void + public function testExtract(string $uri, false|string $expected): void { $request = $this->prophesize(Request::class); $request->getRequestUri()->willReturn($uri); From cf1df462dcf02d5d3df763ce4fa09bb45f69b3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 15 Jan 2024 21:18:51 +0100 Subject: [PATCH 052/251] optional parameter after the required one --- .../Security/Guard/JWTOnDavUrlAuthenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php index ceb44949a..7695fb635 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Guard/JWTOnDavUrlAuthenticator.php @@ -27,9 +27,9 @@ class JWTOnDavUrlAuthenticator extends JWTTokenAuthenticator JWTTokenManagerInterface $jwtManager, EventDispatcherInterface $dispatcher, TokenExtractorInterface $tokenExtractor, + private readonly DavOnUrlTokenExtractor $davOnUrlTokenExtractor, TokenStorageInterface $preAuthenticationTokenStorage, TranslatorInterface $translator = null, - private readonly DavOnUrlTokenExtractor $davOnUrlTokenExtractor, ) { parent::__construct($jwtManager, $dispatcher, $tokenExtractor, $preAuthenticationTokenStorage, $translator); } From f889d67e94003a58a787d3663b71ba8625f93687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 12 Feb 2024 22:31:16 +0100 Subject: [PATCH 053/251] fixes after merge of master into upgrade-sf4 --- .../ChillActivityBundle.php | 4 +- .../ChillActivityBundle/Entity/Activity.php | 1 - .../EntityListener/ActivityEntityListener.php | 4 +- .../ByActivityTypeAggregator.php | 3 +- .../BySocialActionAggregator.php | 4 +- .../BySocialIssueAggregator.php | 4 +- .../Aggregator/ActivityPresenceAggregator.php | 8 +-- .../Aggregator/ActivityReasonAggregator.php | 3 +- .../Aggregator/ActivityTypeAggregator.php | 4 +- .../Aggregator/ActivityUserAggregator.php | 4 +- .../Aggregator/ActivityUsersAggregator.php | 4 +- .../Aggregator/ActivityUsersJobAggregator.php | 7 +-- .../ActivityUsersScopeAggregator.php | 7 +-- .../Export/Aggregator/ByCreatorAggregator.php | 4 +- .../Aggregator/ByThirdpartyAggregator.php | 4 +- .../Aggregator/CreatorJobAggregator.php | 7 +-- .../Aggregator/CreatorScopeAggregator.php | 7 +-- .../Aggregator/LocationTypeAggregator.php | 4 +- .../PersonAggregators/PersonAggregator.php | 4 +- .../Export/Aggregator/PersonsAggregator.php | 4 +- .../Aggregator/SentReceivedAggregator.php | 4 +- .../LinkedToACP/AvgActivityDuration.php | 4 +- .../Export/LinkedToACP/CountActivity.php | 4 +- .../LinkedToACP/CountHouseholdOnActivity.php | 4 +- .../LinkedToACP/CountPersonsOnActivity.php | 4 +- .../Export/LinkedToACP/ListActivity.php | 3 +- .../Export/LinkedToPerson/CountActivity.php | 4 +- .../CountHouseholdOnActivity.php | 4 +- .../LinkedToPerson/StatActivityDuration.php | 4 +- .../Export/Export/ListActivityHelper.php | 7 +-- .../Filter/ACPFilters/ActivityTypeFilter.php | 3 +- .../ACPFilters/BySocialActionFilter.php | 4 +- .../Filter/ACPFilters/BySocialIssueFilter.php | 4 +- ...PeriodHavingActivityBetweenDatesFilter.php | 3 +- .../Export/Filter/ActivityDateFilter.php | 4 +- .../Export/Filter/ActivityPresenceFilter.php | 3 +- .../Export/Filter/ActivityTypeFilter.php | 3 +- .../Export/Filter/ActivityUsersFilter.php | 4 +- .../Export/Filter/ByCreatorFilter.php | 4 +- .../Export/Filter/CreatorJobFilter.php | 3 +- .../Export/Filter/CreatorScopeFilter.php | 3 +- .../Export/Filter/EmergencyFilter.php | 4 +- .../Export/Filter/LocationTypeFilter.php | 4 +- .../PersonFilters/ActivityReasonFilter.php | 4 +- .../PersonHavingActivityBetweenDateFilter.php | 3 +- .../Export/Filter/PersonsFilter.php | 4 +- .../Export/Filter/SentReceivedFilter.php | 4 +- .../Export/Filter/UserFilter.php | 4 +- .../Export/Filter/UsersJobFilter.php | 3 +- .../Export/Filter/UsersScopeFilter.php | 3 +- .../Form/ActivityTypeType.php | 4 +- .../Form/Type/PickActivityReasonType.php | 3 +- ...TranslatableActivityReasonCategoryType.php | 4 +- .../Form/Type/TranslatableActivityType.php | 4 +- .../Menu/AccompanyingCourseMenuBuilder.php | 4 +- .../Menu/AdminMenuBuilder.php | 4 +- .../Menu/PersonMenuBuilder.php | 4 +- .../ActivityNotificationHandler.php | 4 +- .../Repository/ActivityACLAwareRepository.php | 3 +- .../ActivityDocumentACLAwareRepository.php | 3 +- .../Service/DocGenerator/ActivityContext.php | 3 +- ...tActivitiesByAccompanyingPeriodContext.php | 3 +- ...anyingPeriodActivityGenericDocProvider.php | 3 +- .../PersonActivityGenericDocProvider.php | 3 +- ...anyingPeriodActivityGenericDocRenderer.php | 4 +- .../src/ChillAsideActivityBundle.php | 4 +- .../Controller/AsideActivityController.php | 18 +++--- .../DataFixtures/ORM/LoadAsideActivity.php | 4 +- .../Aggregator/ByActivityTypeAggregator.php | 3 +- .../Aggregator/ByLocationAggregator.php | 4 +- .../Export/Aggregator/ByUserJobAggregator.php | 7 +-- .../Aggregator/ByUserScopeAggregator.php | 7 +-- .../Export/AvgAsideActivityDuration.php | 8 +-- .../src/Export/Export/CountAsideActivity.php | 8 +-- .../src/Export/Export/ListAsideActivity.php | 7 +-- .../Export/SumAsideActivityDuration.php | 8 +-- .../Export/Filter/ByActivityTypeFilter.php | 3 +- .../src/Export/Filter/ByDateFilter.php | 4 +- .../src/Export/Filter/ByLocationFilter.php | 3 +- .../src/Export/Filter/ByUserFilter.php | 4 +- .../src/Export/Filter/ByUserJobFilter.php | 3 +- .../src/Export/Filter/ByUserScopeFilter.php | 3 +- .../src/Form/AsideActivityCategoryType.php | 4 +- .../Type/PickAsideActivityCategoryType.php | 4 +- .../src/Menu/AdminMenuBuilder.php | 4 +- .../src/Menu/SectionMenuBuilder.php | 4 +- .../src/Templating/Entity/CategoryRender.php | 4 +- .../Controller/AbstractElementController.php | 10 +++- .../Controller/ElementController.php | 4 +- .../ChillBudgetBundle/Form/ChargeType.php | 4 +- .../ChillBudgetBundle/Form/ResourceType.php | 4 +- .../Menu/AdminMenuBuilder.php | 4 +- .../Menu/HouseholdMenuBuilder.php | 4 +- .../Menu/PersonMenuBuilder.php | 4 +- .../Service/Summary/SummaryBudget.php | 4 +- .../Templating/BudgetElementTypeRender.php | 4 +- .../Controller/CalendarAPIController.php | 4 +- .../Controller/CalendarDocController.php | 3 +- .../Controller/CalendarRangeAPIController.php | 4 +- .../Controller/InviteApiController.php | 4 +- .../RemoteCalendarConnectAzureController.php | 4 +- .../RemoteCalendarMSGraphSyncController.php | 4 +- .../RemoteCalendarProxyController.php | 4 +- .../DataFixtures/ORM/LoadCalendarRange.php | 4 +- .../Event/ListenToActivityCreate.php | 4 +- .../Export/Aggregator/AgentAggregator.php | 4 +- .../Aggregator/CancelReasonAggregator.php | 4 +- .../Export/Aggregator/JobAggregator.php | 7 +-- .../Export/Aggregator/LocationAggregator.php | 4 +- .../Aggregator/LocationTypeAggregator.php | 4 +- .../Export/Aggregator/ScopeAggregator.php | 7 +-- .../Export/Aggregator/UrgencyAggregator.php | 4 +- .../Export/Export/CountCalendars.php | 3 +- .../Export/Export/StatCalendarAvgDuration.php | 4 +- .../Export/Export/StatCalendarSumDuration.php | 4 +- .../Export/Filter/AgentFilter.php | 4 +- .../Export/Filter/BetweenDatesFilter.php | 4 +- .../Export/Filter/CalendarRangeFilter.php | 4 +- .../Export/Filter/JobFilter.php | 3 +- .../Export/Filter/ScopeFilter.php | 3 +- .../ChillCalendarBundle/Form/CalendarType.php | 3 +- .../Menu/AccompanyingCourseMenuBuilder.php | 4 +- .../Menu/PersonMenuBuilder.php | 4 +- .../Menu/UserMenuBuilder.php | 4 +- .../Doctrine/CalendarEntityListener.php | 4 +- .../Doctrine/CalendarRangeEntityListener.php | 4 +- .../CalendarRangeRemoveToRemoteHandler.php | 4 +- .../Handler/CalendarRangeToRemoteHandler.php | 4 +- .../Handler/CalendarRemoveHandler.php | 4 +- .../Handler/CalendarToRemoteHandler.php | 4 +- .../Messenger/Handler/InviteUpdateHandler.php | 4 +- .../MSGraphChangeNotificationHandler.php | 4 +- .../MSGraphChangeNotificationMessage.php | 4 +- .../Connector/MSGraph/AddressConverter.php | 4 +- .../EventsOnUserSubscriptionCreator.php | 4 +- .../Connector/MSGraph/LocationConverter.php | 4 +- .../Connector/MSGraph/MSUserAbsenceReader.php | 3 +- .../Connector/MSGraph/MSUserAbsenceSync.php | 3 +- .../Connector/MSGraph/MachineTokenStorage.php | 4 +- .../Connector/MSGraph/MapCalendarToUser.php | 4 +- .../MSGraph/OnBehalfOfUserTokenStorage.php | 4 +- .../RemoteToLocalSync/CalendarRangeSyncer.php | 4 +- .../RemoteToLocalSync/CalendarSyncer.php | 4 +- .../MSGraphRemoteCalendarConnector.php | 4 +- .../Connector/NullRemoteCalendarConnector.php | 20 ++----- .../RemoteCalendar/Model/RemoteEvent.php | 3 +- .../Repository/CalendarACLAwareRepository.php | 4 +- .../Security/Voter/CalendarDocVoter.php | 4 +- .../Service/DocGenerator/CalendarContext.php | 3 +- .../DocGenerator/CalendarContextInterface.php | 4 +- ...anyingPeriodCalendarGenericDocProvider.php | 3 +- .../PersonCalendarGenericDocProvider.php | 3 +- ...anyingPeriodCalendarGenericDocRenderer.php | 4 +- .../BulkCalendarShortMessageSender.php | 4 +- .../CalendarForShortMessageProvider.php | 4 +- .../DefaultShortMessageForCalendarBuilder.php | 4 +- .../Controller/CustomFieldController.php | 8 ++- .../CustomFields/CustomFieldChoice.php | 3 +- .../CustomFields/CustomFieldDate.php | 3 +- .../CustomFields/CustomFieldInterface.php | 4 +- .../CustomFields/CustomFieldLongChoice.php | 3 +- .../CustomFields/CustomFieldNumber.php | 3 +- .../CustomFields/CustomFieldText.php | 3 +- .../CustomFields/CustomFieldTitle.php | 3 +- .../Form/CustomFieldType.php | 4 +- .../Form/CustomFieldsGroupType.php | 3 +- .../CustomFieldDataTransformer.php | 4 +- .../CustomFieldsGroupToIdTransformer.php | 4 +- .../Form/Type/CustomFieldsTitleType.php | 4 +- .../Form/Type/LinkedCustomFieldsType.php | 4 +- .../Service/CustomFieldsHelper.php | 4 +- .../Twig/CustomFieldRenderingTwig.php | 4 +- .../Context/ContextManager.php | 4 +- .../AdminDocGeneratorTemplateController.php | 4 +- .../Form/DocGeneratorTemplateType.php | 4 +- .../Menu/AdminMenuBuilder.php | 4 +- .../Helper/NormalizeNullValueHelper.php | 4 +- .../Service/Context/BaseContextData.php | 4 +- .../Service/Generator/Generator.php | 4 +- .../Service/Messenger/OnGenerationFails.php | 4 +- .../Messenger/RequestGenerationHandler.php | 4 +- .../TempUrlOpenstackGenerator.php | 6 +- .../Exception/BadCallToRemoteServer.php | 2 +- .../TempUrlRemoteServerException.php | 2 +- .../AsyncUpload/TempUrlGeneratorInterface.php | 6 +- .../Templating/AsyncUploadExtension.php | 4 +- ...ericDocForAccompanyingPeriodController.php | 3 +- .../Controller/GenericDocForPerson.php | 3 +- .../Controller/StoredObjectApiController.php | 4 +- .../Entity/DocumentCategory.php | 3 +- .../Form/PersonDocumentType.php | 4 +- .../GenericDoc/FetchQuery.php | 3 +- .../GenericDoc/GenericDocDTO.php | 3 +- ...anyingCourseDocumentGenericDocProvider.php | 3 +- .../PersonDocumentGenericDocProvider.php | 3 +- ...anyingCourseDocumentGenericDocRenderer.php | 3 +- .../Twig/GenericDocExtensionRuntime.php | 3 +- .../ChillDocStoreBundle/Menu/MenuBuilder.php | 4 +- .../PersonDocumentACLAwareRepository.php | 3 +- .../Normalizer/StoredObjectDenormalizer.php | 4 +- .../Service/StoredObjectManager.php | 4 +- .../WopiEditTwigExtensionRuntime.php | 4 +- .../Controller/AsyncUploadControllerTest.php | 4 +- .../ChillEventBundle/ChillEventBundle.php | 4 +- .../Controller/EventController.php | 14 ++--- .../Controller/EventListController.php | 3 +- .../Controller/ParticipationController.php | 3 +- .../Form/ParticipationType.php | 4 +- src/Bundle/ChillEventBundle/Form/RoleType.php | 4 +- .../Form/Type/PickEventType.php | 3 +- .../Form/Type/PickRoleType.php | 3 +- .../Form/Type/PickStatusType.php | 4 +- .../Menu/SectionMenuBuilder.php | 3 +- .../Repository/EventACLAwareRepository.php | 3 +- .../ChillEventBundle/Search/EventSearch.php | 3 +- .../Controller/EventListControllerTest.php | 4 +- .../ParticipationControllerTest.php | 4 +- .../EventACLAwareRepositoryTest.php | 2 +- .../Controller/AbstractCRUDController.php | 24 +++++--- .../CRUD/Controller/ApiController.php | 18 +++--- .../CRUD/Controller/CRUDController.php | 56 +++++-------------- .../CRUD/Form/CRUDDeleteEntityForm.php | 4 +- .../Command/LoadPostalCodesCommand.php | 12 +--- .../AddressReferenceAPIController.php | 4 +- .../AddressToReferenceMatcherController.php | 4 +- ...GeographicalUnitByAddressApiController.php | 4 +- .../Controller/LocationTypeController.php | 4 +- .../Controller/LoginController.php | 4 +- .../Controller/NotificationApiController.php | 4 +- .../Controller/NotificationController.php | 4 +- .../Controller/PermissionApiController.php | 4 +- .../Controller/PermissionsGroupController.php | 7 +-- .../Controller/PostalCodeAPIController.php | 4 +- .../Controller/SavedExportController.php | 4 +- .../Controller/SearchController.php | 4 +- .../Controller/TimelineCenterController.php | 4 +- .../Controller/UserController.php | 4 +- .../Controller/UserExportController.php | 3 +- .../UserJobScopeHistoriesController.php | 3 +- .../Controller/UserProfileController.php | 3 +- .../Controller/WorkflowApiController.php | 4 +- .../Controller/WorkflowController.php | 4 +- .../ChillMainBundle/Cron/CronManager.php | 3 +- .../DataFixtures/ORM/LoadPostalCodes.php | 4 +- .../Event/TrackCreateUpdateSubscriber.php | 4 +- .../ChillMainBundle/Doctrine/Model/Point.php | 4 +- .../SimpleGeographicalUnitDTO.php | 3 +- src/Bundle/ChillMainBundle/Entity/User.php | 4 +- .../Export/ExportFormHelper.php | 3 +- .../Export/Helper/DateTimeHelper.php | 4 +- .../Export/Helper/ExportAddressHelper.php | 4 +- .../TranslatableStringExportLabelHelper.php | 4 +- .../Export/Helper/UserHelper.php | 4 +- .../ChillMainBundle/Export/ListInterface.php | 4 +- .../Export/SortExportElement.php | 3 +- .../DataMapper/PrivateCommentDataMapper.php | 4 +- .../Form/DataMapper/ScopePickerDataMapper.php | 4 +- .../Form/Event/CustomizeFormEvent.php | 4 +- .../ChillMainBundle/Form/LocationFormType.php | 4 +- .../AddressToIdDataTransformer.php | 4 +- .../DataTransformer/CenterTransformer.php | 4 +- .../EntityToJsonTransformer.php | 4 +- .../MultipleObjectsToIdTransformer.php | 4 +- .../DataTransformer/ObjectToIdTransformer.php | 4 +- .../PostalCodeToIdTransformer.php | 4 +- .../Type/DataTransformer/ScopeTransformer.php | 4 +- .../Form/Type/Export/AggregatorType.php | 4 +- .../Form/Type/Export/ExportType.php | 4 +- .../Form/Type/Export/FilterType.php | 4 +- .../Form/Type/Export/PickCenterType.php | 3 +- .../Form/Type/PickAddressType.php | 4 +- .../Form/Type/PickCenterType.php | 4 +- .../Form/Type/PickCivilityType.php | 4 +- .../Form/Type/PickLocationTypeType.php | 4 +- .../Form/Type/PickPostalCodeType.php | 4 +- .../Form/Type/PickUserDynamicType.php | 4 +- .../Form/Type/PickUserLocationType.php | 4 +- .../Form/Type/PrivateCommentType.php | 4 +- .../Form/Type/ScopePickerType.php | 4 +- .../Form/Type/Select2CountryType.php | 4 +- .../Form/Type/Select2LanguageType.php | 4 +- src/Bundle/ChillMainBundle/Form/UserType.php | 4 +- .../ChillMainBundle/Form/WorkflowStepType.php | 4 +- .../Counter/NotificationByUserCounter.php | 4 +- .../Notification/Email/NotificationMailer.php | 4 +- ...NotificationOnTerminateEventSubscriber.php | 4 +- .../Exception/NotificationHandlerNotFound.php | 4 +- .../ChillMainBundle/Notification/Mailer.php | 4 +- .../NotificationHandlerManager.php | 4 +- .../Notification/NotificationPresence.php | 4 +- .../NotificationTwigExtensionRuntime.php | 4 +- .../Pagination/PageGenerator.php | 4 +- .../ChillMainBundle/Pagination/Paginator.php | 3 +- .../Pagination/PaginatorFactory.php | 3 +- .../Phonenumber/Templating.php | 4 +- .../ChillMainBundle/Redis/ChillRedis.php | 4 +- .../Repository/UserACLAwareRepository.php | 4 +- .../MenuBuilder/SectionMenuBuilder.php | 4 +- .../Routing/MenuBuilder/UserMenuBuilder.php | 4 +- .../ChillMainBundle/Routing/MenuComposer.php | 4 +- .../ChillMainBundle/Routing/MenuTwig.php | 4 +- .../Search/Entity/SearchUserApiProvider.php | 4 +- .../ChillMainBundle/Search/Model/Result.php | 3 +- .../Search/ParsingException.php | 4 +- .../ChillMainBundle/Search/SearchApi.php | 4 +- .../Search/SearchApiResult.php | 4 +- .../Search/Utils/SearchExtractionResult.php | 4 +- .../Authorization/AbstractChillVoter.php | 4 +- .../Authorization/AuthorizationHelper.php | 3 +- .../AuthorizationHelperForCurrentUser.php | 4 +- .../Authorization/ChillVoterInterface.php | 4 +- .../Authorization/DefaultVoterHelper.php | 3 +- .../DefaultVoterHelperFactory.php | 4 +- .../DefaultVoterHelperGenerator.php | 4 +- .../Authorization/EntityWorkflowVoter.php | 4 +- .../WorkflowEntityDeletionVoter.php | 4 +- .../PasswordRecover/PasswordRecoverEvent.php | 3 +- .../PasswordRecover/RecoverPasswordHelper.php | 4 +- .../Resolver/CenterResolverDispatcher.php | 4 +- .../Resolver/CenterResolverManager.php | 4 +- .../Resolver/ResolverTwigExtension.php | 4 +- .../Resolver/ScopeResolverDispatcher.php | 4 +- .../Security/UserProvider/UserProvider.php | 4 +- .../Serializer/Model/Collection.php | 4 +- .../Serializer/Model/Counter.php | 4 +- .../Normalizer/AddressNormalizer.php | 4 +- .../Normalizer/CenterNormalizer.php | 4 +- .../CommentEmbeddableDocGenNormalizer.php | 4 +- .../Serializer/Normalizer/DateNormalizer.php | 4 +- .../DoctrineExistingEntityNormalizer.php | 4 +- .../Normalizer/EntityWorkflowNormalizer.php | 4 +- .../EntityWorkflowStepNormalizer.php | 4 +- .../Normalizer/NotificationNormalizer.php | 4 +- .../PrivateCommentEmbeddableNormalizer.php | 4 +- .../Serializer/Normalizer/UserNormalizer.php | 4 +- ...ollateAddressWithReferenceOrPostalCode.php | 3 +- ...ddressWithReferenceOrPostalCodeCronJob.php | 3 +- ...eographicalUnitMaterializedViewCronJob.php | 3 +- .../EntityInfo/ViewEntityInfoManager.php | 3 +- .../AddressReferenceBEFromBestAddress.php | 4 +- .../Import/AddressReferenceBaseImporter.php | 4 +- .../Import/AddressReferenceFromBano.php | 4 +- .../Import/AddressToReferenceMatcher.php | 4 +- .../Import/GeographicalUnitBaseImporter.php | 4 +- .../Import/PostalCodeBEFromBestAddress.php | 4 +- .../Service/Import/PostalCodeBaseImporter.php | 4 +- .../Import/PostalCodeFRFromOpenData.php | 4 +- .../Service/Mailer/ChillMailer.php | 4 +- .../Service/RollingDate/RollingDate.php | 3 +- .../ShortMessage/NullShortMessageSender.php | 4 +- .../Service/ShortMessage/ShortMessage.php | 4 +- .../ShortMessage/ShortMessageHandler.php | 4 +- .../ShortMessage/ShortMessageTransporter.php | 4 +- .../ShortMessageOvh/OvhShortMessageSender.php | 3 +- .../Templating/Entity/AddressRender.php | 4 +- .../Templating/Entity/CommentRender.php | 4 +- .../Templating/Entity/UserRender.php | 4 +- .../FilterOrderGetActiveFilterHelper.php | 3 +- .../Templating/Listing/FilterOrderHelper.php | 3 +- .../Listing/FilterOrderHelperBuilder.php | 4 +- .../Listing/FilterOrderHelperFactory.php | 4 +- .../Templating/Listing/Templating.php | 3 +- .../Templating/TranslatableStringTwig.php | 4 +- .../ChillMainBundle/Test/DummyPaginator.php | 3 +- .../Tests/Cron/CronManagerTest.php | 4 +- .../Tests/Export/ExportManagerTest.php | 18 ++---- .../Tests/Export/SortExportElementTest.php | 24 ++------ .../PasswordRecover/TokenManagerTest.php | 4 +- .../Resolver/DefaultScopeResolverTest.php | 8 +-- .../Resolver/ScopeResolverDispatcherTest.php | 4 +- .../Timeline/TimelineBuilder.php | 4 +- .../Timeline/TimelineSingleQuery.php | 4 +- .../Validator/RoleScopeScopePresence.php | 4 +- .../Validation/Validator/ValidPhonenumber.php | 4 +- .../Counter/WorkflowByUserCounter.php | 4 +- .../Workflow/EntityWorkflowManager.php | 4 +- ...ntityWorkflowTransitionEventSubscriber.php | 4 +- .../NotificationOnTransition.php | 4 +- .../SendAccessKeyEventSubscriber.php | 4 +- .../Exception/HandlerNotFoundException.php | 4 +- .../Workflow/Helper/MetadataExtractor.php | 4 +- .../WorkflowNotificationHandler.php | 4 +- .../WorkflowTwigExtensionRuntime.php | 4 +- .../EntityWorkflowCreationValidator.php | 4 +- .../migrations/Version20100000000000.php | 4 +- .../migrations/Version20220513151853.php | 4 +- .../PersonAddressMoveEventSubscriber.php | 4 +- .../Events/UserRefEventSubscriber.php | 4 +- .../AccompanyingPeriodStepChangeCronjob.php | 3 +- ...mpanyingPeriodStepChangeMessageHandler.php | 3 +- .../AccompanyingPeriodStepChanger.php | 3 +- .../ChillPersonBundle/Actions/ActionEvent.php | 3 +- .../PersonMoveCenterHistoryHandler.php | 3 +- .../Actions/Remove/PersonMove.php | 3 +- .../Actions/Remove/PersonMoveManager.php | 3 +- .../Config/ConfigPersonAltNamesHelper.php | 3 +- .../AccompanyingCourseApiController.php | 4 +- .../AccompanyingCourseCommentController.php | 10 +++- ...CourseWorkEvaluationDocumentController.php | 4 +- ...mpanyingPeriodRegulationListController.php | 4 +- ...nyingPeriodWorkEvaluationApiController.php | 4 +- .../HouseholdCompositionController.php | 3 +- .../Controller/HouseholdController.php | 4 +- .../Controller/HouseholdMemberController.php | 4 +- .../Controller/PersonAddressController.php | 4 +- .../Controller/PersonController.php | 3 +- .../Controller/PersonDuplicateController.php | 4 +- .../Controller/PersonResourceController.php | 4 +- .../ReassignAccompanyingPeriodController.php | 4 +- .../Controller/RelationshipApiController.php | 4 +- .../ResidentialAddressController.php | 4 +- .../SocialWorkEvaluationApiController.php | 4 +- .../SocialWorkGoalApiController.php | 4 +- .../SocialWorkResultApiController.php | 4 +- .../SocialWorkSocialActionApiController.php | 3 +- .../Controller/TimelinePersonController.php | 4 +- .../UserAccompanyingPeriodController.php | 4 +- .../ORM/LoadAccompanyingPeriodWork.php | 4 +- .../DataFixtures/ORM/LoadCustomFields.php | 3 +- .../DataFixtures/ORM/LoadRelationships.php | 4 +- .../ORM/LoadSocialWorkMetadata.php | 4 +- .../Entity/AccompanyingPeriod.php | 2 +- .../AccompanyingPeriodInfo.php | 3 +- .../AccompanyingPeriodWorkReferrerHistory.php | 3 +- .../Entity/AccompanyingPeriod/UserHistory.php | 3 +- .../ChillPersonBundle/Entity/Person.php | 4 +- .../Entity/Person/PersonCenterHistory.php | 3 +- .../Event/Person/PersonAddressMoveEvent.php | 4 +- .../AccompanyingPeriodWorkEventListener.php | 4 +- .../AdministrativeLocationAggregator.php | 4 +- .../ClosingMotiveAggregator.php | 4 +- .../ConfidentialAggregator.php | 4 +- .../CreatorJobAggregator.php | 7 +-- .../DurationAggregator.php | 4 +- .../EmergencyAggregator.php | 4 +- .../EvaluationAggregator.php | 4 +- .../GeographicalUnitStatAggregator.php | 4 +- .../IntensityAggregator.php | 4 +- .../JobWorkingOnCourseAggregator.php | 7 +-- .../PersonParticipatingAggregator.php | 3 +- .../ReferrerAggregator.php | 4 +- .../ReferrerScopeAggregator.php | 7 +-- .../RequestorAggregator.php | 4 +- .../ScopeAggregator.php | 4 +- .../ScopeWorkingOnCourseAggregator.php | 7 +-- .../SocialActionAggregator.php | 4 +- .../SocialIssueAggregator.php | 4 +- .../StepAggregator.php | 4 +- .../UserJobAggregator.php | 7 +-- .../UserWorkingOnCourseAggregator.php | 3 +- .../ByClosingMotiveAggregator.php | 3 +- .../ByStepAggregator.php | 3 +- .../EvaluationTypeAggregator.php | 4 +- .../HavingEndDateAggregator.php | 4 +- .../ChildrenNumberAggregator.php | 4 +- .../CompositionAggregator.php | 4 +- .../PersonAggregators/AgeAggregator.php | 3 +- .../ByHouseholdCompositionAggregator.php | 4 +- .../PersonAggregators/CenterAggregator.php | 3 +- .../CountryOfBirthAggregator.php | 4 +- .../PersonAggregators/GenderAggregator.php | 8 +-- .../GeographicalUnitAggregator.php | 4 +- .../HouseholdPositionAggregator.php | 4 +- .../MaritalStatusAggregator.php | 4 +- .../NationalityAggregator.php | 4 +- .../PostalCodeAggregator.php | 3 +- .../ActionTypeAggregator.php | 4 +- .../CreatorAggregator.php | 7 +-- .../CreatorJobAggregator.php | 7 +-- .../CreatorScopeAggregator.php | 7 +-- .../CurrentActionAggregator.php | 4 +- .../SocialWorkAggregators/GoalAggregator.php | 4 +- .../GoalResultAggregator.php | 4 +- .../HandlingThirdPartyAggregator.php | 4 +- .../SocialWorkAggregators/JobAggregator.php | 7 +-- .../ReferrerAggregator.php | 3 +- .../ResultAggregator.php | 4 +- .../SocialWorkAggregators/ScopeAggregator.php | 7 +-- ...rkPersonAssociatedOnAccompanyingPeriod.php | 4 +- ...vgDurationAPWorkPersonAssociatedOnWork.php | 4 +- .../Export/Export/CountEvaluation.php | 4 +- .../Export/Export/ListAccompanyingPeriod.php | 3 +- ...orkAssociatePersonOnAccompanyingPeriod.php | 3 +- ...panyingPeriodWorkAssociatePersonOnWork.php | 3 +- .../Export/Export/ListEvaluation.php | 3 +- .../Export/Export/ListPersonDuplicate.php | 4 +- ...istPersonWithAccompanyingPeriodDetails.php | 3 +- .../ActiveOnDateFilter.php | 4 +- .../ActiveOneDayBetweenDatesFilter.php | 4 +- .../AdministrativeLocationFilter.php | 4 +- .../ClosingMotiveFilter.php | 4 +- .../ConfidentialFilter.php | 4 +- .../CreatorJobFilter.php | 3 +- .../EmergencyFilter.php | 4 +- .../EvaluationFilter.php | 4 +- .../GeographicalUnitStatFilter.php | 4 +- .../HandlingThirdPartyFilter.php | 3 +- .../HasNoReferrerFilter.php | 4 +- .../HasTemporaryLocationFilter.php | 4 +- ...ccompanyingPeriodInfoWithinDatesFilter.php | 3 +- .../IntensityFilter.php | 4 +- .../JobWorkingOnCourseFilter.php | 3 +- ...tAssociatedWithAReferenceAddressFilter.php | 3 +- .../OpenBetweenDatesFilter.php | 4 +- .../OriginFilter.php | 4 +- .../ReferrerFilter.php | 4 +- .../ReferrerFilterBetweenDates.php | 3 +- .../RequestorFilter.php | 4 +- .../ScopeWorkingOnCourseFilter.php | 3 +- .../SocialActionFilter.php | 3 +- .../StepFilterBetweenDates.php | 4 +- .../StepFilterOnDate.php | 4 +- .../UserJobFilter.php | 3 +- .../UserScopeFilter.php | 3 +- .../UserWorkingOnCourseFilter.php | 3 +- .../ByDateFilter.php | 3 +- .../ByStepFilter.php | 3 +- .../EvaluationFilters/ByEndDateFilter.php | 4 +- .../EvaluationFilters/ByStartDateFilter.php | 4 +- .../EvaluationTypeFilter.php | 4 +- .../EvaluationFilters/MaxDateFilter.php | 4 +- .../HouseholdFilters/CompositionFilter.php | 3 +- .../PersonFilters/AddressRefStatusFilter.php | 4 +- .../Export/Filter/PersonFilters/AgeFilter.php | 4 +- .../Filter/PersonFilters/BirthdateFilter.php | 4 +- .../ByHouseholdCompositionFilter.php | 4 +- .../PersonFilters/DeadOrAliveFilter.php | 4 +- .../Filter/PersonFilters/DeathdateFilter.php | 4 +- .../PersonFilters/GeographicalUnitFilter.php | 4 +- .../PersonFilters/MaritalStatusFilter.php | 4 +- .../PersonFilters/NationalityFilter.php | 4 +- .../ResidentialAddressAtThirdpartyFilter.php | 4 +- .../ResidentialAddressAtUserFilter.php | 4 +- .../WithParticipationBetweenDatesFilter.php | 3 +- .../WithoutHouseholdComposition.php | 4 +- ...yingPeriodWorkEndDateBetweenDateFilter.php | 3 +- ...ngPeriodWorkStartDateBetweenDateFilter.php | 3 +- .../SocialWorkFilters/CreatorJobFilter.php | 3 +- .../SocialWorkFilters/CreatorScopeFilter.php | 3 +- .../Filter/SocialWorkFilters/JobFilter.php | 3 +- .../SocialWorkFilters/ReferrerFilter.php | 4 +- .../Filter/SocialWorkFilters/ScopeFilter.php | 3 +- .../SocialWorkTypeFilter.php | 4 +- .../Export/Helper/LabelPersonHelper.php | 4 +- .../Helper/ListAccompanyingPeriodHelper.php | 3 +- .../Export/Helper/ListPersonHelper.php | 4 +- .../Form/ClosingMotiveType.php | 4 +- .../Form/HouseholdCompositionType.php | 4 +- .../Form/PersonResourceType.php | 4 +- .../Form/SocialWork/SocialIssueType.php | 4 +- .../Form/Type/PersonAltNameType.php | 4 +- .../Form/Type/PersonPhoneType.php | 4 +- .../Form/Type/PickPersonDynamicType.php | 4 +- .../Form/Type/PickSocialActionType.php | 4 +- .../Form/Type/PickSocialIssueType.php | 4 +- .../Form/Type/Select2MaritalStatusType.php | 4 +- .../Household/MembersEditor.php | 3 +- .../Household/MembersEditorFactory.php | 4 +- .../Menu/SectionMenuBuilder.php | 4 +- .../AccompanyingPeriodNotificationHandler.php | 4 +- ...kEvaluationDocumentNotificationHandler.php | 4 +- ...ompanyingPeriodWorkNotificationHandler.php | 4 +- .../AccompanyingPeriodPrivacyEvent.php | 4 +- .../Privacy/PrivacyEvent.php | 4 +- .../AccompanyingPeriodACLAwareRepository.php | 3 +- .../Household/HouseholdACLAwareRepository.php | 4 +- .../Person/PersonCenterHistoryInterface.php | 4 +- .../Repository/PersonACLAwareRepository.php | 8 +-- .../ChillPersonBundle/Search/PersonSearch.php | 4 +- .../Search/SearchHouseholdApiProvider.php | 4 +- .../Search/SearchPersonApiProvider.php | 4 +- .../AccompanyingPeriodCommentVoter.php | 4 +- .../AccompanyingPeriodResourceVoter.php | 4 +- ...nyingPeriodWorkEvaluationDocumentVoter.php | 4 +- .../AccompanyingPeriodWorkEvaluationVoter.php | 4 +- .../AccompanyingPeriodDocGenNormalizer.php | 4 +- .../AccompanyingPeriodResourceNormalizer.php | 4 +- .../AccompanyingPeriodWorkDenormalizer.php | 4 +- ...PeriodWorkEvaluationDocumentNormalizer.php | 4 +- ...mpanyingPeriodWorkEvaluationNormalizer.php | 4 +- .../AccompanyingPeriodWorkNormalizer.php | 4 +- .../Normalizer/MembersEditorNormalizer.php | 4 +- .../Normalizer/PersonDocGenNormalizer.php | 4 +- .../Normalizer/PersonJsonNormalizer.php | 3 +- .../PersonJsonNormalizerInterface.php | 4 +- .../RelationshipDocGenNormalizer.php | 4 +- .../Normalizer/SocialActionNormalizer.php | 4 +- .../Normalizer/SocialIssueNormalizer.php | 4 +- .../Normalizer/WorkflowNormalizer.php | 4 +- .../OldDraftAccompanyingPeriodRemover.php | 4 +- .../AccompanyingPeriodContext.php | 3 +- .../AccompanyingPeriodWorkContext.php | 4 +- ...ccompanyingPeriodWorkEvaluationContext.php | 4 +- .../PersonContextWithThirdParty.php | 3 +- ...companyingPeriodViewEntityInfoProvider.php | 3 +- ...PeriodWorkEvaluationGenericDocProvider.php | 3 +- ...PeriodWorkEvaluationGenericDocRenderer.php | 3 +- .../Service/Import/SocialWorkMetadata.php | 4 +- .../Import/SocialWorkMetadataInterface.php | 4 +- .../Templating/Entity/ClosingMotiveRender.php | 3 +- .../Templating/Entity/PersonRender.php | 4 +- .../Entity/PersonRenderInterface.php | 4 +- .../Templating/Entity/ResourceKindRender.php | 4 +- .../Templating/Entity/SocialActionRender.php | 4 +- .../Templating/Entity/SocialIssueRender.php | 4 +- ...cialIssueConsistencyEntityListenerTest.php | 4 +- .../ConflictTest.php | 4 +- .../Controller/PersonControllerUpdateTest.php | 4 +- .../PersonParticipatingAggregatorTest.php | 4 +- .../ByClosingMotiveAggregatorTest.php | 6 +- .../ByDateAggregatorTest.php | 2 +- .../ByStepAggregatorTest.php | 2 +- ...CountAccompanyingCourseStepHistoryTest.php | 2 +- .../HasTemporaryLocationFilterTest.php | 4 +- ...ociatedWithAReferenceAddressFilterTest.php | 2 +- .../ReferrerFilterBetweenDatesTest.php | 8 +-- .../ByDateFilterTest.php | 4 +- .../ByStepFilterTest.php | 2 +- ...ithParticipationBetweenDatesFilterTest.php | 4 +- .../AbstractTimelineAccompanyingPeriod.php | 4 +- .../AccompanyingPeriodValidityValidator.php | 4 +- .../LocationValidityValidator.php | 4 +- .../ParticipationOverlapValidator.php | 4 +- .../ResourceDuplicateCheckValidator.php | 4 +- ...HouseholdMembershipSequentialValidator.php | 4 +- .../RelationshipNoDuplicateValidator.php | 4 +- .../Widget/PersonListWidget.php | 4 +- ...dWorkEvaluationDocumentWorkflowHandler.php | 4 +- ...ingPeriodWorkEvaluationWorkflowHandler.php | 4 +- .../AccompanyingPeriodWorkWorkflowHandler.php | 4 +- .../migrations/Version20160422000000.php | 4 +- .../migrations/Version20210419112619.php | 4 +- .../migrations/Version20231121070151.php | 4 +- .../ChillReportBundle/ChillReportBundle.php | 4 +- .../Controller/ReportController.php | 3 +- .../Export/Export/ReportList.php | 4 +- .../Export/Filter/ReportDateFilter.php | 4 +- .../Authorization/ReportVoterTest.php | 4 +- .../Timeline/TimelineReportProvider.php | 4 +- .../Controller/SingleTaskController.php | 3 +- .../ChillTaskBundle/Form/SingleTaskType.php | 4 +- .../Repository/AbstractTaskRepository.php | 4 +- .../Repository/RecurringTaskRepository.php | 4 +- .../SingleTaskAclAwareRepository.php | 4 +- .../Repository/SingleTaskStateRepository.php | 3 +- .../Authorization/AuthorizationEvent.php | 3 +- .../Tests/Controller/TaskControllerTest.php | 4 +- .../TaskLifeCycleEventTimelineProvider.php | 4 +- .../Workflow/TaskWorkflowDefinition.php | 4 +- .../Export/Helper/LabelThirdPartyHelper.php | 4 +- .../Type/PickThirdPartyTypeCategoryType.php | 4 +- .../Form/Type/PickThirdpartyDynamicType.php | 4 +- .../ThirdPartyACLAwareRepository.php | 4 +- .../Search/ThirdPartyApiSearch.php | 8 +-- .../Normalizer/ThirdPartyNormalizer.php | 4 +- .../Templating/Entity/ThirdPartyRender.php | 4 +- .../ChillWopiBundle/src/ChillWopiBundle.php | 4 +- .../ChillWopiBundle/src/Controller/Editor.php | 4 +- .../src/Service/Controller/Responder.php | 4 +- .../src/Service/Wopi/AuthorizationManager.php | 4 +- .../Service/Wopi/ChillDocumentLockManager.php | 3 +- .../src/Service/Wopi/ChillWopi.php | 4 +- .../src/Service/Wopi/UserManager.php | 4 +- ...aultDataOnExportFilterAggregatorRector.php | 3 +- 664 files changed, 795 insertions(+), 1980 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php index 5f872a7dc..a85ddbb75 100644 --- a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php +++ b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php @@ -13,6 +13,4 @@ namespace Chill\ActivityBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillActivityBundle extends Bundle -{ -} +class ChillActivityBundle extends Bundle {} diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index c34e4b3a9..9407aecbe 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -36,7 +36,6 @@ 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; diff --git a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php index fd9899c0b..31fac3be8 100644 --- a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php +++ b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php @@ -19,9 +19,7 @@ use Doctrine\ORM\EntityManagerInterface; class ActivityEntityListener { - public function __construct(private readonly EntityManagerInterface $em, private readonly AccompanyingPeriodWorkRepository $workRepository) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly AccompanyingPeriodWorkRepository $workRepository) {} public function persistActionToCourse(Activity $activity) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php index 0f41547d9..0097854d3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php @@ -31,8 +31,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface private RollingDateConverterInterface $rollingDateConverter, private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 157f4c023..9282f92e4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialActionAggregator implements AggregatorInterface { - public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) - { - } + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 94f6506d1..bbdadf4d6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialIssueAggregator implements AggregatorInterface { - public function __construct(private readonly SocialIssueRepository $issueRepository, private readonly SocialIssueRender $issueRender) - { - } + public function __construct(private readonly SocialIssueRepository $issueRepository, private readonly SocialIssueRender $issueRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php index 392ff5b19..56a6d0249 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php @@ -20,13 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ActivityPresenceAggregator implements AggregatorInterface { - public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private TranslatableStringHelperInterface $translatableStringHelper) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index 9945fd80a..33090f297 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -29,8 +29,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index d433e6a86..dbdc982b6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -22,9 +22,7 @@ class ActivityTypeAggregator implements AggregatorInterface { final public const KEY = 'activity_type_aggregator'; - public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 46b931243..61452af22 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -22,9 +22,7 @@ class ActivityUserAggregator implements AggregatorInterface { final public const KEY = 'activity_user_id'; - public function __construct(private readonly UserRepository $userRepository, private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRepository $userRepository, private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php index c8ef24332..cc4ab9d14 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersAggregator implements AggregatorInterface { - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php index 591406d59..3628206ec 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php @@ -27,8 +27,7 @@ class ActivityUsersJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ class ActivityUsersJobAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php index c5d9175b4..bffce629f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php @@ -27,8 +27,7 @@ class ActivityUsersScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ class ActivityUsersScopeAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php index 4e8ec44b0..09bdab89e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorAggregator implements AggregatorInterface { - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php index 15762a4f0..13224bade 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByThirdpartyAggregator implements AggregatorInterface { - public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender) - { - } + public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php index 98960aec6..d57670e7f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php @@ -27,8 +27,7 @@ class CreatorJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ class CreatorJobAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php index f1fb4b2b6..6641f0807 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php @@ -27,8 +27,7 @@ class CreatorScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepository $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ class CreatorScopeAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php index 69c8a646c..da2d74f64 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class LocationTypeAggregator implements AggregatorInterface { - public function __construct(private readonly LocationTypeRepository $locationTypeRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly LocationTypeRepository $locationTypeRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php index 96c330071..c7a3bd6b5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php @@ -19,9 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class PersonAggregator implements AggregatorInterface { - public function __construct(private LabelPersonHelper $labelPersonHelper) - { - } + public function __construct(private LabelPersonHelper $labelPersonHelper) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php index 18ca489e4..8459741c5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php @@ -25,9 +25,7 @@ final readonly class PersonsAggregator implements AggregatorInterface { private const PREFIX = 'act_persons_agg'; - public function __construct(private LabelPersonHelper $labelPersonHelper) - { - } + public function __construct(private LabelPersonHelper $labelPersonHelper) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php index ec436ef61..774968544 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SentReceivedAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 96fdfa095..d8b204e8c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -36,9 +36,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 6497a232a..dfd5d966f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -41,9 +41,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php index fc22c8edd..41c05494c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php @@ -42,9 +42,7 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php index 26432fc0b..c49b9d4ad 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php @@ -41,9 +41,7 @@ class CountPersonsOnActivity implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index fc9a44889..aab2d7db8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -31,8 +31,7 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 7614039b0..e0a95b1f5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -33,9 +33,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php index 46466d883..31111a083 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php @@ -34,9 +34,7 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 491d1c094..3cdadac67 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -47,9 +47,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index 73b49e082..75d2c3fd0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -40,8 +40,7 @@ class ListActivityHelper private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatableStringExportLabelHelper $translatableStringLabelHelper, private readonly UserHelper $userHelper - ) { - } + ) {} public function addSelect(QueryBuilder $qb): void { @@ -75,9 +74,7 @@ class ListActivityHelper ->addGroupBy('location.id'); } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php index 89fe2e618..7c6eb0bb2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php @@ -31,8 +31,7 @@ final readonly class ActivityTypeFilter implements FilterInterface private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index 3eb4e130e..13349baa5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialActionFilter implements FilterInterface { - public function __construct(private readonly SocialActionRender $actionRender) - { - } + public function __construct(private readonly SocialActionRender $actionRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index b482ac156..bef40290e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialIssueFilter implements FilterInterface { - public function __construct(private readonly SocialIssueRender $issueRender) - { - } + public function __construct(private readonly SocialIssueRender $issueRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php index 77efa9a8b..2d3282ad1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php @@ -23,8 +23,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 93e70076d..e3d7796d3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ActivityDateFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(protected TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php index f1f1a668c..201b9f810 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php @@ -26,8 +26,7 @@ final readonly class ActivityPresenceFilter implements FilterInterface public function __construct( private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index b59dfa301..ae47146df 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -27,8 +27,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function __construct( protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php index 313ee7cbc..56285c026 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php index 8cb7db569..f75c5a817 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php index 6ce340874..4288920e9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php @@ -32,8 +32,7 @@ final readonly class CreatorJobFilter implements FilterInterface private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator, private UserJobRepositoryInterface $userJobRepository, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php index a6ab07ade..e5da96554 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php @@ -27,8 +27,7 @@ class CreatorScopeFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php index eca62b79e..b74be2552 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php @@ -28,9 +28,7 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php index 144e79913..771dfca30 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class LocationTypeFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index 5e2ee5cbe..b8ce3259f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -26,9 +26,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) - { - } + public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index c424bec31..eb2312c0e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -32,8 +32,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem private TranslatableStringHelper $translatableStringHelper, private ActivityReasonRepository $activityReasonRepository, private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php index 51dd60855..8bdefeb24 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php @@ -26,9 +26,7 @@ final readonly class PersonsFilter implements FilterInterface { private const PREFIX = 'act_persons_filter'; - public function __construct(private PersonRenderInterface $personRender) - { - } + public function __construct(private PersonRenderInterface $personRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php index 6eee28790..3011627e8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php @@ -29,9 +29,7 @@ class SentReceivedFilter implements FilterInterface private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php index 54fb87b81..6e6b745b9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class UserFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index ae21482fc..23bd4f84c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -28,8 +28,7 @@ class UsersJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php index 61a813dc0..4ce9c845a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php @@ -30,8 +30,7 @@ class UsersScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index b4baa2f54..8e8ae51f7 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -25,9 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ActivityTypeType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php index 009d7b29f..be1e372f1 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php @@ -28,8 +28,7 @@ class PickActivityReasonType extends AbstractType private readonly ActivityReasonRepository $activityReasonRepository, private readonly ActivityReasonRender $reasonRender, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php index d94ac34e1..ee1417bfb 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class TranslatableActivityReasonCategoryType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php index e2233f3b1..5c77e500d 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php @@ -20,9 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class TranslatableActivityType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) - { - } + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php index bae2b0577..b4990c0e3 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected Security $security, protected TranslatorInterface $translator) - { - } + public function __construct(protected Security $security, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 8337a3582..0afe11cfc 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -20,9 +20,7 @@ use Symfony\Component\Security\Core\Security; */ final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security) - { - } + public function __construct(private Security $security) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php index 180247808..797d64eb6 100644 --- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final readonly class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator) - { - } + public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php index 55b831d8b..8eb219fd2 100644 --- a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php +++ b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php @@ -18,9 +18,7 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface; final readonly class ActivityNotificationHandler implements NotificationHandlerInterface { - public function __construct(private ActivityRepository $activityRepository) - { - } + public function __construct(private ActivityRepository $activityRepository) {} public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 1f50f7d62..231ad5432 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -44,8 +44,7 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos private EntityManagerInterface $em, private Security $security, private RequestStack $requestStack, - ) { - } + ) {} /** * @throws NonUniqueResultException diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php index 0623601a5..c0fd359f1 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php @@ -33,8 +33,7 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum private CenterResolverManagerInterface $centerResolverManager, private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private Security $security - ) { - } + ) {} public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 6c3675011..46e466ae1 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -51,8 +51,7 @@ class ActivityContext implements private readonly BaseContextData $baseContextData, private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository - ) { - } + ) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index 33675754a..221d1f4b2 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -56,8 +56,7 @@ class ListActivitiesByAccompanyingPeriodContext implements private readonly ThirdPartyRepository $thirdPartyRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly UserRepository $userRepository - ) { - } + ) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php index 291ef5832..d29e08ef5 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php @@ -34,8 +34,7 @@ final readonly class AccompanyingPeriodActivityGenericDocProvider implements Gen private EntityManagerInterface $em, private Security $security, private ActivityDocumentACLAwareRepositoryInterface $activityDocumentACLAwareRepository, - ) { - } + ) {} public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php index 618775452..d553afbb2 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php @@ -25,8 +25,7 @@ final readonly class PersonActivityGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private ActivityDocumentACLAwareRepositoryInterface $personActivityDocumentACLAwareRepository, - ) { - } + ) {} public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php index 76f0fc00d..93649cea8 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php @@ -20,9 +20,7 @@ use Chill\DocStoreBundle\Repository\StoredObjectRepository; final readonly class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface { - public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository) - { - } + public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository) {} public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php b/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php index 6917517b7..b0951e502 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php +++ b/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php @@ -13,6 +13,4 @@ namespace Chill\AsideActivityBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillAsideActivityBundle extends Bundle -{ -} +class ChillAsideActivityBundle extends Bundle {} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 1b1843d50..ffeab7630 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -14,28 +14,32 @@ namespace Chill\AsideActivityBundle\Controller; use Chill\AsideActivityBundle\Entity\AsideActivity; use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository; use Chill\MainBundle\CRUD\Controller\CRUDController; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Pagination\PaginatorInterface; -use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\Security\Core\Security; final class AsideActivityController extends CRUDController { - public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository) - { - } + public function __construct( + private readonly AsideActivityCategoryRepository $categoryRepository, + private readonly Security $security + ) {} public function createEntity(string $action, Request $request): object { - if (!$this->security->isGranted('ROLE_USER')) { + $user = $this->security->getUser(); + + if (!$this->security->isGranted('ROLE_USER') || !$user instanceof User) { throw new AccessDeniedHttpException(); } $asideActivity = new AsideActivity(); - $asideActivity->setAgent($this->security->getUser()); - $asideActivity->setLocation($this->security->getUser()->getCurrentLocation()); + $asideActivity->setAgent($user); + $asideActivity->setLocation($user->getCurrentLocation()); $duration = $request->query->get('duration', '300'); $duration = \DateTime::createFromFormat('U', $duration); diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php index 7bc6b774f..12c82be00 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php @@ -20,9 +20,7 @@ use Doctrine\Persistence\ObjectManager; class LoadAsideActivity extends Fixture implements DependentFixtureInterface { - public function __construct(private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly UserRepository $userRepository) {} public function getDependencies(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php index 43b702f5c..4271ae118 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php @@ -23,8 +23,7 @@ class ByActivityTypeAggregator implements AggregatorInterface public function __construct( private readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php index 095d20acb..b5ca1022b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php @@ -19,9 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByLocationAggregator implements AggregatorInterface { - public function __construct(private readonly LocationRepository $locationRepository) - { - } + public function __construct(private readonly LocationRepository $locationRepository) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php index 94d946907..c3883b18a 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php @@ -27,8 +27,7 @@ class ByUserJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ class ByUserJobAggregator implements AggregatorInterface return Declarations::ASIDE_ACTIVITY_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php index 90e4ee615..a99d2b75f 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php @@ -27,8 +27,7 @@ class ByUserScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -65,9 +64,7 @@ class ByUserScopeAggregator implements AggregatorInterface return Declarations::ASIDE_ACTIVITY_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php index f4afd9181..70922b6ae 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php @@ -22,13 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) - { - } + public function __construct(private readonly AsideActivityRepository $repository) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php index b8f3101b7..6d1eed5fe 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php @@ -22,13 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class CountAsideActivity implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) - { - } + public function __construct(private readonly AsideActivityRepository $repository) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index 37519b559..33155c62f 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -42,12 +42,9 @@ final readonly class ListAsideActivity implements ListInterface, GroupedExportIn private CategoryRender $categoryRender, private LocationRepository $locationRepository, private TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php index 872d7305c..0fd318902 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php @@ -22,13 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) - { - } + public function __construct(private readonly AsideActivityRepository $repository) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php index 7c1f4348c..708b12ef1 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php @@ -28,8 +28,7 @@ class ByActivityTypeFilter implements FilterInterface private readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly AsideActivityCategoryRepository $asideActivityTypeRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php index 703190f74..b8d77d942 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php @@ -22,9 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ByDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php index 20e8c46f8..6de002606 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php @@ -25,8 +25,7 @@ final readonly class ByLocationFilter implements FilterInterface { public function __construct( private Security $security - ) { - } + ) {} public function getTitle(): string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index e39633914..8dd1a8eac 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php index 2418f5428..d7255d9fa 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php @@ -28,8 +28,7 @@ class ByUserJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php index fd0511e33..8f8d50462 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php @@ -30,8 +30,7 @@ class ByUserScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index c285f0f9b..3a69be137 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { - public function __construct(private readonly CategoryRender $categoryRender) - { - } + public function __construct(private readonly CategoryRender $categoryRender) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php index 8341d8595..23923fb6c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php @@ -20,9 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class PickAsideActivityCategoryType extends AbstractType { - public function __construct(private readonly CategoryRender $categoryRender) - { - } + public function __construct(private readonly CategoryRender $categoryRender) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php index d0a593dab..43a37e068 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -16,9 +16,7 @@ use Symfony\Component\Security\Core\Security; final readonly class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface { - public function __construct(private Security $security) - { - } + public function __construct(private Security $security) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index 0646a8613..a32d52303 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php @@ -21,9 +21,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SectionMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker) - { - } + public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index db8995087..2598c4e01 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -26,9 +26,7 @@ final readonly class CategoryRender implements ChillEntityRenderInterface public const SEPERATOR_KEY = 'default.separator'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) - { - } + public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) {} public function buildParents(AsideActivityCategory $asideActivityCategory) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php index 7167ca307..d293907f5 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php @@ -15,6 +15,7 @@ use Chill\BudgetBundle\Entity\AbstractElement; use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter; use Chill\PersonBundle\Entity\Person; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\Persistence\ManagerRegistry; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; @@ -25,9 +26,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; abstract class AbstractElementController extends AbstractController { - public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger) - { - } + public function __construct( + protected EntityManagerInterface $em, + protected TranslatorInterface $translator, + protected LoggerInterface $chillMainLogger, + protected ManagerRegistry $managerRegistry, + ) {} /** * Route( diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index 468576673..26acbf8a5 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -21,9 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class ElementController extends AbstractController { - public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) - { - } + public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {} /** * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index") diff --git a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php index c2f2e4b67..2d219b62a 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php @@ -27,9 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ChargeType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator) - { - } + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php index 3896b0dd8..ba93f1080 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php @@ -26,9 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ResourceType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator) - { - } + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php index 805ad865d..b8b4b617c 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Security; final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security) - { - } + public function __construct(private Security $security) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php index c5d19262d..94583b439 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php @@ -20,9 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) - { - } + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php index 97b10c72b..25bd6a218 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php @@ -20,9 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) - { - } + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php index acac8a504..a57f7fb29 100644 --- a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php +++ b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php @@ -34,9 +34,7 @@ final readonly class SummaryBudget implements SummaryBudgetInterface private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id'; - public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository) - { - } + public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository) {} public function getSummaryForHousehold(?Household $household): array { diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index c8fa90475..26871b0f4 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -21,9 +21,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ final readonly class BudgetElementTypeRender implements ChillEntityRenderInterface { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private \Twig\Environment $engine) - { - } + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private \Twig\Environment $engine) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index 96344103f..1729c215b 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -23,9 +23,7 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarAPIController extends ApiController { - public function __construct(private readonly CalendarRepository $calendarRepository) - { - } + public function __construct(private readonly CalendarRepository $calendarRepository) {} /** * @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}", diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index 6bc3245e3..d0f5e623d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -35,8 +35,7 @@ final readonly class CalendarDocController private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator, - ) { - } + ) {} /** * @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new") diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 2bdf393f8..459d8f6aa 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -23,9 +23,7 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarRangeAPIController extends ApiController { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) - { - } + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {} /** * @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}", diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 16950b29e..784a6f6ce 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -34,9 +34,7 @@ use Symfony\Component\Security\Core\Security; class InviteApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) {} /** * Give an answer to a calendar invite. diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index a8339137a..75b417e93 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -30,9 +30,7 @@ use TheNetworg\OAuth2\Client\Token\AccessToken; class RemoteCalendarConnectAzureController { - public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) - { - } + public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {} /** * @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure") diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index 1582a8a2d..e7d423abd 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -27,9 +27,7 @@ use Symfony\Component\Routing\Annotation\Route; class RemoteCalendarMSGraphSyncController { - public function __construct(private readonly MessageBusInterface $messageBus) - { - } + public function __construct(private readonly MessageBusInterface $messageBus) {} /** * @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events", diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index eee828884..673912c0a 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -34,9 +34,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class RemoteCalendarProxyController { - public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) - { - } + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {} /** * @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events") diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php index 71277cd8a..f222823bf 100644 --- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php @@ -28,9 +28,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere { public static array $references = []; - public function __construct(private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly UserRepository $userRepository) {} public static function getGroups(): array { diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index 6fd29f82b..79629bfbb 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -17,9 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack; class ListenToActivityCreate { - public function __construct(private readonly RequestStack $requestStack) - { - } + public function __construct(private readonly RequestStack $requestStack) {} public function postPersist(Activity $activity, LifecycleEventArgs $event): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index 43354207c..5e2091fac 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class AgentAggregator implements AggregatorInterface { - public function __construct(private UserRepository $userRepository, private UserRender $userRender) - { - } + public function __construct(private UserRepository $userRepository, private UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 7fe83726c..7c84653d2 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CancelReasonAggregator implements AggregatorInterface { - public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index 1d1c4dca9..76cbe5cd8 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -27,8 +27,7 @@ final readonly class JobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ final readonly class JobAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index aca3e654b..6481f95b4 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -19,9 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class LocationAggregator implements AggregatorInterface { - public function __construct(private LocationRepository $locationRepository) - { - } + public function __construct(private LocationRepository $locationRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 1f49ff723..be9406cfa 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class LocationTypeAggregator implements AggregatorInterface { - public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index d298e63a4..4998f6d1f 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -27,8 +27,7 @@ final readonly class ScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -66,9 +65,7 @@ final readonly class ScopeAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index 47801add3..e9213d3cb 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -26,9 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UrgencyAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index 9e7c5e367..f643eaa68 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -27,8 +27,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface { public function __construct( private readonly CalendarRepository $calendarRepository, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php index f7f19d1e4..b69185a17 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php @@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly CalendarRepository $calendarRepository) - { - } + public function __construct(private readonly CalendarRepository $calendarRepository) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php index e9920444a..8ea23014c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php @@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly CalendarRepository $calendarRepository) - { - } + public function __construct(private readonly CalendarRepository $calendarRepository) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index 888ee4363..c16c148fc 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AgentFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index 1fe9eadc5..90a004388 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index e493ce0bf..63149509f 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -34,9 +34,7 @@ class CalendarRangeFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 6b81a709f..c122a298d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -27,8 +27,7 @@ final readonly class JobFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index ef7c14199..93edc1b3a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -29,8 +29,7 @@ class ScopeFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index b83bb992d..eec0b3f9f 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -38,8 +38,7 @@ class CalendarType extends AbstractType private readonly IdToLocationDataTransformer $idToLocationDataTransformer, private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php index 3997c4dad..6dd5bfa52 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, protected TranslatorInterface $translator) - { - } + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php index c7bbc756c..e92a72bb7 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, protected TranslatorInterface $translator) - { - } + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php index 90b94b08e..3a062f7b8 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php @@ -18,9 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, public TranslatorInterface $translator) - { - } + public function __construct(private readonly Security $security, public TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php index d0feca3d8..8f62fdcdb 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php @@ -29,9 +29,7 @@ use Symfony\Component\Security\Core\Security; class CalendarEntityListener { - public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) - { - } + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {} public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php index cc3bf649e..8b875bdcb 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php @@ -29,9 +29,7 @@ use Symfony\Component\Security\Core\Security; class CalendarRangeEntityListener { - public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) - { - } + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {} public function postPersist(CalendarRange $calendarRange, PostPersistEventArgs $eventArgs): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php index c55bd8144..7749d503c 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php @@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) {} public function __invoke(CalendarRangeRemovedMessage $calendarRangeRemovedMessage) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php index 950ca526d..c9fd1b939 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php @@ -32,9 +32,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) {} public function __invoke(CalendarRangeMessage $calendarRangeMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php index 6838d3147..73e8a0c37 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php @@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRemoveHandler implements MessageHandlerInterface { - public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) - { - } + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) {} public function __invoke(CalendarRemovedMessage $message) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php index 310e8734b..6a1388d2e 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php @@ -37,9 +37,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) {} public function __invoke(CalendarMessage $calendarMessage) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php index 1d987c19e..7ca5f2c12 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php @@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class InviteUpdateHandler implements MessageHandlerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) {} public function __invoke(InviteUpdateMessage $inviteUpdateMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php index 26908a6e4..7a67bee61 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php @@ -36,9 +36,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class MSGraphChangeNotificationHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) {} public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php index 682369e03..15b8c6733 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php @@ -20,9 +20,7 @@ namespace Chill\CalendarBundle\Messenger\Message; class MSGraphChangeNotificationMessage { - public function __construct(private readonly array $content, private readonly int $userId) - { - } + public function __construct(private readonly array $content, private readonly int $userId) {} public function getContent(): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php index 2764a46e3..2535e23ca 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php @@ -24,9 +24,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; class AddressConverter { - public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function addressToRemote(Address $address): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php index f3d764acc..080140d86 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php @@ -28,9 +28,7 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; */ class EventsOnUserSubscriptionCreator { - public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) - { - } + public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) {} /** * @return array{secret: string, id: string, expiration: int} diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php index cbf97806e..f14683b9e 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php @@ -22,9 +22,7 @@ use Chill\MainBundle\Entity\Location; class LocationConverter { - public function __construct(private readonly AddressConverter $addressConverter) - { - } + public function __construct(private readonly AddressConverter $addressConverter) {} public function locationToRemote(Location $location): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php index 58cd04dfa..64a86cccc 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php @@ -27,8 +27,7 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface private HttpClientInterface $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private ClockInterface $clock, - ) { - } + ) {} /** * @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php index 1d7b181f3..318580ffc 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php @@ -21,8 +21,7 @@ readonly class MSUserAbsenceSync private MSUserAbsenceReaderInterface $absenceReader, private ClockInterface $clock, private LoggerInterface $logger, - ) { - } + ) {} public function syncUserAbsence(User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php index f5d25caaf..f2a0fc096 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php @@ -29,9 +29,7 @@ class MachineTokenStorage private ?AccessTokenInterface $accessToken = null; - public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) - { - } + public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) {} public function getToken(): AccessTokenInterface { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index aa3b1c4a4..5577adc2e 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -36,9 +36,7 @@ class MapCalendarToUser final public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret'; - public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) {} public function getActiveSubscriptionId(User $user): string { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php index cc5b72b42..d8fff109b 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php @@ -29,9 +29,7 @@ class OnBehalfOfUserTokenStorage { final public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token'; - public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) - { - } + public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) {} public function getToken(): AccessToken { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php index 0c9621aeb..1dffe198c 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php @@ -32,9 +32,7 @@ class CalendarRangeSyncer /** * @param MachineHttpClient $machineHttpClient */ - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) {} public function handleCalendarRangeSync(CalendarRange $calendarRange, array $notification, User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php index 06e0f2b39..9b4daf626 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php @@ -29,9 +29,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class CalendarSyncer { - public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) - { - } + public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) {} public function handleCalendarSync(Calendar $calendar, array $notification, User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 27297f3ac..a85de21d3 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -41,9 +41,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface { private array $cacheScheduleTimeForUser = []; - public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) - { - } + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) {} public function countEventsForUser(User $user, \DateTimeImmutable $startDate, \DateTimeImmutable $endDate): int { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php index 7da67df0c..61e57631d 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php @@ -46,23 +46,13 @@ class NullRemoteCalendarConnector implements RemoteCalendarConnectorInterface return []; } - public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void - { - } + public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void {} - public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void - { - } + public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void {} - public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void - { - } + public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void {} - public function syncCalendarRange(CalendarRange $calendarRange): void - { - } + public function syncCalendarRange(CalendarRange $calendarRange): void {} - public function syncInvite(Invite $invite): void - { - } + public function syncInvite(Invite $invite): void {} } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php index 0c87ae4eb..40d1d1435 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php @@ -44,6 +44,5 @@ class RemoteEvent * @Serializer\Groups({"read"}) */ public bool $isAllDay = false - ) { - } + ) {} } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php index a3350a7cd..8f661a881 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php @@ -28,9 +28,7 @@ use Doctrine\ORM\QueryBuilder; class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) {} public function buildQueryByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate): QueryBuilder { diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php index 5eaa85871..a0e653cb1 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php @@ -27,9 +27,7 @@ class CalendarDocVoter extends Voter 'CHILL_CALENDAR_DOC_SEE', ]; - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} protected function supports($attribute, $subject): bool { diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index 27cfb05e6..087f5ea86 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -41,8 +41,7 @@ final readonly class CalendarContext implements CalendarContextInterface private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper - ) { - } + ) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php index 917a0b5fa..09a333f3f 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php @@ -19,6 +19,4 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; * @extends DocGeneratorContextWithPublicFormInterface * @extends DocGeneratorContextWithAdminFormInterface */ -interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface -{ -} +interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface {} diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index faca60a67..7d4544b37 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -38,8 +38,7 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen public function __construct( private Security $security, private EntityManagerInterface $em - ) { - } + ) {} /** * @throws MappingException diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php index f088e27ba..5ca52744b 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php @@ -37,8 +37,7 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private EntityManagerInterface $em - ) { - } + ) {} private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php index 1f4c3a45f..123afc164 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php @@ -19,9 +19,7 @@ use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface; final readonly class AccompanyingPeriodCalendarGenericDocRenderer implements GenericDocRendererInterface { - public function __construct(private CalendarDocRepository $repository) - { - } + public function __construct(private CalendarDocRepository $repository) {} public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php index b03a023d8..9a4a92a94 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php @@ -25,9 +25,7 @@ use Symfony\Component\Messenger\MessageBusInterface; class BulkCalendarShortMessageSender { - public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) - { - } + public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) {} public function sendBulkMessageToEligibleCalendars() { diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php index 85bc74efc..31b870ed4 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php @@ -24,9 +24,7 @@ use Doctrine\ORM\EntityManagerInterface; class CalendarForShortMessageProvider { - public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) - { - } + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) {} /** * Generate calendars instance. diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php index 6c402ffe3..880c9950f 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php @@ -23,9 +23,7 @@ use Chill\MainBundle\Service\ShortMessage\ShortMessage; class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface { - public function __construct(private readonly \Twig\Environment $engine) - { - } + public function __construct(private readonly \Twig\Environment $engine) {} public function buildMessageForCalendar(Calendar $calendar): array { diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index e5d19f9a3..2bb381d8b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -14,6 +14,7 @@ namespace Chill\CustomFieldsBundle\Controller; use Chill\CustomFieldsBundle\Entity\CustomField; use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup; use Chill\CustomFieldsBundle\Form\CustomFieldType; +use Symfony\Bridge\Doctrine\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -25,9 +26,10 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class CustomFieldController extends AbstractController { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct( + private readonly TranslatorInterface $translator, + private readonly ManagerRegistry $managerRegistry, + ) {} /** * Creates a new CustomField entity. diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index b57b45bc9..a54e4c21f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -43,8 +43,7 @@ class CustomFieldChoice extends AbstractCustomField * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function allowOtherChoice(CustomField $cf) { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php index ecc97fbcc..dac447930 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php @@ -45,8 +45,7 @@ class CustomFieldDate extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php index ff89c04d2..7ba5cff74 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php @@ -52,7 +52,7 @@ interface CustomFieldInterface * * @param mixed $value the value passed throug the deserialize function */ - public function isEmptyValue($value, CustomField $customField); + public function isEmptyValue(mixed $value, CustomField $customField); /** * Return a repsentation of the value of the CustomField. @@ -62,7 +62,7 @@ interface CustomFieldInterface * * @return string an html representation of the value */ - public function render($value, CustomField $customField, $documentType = 'html'); + public function render(mixed $value, CustomField $customField, $documentType = 'html'); /** * Transform the value into a format that can be stored in DB. diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index b524eca5d..54d63b978 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -28,8 +28,7 @@ class CustomFieldLongChoice extends AbstractCustomField private readonly OptionRepository $optionRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $templating, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php index 27dfce42c..e083b9b80 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php @@ -42,8 +42,7 @@ class CustomFieldNumber extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index 6e9a3df0e..17d8e95e7 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -29,8 +29,7 @@ class CustomFieldText extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} /** * Create a form according to the maxLength option. diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php index 07a0a0121..302e04350 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php @@ -32,8 +32,7 @@ class CustomFieldTitle extends AbstractCustomField * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php index f7ffdc465..23a7ed975 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php @@ -30,9 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CustomFieldType extends AbstractType { - public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php index 5bb16c80d..8cf3ea182 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php @@ -27,8 +27,7 @@ class CustomFieldsGroupType extends AbstractType private readonly array $customizableEntities, // TODO : add comment about this variable private readonly TranslatorInterface $translator - ) { - } + ) {} // TODO : details about the function public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php index 3091ea66f..ee5f8b386 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php @@ -17,9 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface; class CustomFieldDataTransformer implements DataTransformerInterface { - public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) - { - } + public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) {} public function reverseTransform($value) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index cd33068a9..180ac0a8a 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -18,9 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class CustomFieldsGroupToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly ObjectManager $om) - { - } + public function __construct(private readonly ObjectManager $om) {} /** * Transforms a string (id) to an object (CustomFieldsGroup). diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php index fa462737e..5d5377a15 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php @@ -16,9 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CustomFieldsTitleType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { - } + public function buildForm(FormBuilderInterface $builder, array $options) {} public function getBlockPrefix() { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php index 25418e5c4..8f6e896bf 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php @@ -42,9 +42,7 @@ class LinkedCustomFieldsType extends AbstractType */ private array $options = []; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} /** * append Choice on POST_SET_DATA event. diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php index e684899b4..320f36544 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php +++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php @@ -29,9 +29,7 @@ class CustomFieldsHelper * @param CustomFieldProvider $provider The customfield provider that * contains all the declared custom fields */ - public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) {} public function isEmptyValue(array $fields, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php index 62181de74..6d3d889a8 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php @@ -31,9 +31,7 @@ class CustomFieldRenderingTwig extends AbstractExtension 'label_layout' => '@ChillCustomFields/CustomField/render_label.html.twig', ]; - public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) - { - } + public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) {} /** * (non-PHPdoc). diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php index 95419e001..afcf6fab1 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php @@ -19,9 +19,7 @@ final readonly class ContextManager implements ContextManagerInterface /** * @param \Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface[] $contexts */ - public function __construct(private iterable $contexts) - { - } + public function __construct(private iterable $contexts) {} public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface { diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index ebce55957..ecb896080 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -22,9 +22,7 @@ use Symfony\Component\Routing\Annotation\Route; class AdminDocGeneratorTemplateController extends CRUDController { - public function __construct(private readonly ContextManager $contextManager) - { - } + public function __construct(private readonly ContextManager $contextManager) {} public function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php index 8f698cb97..1b87ef926 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php +++ b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php @@ -24,9 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class DocGeneratorTemplateType extends AbstractType { - public function __construct(private readonly ContextManager $contextManager) - { - } + public function __construct(private readonly ContextManager $contextManager) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php index a021e1495..8796b8e39 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php @@ -18,9 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security) - { - } + public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php index 79cf47be5..0ac47be61 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php @@ -16,9 +16,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class NormalizeNullValueHelper { - public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) - { - } + public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) {} public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ?ClassMetadataInterface $classMetadata = null) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index 2773d3816..d888158dd 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -17,9 +17,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BaseContextData { - public function __construct(private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly NormalizerInterface $normalizer) {} public function getData(?User $user = null): array { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 6c9a6f219..5931899a3 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -27,9 +27,7 @@ class Generator implements GeneratorInterface { private const LOG_PREFIX = '[docgen generator] '; - public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager) - { - } + public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager) {} /** * @template T of File|null diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php index 57006cb9d..b9c29aff9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php @@ -28,9 +28,7 @@ final readonly class OnGenerationFails implements EventSubscriberInterface { public const LOG_PREFIX = '[docgen failed] '; - public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private MailerInterface $mailer, private StoredObjectRepository $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) - { - } + public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private MailerInterface $mailer, private StoredObjectRepository $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) {} public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index 4ec59d9d4..f6723c617 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -30,9 +30,7 @@ class RequestGenerationHandler implements MessageHandlerInterface private const LOG_PREFIX = '[docgen message handler] '; - public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository) - { - } + public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository) {} public function __invoke(RequestGenerationMessage $message) { diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php index 9d79d3603..e410529b4 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGenerator.php @@ -55,8 +55,8 @@ final readonly class TempUrlOpenstackGenerator implements TempUrlGeneratorInterf * @throws TempUrlGeneratorException */ public function generatePost( - int $expire_delay = null, - int $submit_delay = null, + ?int $expire_delay = null, + ?int $submit_delay = null, int $max_file_count = 1, ): SignedUrlPost { $delay = $expire_delay ?? $this->max_expire_delay; @@ -112,7 +112,7 @@ final readonly class TempUrlOpenstackGenerator implements TempUrlGeneratorInterf /** * Generate an absolute public url for a GET request on the object. */ - public function generate(string $method, string $object_name, int $expire_delay = null): SignedUrl + public function generate(string $method, string $object_name, ?int $expire_delay = null): SignedUrl { if ($expire_delay > $this->max_expire_delay) { throw new TempUrlGeneratorException(sprintf('The expire delay (%d) is greater than the max_expire_delay (%d)', $expire_delay, $this->max_expire_delay)); diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php index 58ddfe0b0..ae817a480 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/BadCallToRemoteServer.php @@ -13,7 +13,7 @@ namespace Chill\DocStoreBundle\AsyncUpload\Exception; class BadCallToRemoteServer extends \LogicException { - public function __construct(string $content, int $statusCode, int $code = 0, \Throwable $previous = null) + public function __construct(string $content, int $statusCode, int $code = 0, ?\Throwable $previous = null) { parent::__construct("Bad call to remote server: {$statusCode}, {$content}", $code, $previous); } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlRemoteServerException.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlRemoteServerException.php index 5e82e63f7..52ff2cb6c 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlRemoteServerException.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Exception/TempUrlRemoteServerException.php @@ -13,7 +13,7 @@ namespace Chill\DocStoreBundle\AsyncUpload\Exception; class TempUrlRemoteServerException extends \RuntimeException { - public function __construct(int $statusCode, int $code = 0, \Throwable $previous = null) + public function __construct(int $statusCode, int $code = 0, ?\Throwable $previous = null) { parent::__construct('Could not reach remote server: '.(string) $statusCode, $code, $previous); } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/TempUrlGeneratorInterface.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/TempUrlGeneratorInterface.php index 71be97ff9..08ac9e062 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/TempUrlGeneratorInterface.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/TempUrlGeneratorInterface.php @@ -14,10 +14,10 @@ namespace Chill\DocStoreBundle\AsyncUpload; interface TempUrlGeneratorInterface { public function generatePost( - int $expire_delay = null, - int $submit_delay = null, + ?int $expire_delay = null, + ?int $submit_delay = null, int $max_file_count = 1 ): SignedUrlPost; - public function generate(string $method, string $object_name, int $expire_delay = null): SignedUrl; + public function generate(string $method, string $object_name, ?int $expire_delay = null): SignedUrl; } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php index 0464b37b9..e7c3e6cf0 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Templating/AsyncUploadExtension.php @@ -36,7 +36,7 @@ class AsyncUploadExtension extends AbstractExtension ]; } - public function computeSignedUrl(StoredObject|string $file, string $method = 'GET', int $expiresDelay = null): string + public function computeSignedUrl(StoredObject|string $file, string $method = 'GET', ?int $expiresDelay = null): string { if ($file instanceof StoredObject) { $object_name = $file->getFilename(); @@ -47,7 +47,7 @@ class AsyncUploadExtension extends AbstractExtension return $this->tempUrlGenerator->generate($method, $object_name, $expiresDelay)->url; } - public function computeGenerateUrl(StoredObject|string $file, string $method = 'GET', int $expiresDelay = null): string + public function computeGenerateUrl(StoredObject|string $file, string $method = 'GET', ?int $expiresDelay = null): string { if ($file instanceof StoredObject) { $object_name = $file->getFilename(); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php index 43a3eca2c..e615c3b00 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php @@ -29,8 +29,7 @@ final readonly class GenericDocForAccompanyingPeriodController private PaginatorFactory $paginator, private Security $security, private \Twig\Environment $twig, - ) { - } + ) {} /** * @throws \Doctrine\DBAL\Exception diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php index d0d034c7e..f6fecae04 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php @@ -29,8 +29,7 @@ final readonly class GenericDocForPerson private PaginatorFactory $paginator, private Security $security, private \Twig\Environment $twig, - ) { - } + ) {} /** * @throws \Doctrine\DBAL\Exception diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index 6bfb05bfc..5a4b90474 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -20,9 +20,7 @@ use Symfony\Component\Security\Core\Security; class StoredObjectApiController { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} /** * @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready") diff --git a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php index b7e056cac..a6c19584d 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php @@ -53,8 +53,7 @@ class DocumentCategory * @var int The id which is unique inside the bundle */ private $idInsideBundle - ) { - } + ) {} public function getBundleId() // ::class BundleClass (FQDN) { diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php index 5c0b7d501..0addd53cc 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php @@ -30,9 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonDocumentType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php index 8adf13b42..80eeaf372 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php @@ -54,8 +54,7 @@ class FetchQuery implements FetchQueryInterface private array $selectIdentifierTypes = [], private array $selectDateParams = [], private array $selectDateTypes = [], - ) { - } + ) {} public function addJoinClause(string $sql, array $params = [], array $types = []): int { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php index fe9bf7e4f..7307f0d6a 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php @@ -21,8 +21,7 @@ final readonly class GenericDocDTO public array $identifiers, public \DateTimeImmutable $docDate, public AccompanyingPeriod|Person $linked, - ) { - } + ) {} public function getContext(): string { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php index d45f68a38..7522c5d3b 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php @@ -31,8 +31,7 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen public function __construct( private Security $security, private EntityManagerInterface $entityManager, - ) { - } + ) {} public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php index 9f4cd4aff..2b9239c74 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php @@ -27,8 +27,7 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository, - ) { - } + ) {} public function buildFetchQueryForPerson( Person $person, diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php index 195b621c9..70175ee1b 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php @@ -23,8 +23,7 @@ final readonly class AccompanyingCourseDocumentGenericDocRenderer implements Gen public function __construct( private AccompanyingCourseDocumentRepository $accompanyingCourseDocumentRepository, private PersonDocumentRepository $personDocumentRepository, - ) { - } + ) {} public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php index abbaceffb..e64838b41 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php @@ -25,8 +25,7 @@ final readonly class GenericDocExtensionRuntime implements RuntimeExtensionInter * @var list */ private iterable $renderers, - ) { - } + ) {} /** * @throws RuntimeError diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php index 4848d0a5d..485c95078 100644 --- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php @@ -20,9 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class MenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security, private TranslatorInterface $translator) - { - } + public function __construct(private Security $security, private TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index b43605018..016a61dab 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -34,8 +34,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA private CenterResolverManagerInterface $centerResolverManager, private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private Security $security, - ) { - } + ) {} public function buildQueryByPerson(Person $person): QueryBuilder { diff --git a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php index d149e4e9b..2c96f7faa 100644 --- a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php +++ b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php @@ -20,9 +20,7 @@ class StoredObjectDenormalizer implements DenormalizerInterface { use ObjectToPopulateTrait; - public function __construct(private readonly StoredObjectRepository $storedObjectRepository) - { - } + public function __construct(private readonly StoredObjectRepository $storedObjectRepository) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php index b2c092d7f..e5f7c4ee4 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php @@ -30,9 +30,7 @@ final class StoredObjectManager implements StoredObjectManagerInterface public function __construct( private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator - ) - { - } + ) {} public function getLastModified(StoredObject $document): \DateTimeInterface { diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index f833200c8..206260169 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -120,9 +120,7 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt private const TEMPLATE_BUTTON_GROUP = '@ChillDocStore/Button/button_group.html.twig'; - public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) - { - } + public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) {} /** * return true if the document is editable. diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php index 02150e3be..c378ba989 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Controller/AsyncUploadControllerTest.php @@ -68,7 +68,7 @@ class AsyncUploadControllerTest extends TestCase bool $isGranted, ): AsyncUploadController { $tempUrlGenerator = new class () implements TempUrlGeneratorInterface { - public function generatePost(int $expire_delay = null, int $submit_delay = null, int $max_file_count = 1): SignedUrlPost + public function generatePost(?int $expire_delay = null, ?int $submit_delay = null, int $max_file_count = 1): SignedUrlPost { return new SignedUrlPost( 'https://object.store.example', @@ -82,7 +82,7 @@ class AsyncUploadControllerTest extends TestCase ); } - public function generate(string $method, string $object_name, int $expire_delay = null): SignedUrl + public function generate(string $method, string $object_name, ?int $expire_delay = null): SignedUrl { return new SignedUrl( $method, diff --git a/src/Bundle/ChillEventBundle/ChillEventBundle.php b/src/Bundle/ChillEventBundle/ChillEventBundle.php index d5a1b43cf..9754f397f 100644 --- a/src/Bundle/ChillEventBundle/ChillEventBundle.php +++ b/src/Bundle/ChillEventBundle/ChillEventBundle.php @@ -13,6 +13,4 @@ namespace Chill\EventBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillEventBundle extends Bundle -{ -} +class ChillEventBundle extends Bundle {} diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 5d0effcde..3c80ccee9 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -51,14 +51,14 @@ final class EventController extends AbstractController * EventController constructor. */ public function __construct( - EventDispatcherInterface $eventDispatcher, - AuthorizationHelper $authorizationHelper, - FormFactoryInterface $formFactoryInterface, - TranslatorInterface $translator, - PaginatorFactory $paginator, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly AuthorizationHelperInterface $authorizationHelper, + private readonly FormFactoryInterface $formFactoryInterface, + private readonly TranslatorInterface $translator, + private readonly PaginatorFactory $paginator, + private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry - ) { - } + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"}) diff --git a/src/Bundle/ChillEventBundle/Controller/EventListController.php b/src/Bundle/ChillEventBundle/Controller/EventListController.php index 8af005875..60df81240 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventListController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventListController.php @@ -40,8 +40,7 @@ final readonly class EventListController private PaginatorFactoryInterface $paginatorFactory, private TranslatableStringHelperInterface $translatableStringHelper, private UrlGeneratorInterface $urlGenerator, - ) { - } + ) {} /** * @Route("{_locale}/event/event/list", name="chill_event_event_list") diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 11a074d83..5d911adf2 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -42,8 +42,7 @@ final class ParticipationController extends AbstractController private readonly EventRepository $eventRepository, private readonly PersonRepository $personRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry - ) { - } + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create") diff --git a/src/Bundle/ChillEventBundle/Form/ParticipationType.php b/src/Bundle/ChillEventBundle/Form/ParticipationType.php index 078f2ab9d..af1854954 100644 --- a/src/Bundle/ChillEventBundle/Form/ParticipationType.php +++ b/src/Bundle/ChillEventBundle/Form/ParticipationType.php @@ -27,9 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ final class ParticipationType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/RoleType.php b/src/Bundle/ChillEventBundle/Form/RoleType.php index c8d0f5b33..8b9f27be2 100644 --- a/src/Bundle/ChillEventBundle/Form/RoleType.php +++ b/src/Bundle/ChillEventBundle/Form/RoleType.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final class RoleType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php index f3c712801..9fcdbd85f 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php @@ -43,8 +43,7 @@ final class PickEventType extends AbstractType private readonly UrlGeneratorInterface $urlGenerator, private readonly TranslatorInterface $translator, private readonly Security $security - ) { - } + ) {} public function buildView(\Symfony\Component\Form\FormView $view, \Symfony\Component\Form\FormInterface $form, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php index 8d66963e0..c8d69c119 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php @@ -32,8 +32,7 @@ final class PickRoleType extends AbstractType private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator, private readonly RoleRepository $roleRepository - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php index be016d6ca..3f4ab3624 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php @@ -33,9 +33,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class PickStatusType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected TranslatorInterface $translator, protected StatusRepository $statusRepository) - { - } + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected TranslatorInterface $translator, protected StatusRepository $statusRepository) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php index 2c78392ee..341848e42 100644 --- a/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php @@ -22,8 +22,7 @@ final readonly class SectionMenuBuilder implements LocalMenuBuilderInterface public function __construct( private Security $security, private TranslatorInterface $translator, - ) { - } + ) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php b/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php index f92b1e825..7b9b027f9 100644 --- a/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php +++ b/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php @@ -29,8 +29,7 @@ final readonly class EventACLAwareRepository implements EventACLAwareRepositoryI private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private EntityManagerInterface $entityManager, private Security $security, - ) { - } + ) {} /** * @throws NonUniqueResultException diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 7b77942cd..57cb9e9c5 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -43,8 +43,7 @@ class EventSearch extends AbstractSearch private readonly AuthorizationHelper $authorizationHelper, private readonly \Twig\Environment $templating, private readonly PaginatorFactory $paginatorFactory - ) { - } + ) {} public function getOrder() { diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php index 2519ff9b5..a7814dd84 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php @@ -30,9 +30,7 @@ class EventListControllerTest extends WebTestCase private readonly PaginatorFactory $paginatorFactory; private readonly Environment $environment; - protected function setUp(): void - { - } + protected function setUp(): void {} public function testList(): void { diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php index 0ef7f3d0d..a4dd546d6 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php @@ -48,8 +48,8 @@ final class ParticipationControllerTest extends WebTestCase protected function prepareDI(): void { - $this->em = self::$container->get(EntityManagerInterface::class); - $this->eventRepository = self::$container->get(EventRepository::class); + $this->em = self::getContainer()->get(EntityManagerInterface::class); + $this->eventRepository = self::getContainer()->get(EventRepository::class); $this->personsIdsCache = []; } diff --git a/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php b/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php index f489f6cd4..15160c3c7 100644 --- a/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php @@ -67,7 +67,7 @@ class EventACLAwareRepositoryTest extends KernelTestCase public function buildEventACLAwareRepository(): EventACLAwareRepository { - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $user = $em->createQuery('SELECT u FROM '.User::class.' u') ->setMaxResults(1) ->getSingleResult() diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 37dc1225c..882187fad 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -18,10 +18,13 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Doctrine\DBAL\LockMode; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\QueryBuilder; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -36,7 +39,7 @@ abstract class AbstractCRUDController extends AbstractController */ protected array $crudConfig = []; - public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} + public function __construct(private readonly ManagerRegistry $managerRegistry) {} /** * get the role given from the config. @@ -62,7 +65,7 @@ abstract class AbstractCRUDController extends AbstractController parent::getSubscribedServices(), [ 'chill_main.paginator_factory' => PaginatorFactory::class, - + ManagerRegistry::class => ManagerRegistry::class, 'translator' => TranslatorInterface::class, AuthorizationHelper::class => AuthorizationHelper::class, EventDispatcherInterface::class => EventDispatcherInterface::class, @@ -97,7 +100,7 @@ abstract class AbstractCRUDController extends AbstractController */ protected function buildQueryEntities(string $action, Request $request) { - $qb = $this->managerRegistry->getManager() + $qb = $this->getManagerRegistry()->getManager() ->createQueryBuilder() ->select('e') ->from($this->getEntityClass(), 'e'); @@ -118,7 +121,7 @@ abstract class AbstractCRUDController extends AbstractController * * @param mixed|null $entity * - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedHttpException + * @throws AccessDeniedHttpException */ protected function checkACL(string $action, Request $request, string $_format, $entity = null) { @@ -147,9 +150,7 @@ abstract class AbstractCRUDController extends AbstractController return new $class(); } - protected function customizeQuery(string $action, Request $request, $query): void - { - } + protected function customizeQuery(string $action, Request $request, $query): void {} protected function getActionConfig(string $action) { @@ -171,7 +172,7 @@ abstract class AbstractCRUDController extends AbstractController */ protected function getEntity(mixed $action, string $id, Request $request): object { - $e = $this->managerRegistry + $e = $this->getManagerRegistry() ->getRepository($this->getEntityClass()) ->find($id); @@ -182,7 +183,7 @@ abstract class AbstractCRUDController extends AbstractController $expectedVersion = $request->query->getInt('entity_version'); try { - $manager = $this->getDoctrine()->getManagerForClass($this->getEntityClass()); + $manager = $this->managerRegistry->getManagerForClass($this->getEntityClass()); if ($manager instanceof EntityManagerInterface) { $manager->lock($e, LockMode::OPTIMISTIC, $expectedVersion); @@ -212,6 +213,11 @@ abstract class AbstractCRUDController extends AbstractController return $this->container->get('chill_main.paginator_factory'); } + protected function getManagerRegistry(): ManagerRegistry + { + return $this->container->get(ManagerRegistry::class); + } + /** * Get the result of the query. */ diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index c36dfd138..6533da243 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -23,8 +23,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface; class ApiController extends AbstractCRUDController { - public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** * Base method for handling api action. * @@ -82,8 +80,8 @@ class ApiController extends AbstractCRUDController return $response; } - $this->managerRegistry->getManager()->remove($entity); - $this->managerRegistry->getManager()->flush(); + $this->getManagerRegistry()->getManager()->remove($entity); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); @@ -155,7 +153,7 @@ class ApiController extends AbstractCRUDController return $response; } - $this->managerRegistry->getManagerForClass($this->getEntityClass())->flush(); + $this->getManagerRegistry()->getManagerForClass($this->getEntityClass())->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); @@ -271,10 +269,10 @@ class ApiController extends AbstractCRUDController } if ($forcePersist && Request::METHOD_POST === $request->getMethod()) { - $this->managerRegistry->getManager()->persist($postedData); + $this->getManagerRegistry()->getManager()->persist($postedData); } - $this->managerRegistry->getManager()->flush(); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors, [$postedData]); @@ -375,7 +373,7 @@ class ApiController extends AbstractCRUDController try { $entity = $this->deserialize($action, $request, $_format, $entity); } catch (NotEncodableValueException $e) { - throw new BadRequestHttpException('invalid json', 400, $e); + throw new BadRequestHttpException('invalid json', $e, 400); } $errors = $this->validate($action, $request, $_format, $entity); @@ -405,8 +403,8 @@ class ApiController extends AbstractCRUDController return $response; } - $this->managerRegistry->getManager()->persist($entity); - $this->managerRegistry->getManager()->flush(); + $this->getManagerRegistry()->getManager()->persist($entity); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 721163fc8..f4c9538c7 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -248,13 +248,9 @@ class CRUDController extends AbstractController /** * Customize the form created by createFormFor. */ - protected function customizeForm(string $action, FormInterface $form) - { - } + protected function customizeForm(string $action, FormInterface $form) {} - protected function customizeQuery(string $action, Request $request, $query): void - { - } + protected function customizeQuery(string $action, Request $request, $query): void {} /** * @param null $formClass @@ -873,9 +869,7 @@ class CRUDController extends AbstractController }; } - protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) - { - } + protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) {} protected function onPostCheckACL($action, Request $request, $entity): ?Response { @@ -887,58 +881,36 @@ class CRUDController extends AbstractController return null; } - protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request) {} /** * method used by indexAction. */ - protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $query) - { - } + protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $query) {} /** * method used by indexAction. */ - protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $entities) - { - } + protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $entities) {} - protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request) {} - protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request) {} - protected function onPreDelete(string $action, Request $request) - { - } + protected function onPreDelete(string $action, Request $request) {} - protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request) {} - protected function onPreIndex(string $action, Request $request) - { - } + protected function onPreIndex(string $action, Request $request) {} /** * method used by indexAction. */ - protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator) - { - } + protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator) {} - protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) {} - protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request) - { - } + protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request) {} /** * Add ordering fields in the query build by self::queryEntities. diff --git a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php index 3ff3cf134..95f81ae05 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php +++ b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php @@ -16,6 +16,4 @@ use Symfony\Component\Form\AbstractType; /** * Class CRUDDeleteEntityForm. */ -class CRUDDeleteEntityForm extends AbstractType -{ -} +class CRUDDeleteEntityForm extends AbstractType {} diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index fe11f8b9f..b22027499 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -194,14 +194,8 @@ class LoadPostalCodesCommand extends Command } } -class ExistingPostalCodeException extends \Exception -{ -} +class ExistingPostalCodeException extends \Exception {} -class CountryCodeNotFoundException extends \Exception -{ -} +class CountryCodeNotFoundException extends \Exception {} -class PostalCodeNotValidException extends \Exception -{ -} +class PostalCodeNotValidException extends \Exception {} diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index edc58bed5..b3cf68849 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -26,9 +26,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class AddressReferenceAPIController extends ApiController { - public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) - { - } + public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {} /** * @Route("/api/1.0/main/address-reference/by-postal-code/{id}/search.json") diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index 079f4783b..967ee7b5b 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -23,9 +23,7 @@ use Symfony\Component\Serializer\SerializerInterface; class AddressToReferenceMatcherController { - public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) - { - } + public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) {} /** * @Route("/api/1.0/main/address/reference-match/{id}/set/reviewed", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index a8a9c0610..24253de36 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -24,9 +24,7 @@ use Symfony\Component\Serializer\SerializerInterface; class GeographicalUnitByAddressApiController { - public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) - { - } + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {} /** * @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"}) diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php index bc28f9d12..418f49578 100644 --- a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php +++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php @@ -13,6 +13,4 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; -class LocationTypeController extends CRUDController -{ -} +class LocationTypeController extends CRUDController {} diff --git a/src/Bundle/ChillMainBundle/Controller/LoginController.php b/src/Bundle/ChillMainBundle/Controller/LoginController.php index e04f478a8..df295d0b2 100644 --- a/src/Bundle/ChillMainBundle/Controller/LoginController.php +++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php @@ -46,7 +46,5 @@ class LoginController extends AbstractController ]); } - public function LoginCheckAction(Request $request) - { - } + public function LoginCheckAction(Request $request) {} } diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 42f0e5469..16599b9a2 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -31,9 +31,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class NotificationApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {} /** * @Route("/{id}/mark/read", name="chill_api_main_notification_mark_read", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index c4a5be54e..ea79317bf 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -40,9 +40,7 @@ use function in_array; */ class NotificationController extends AbstractController { - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @Route("/create", name="chill_main_notification_create") diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 97b255a85..8b0561635 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -21,9 +21,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class PermissionApiController extends AbstractController { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) - { - } + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) {} /** * @Route("/api/1.0/main/permissions/info.json", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 42d0d6a78..52ef9bfbb 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -47,8 +47,7 @@ final class PermissionsGroupController extends AbstractController private readonly EntityManagerInterface $em, private readonly PermissionsGroupRepository $permissionsGroupRepository, private readonly RoleScopeRepository $roleScopeRepository, - ) { - } + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"}) @@ -317,8 +316,8 @@ final class PermissionsGroupController extends AbstractController } return strcmp( - $translatableStringHelper->localize($a->getScope()->getName()), - $translatableStringHelper->localize($b->getScope()->getName()) + (string) $translatableStringHelper->localize($a->getScope()->getName()), + (string) $translatableStringHelper->localize($b->getScope()->getName()) ); } ); diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index e51f74e40..2b897130d 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -26,9 +26,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class PostalCodeAPIController extends ApiController { - public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) - { - } + public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {} /** * @Route("/api/1.0/main/postal-code/search.json") diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 0269ff0f5..15bfcb9bb 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -34,9 +34,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SavedExportController { - public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) - { - } + public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) {} /** * @Route("/{_locale}/exports/saved/{id}/delete", name="chill_main_export_saved_delete") diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 295b95fed..78dd5eaba 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -32,9 +32,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SearchController extends AbstractController { - public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) - { - } + public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search") diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index 7999cb697..ebbd7a360 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -20,9 +20,7 @@ use Symfony\Component\Security\Core\Security; class TimelineCenterController extends AbstractController { - public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) - { - } + public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) {} /** * @Route("/{_locale}/center/timeline", diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index e515689d3..81f39b084 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -48,9 +48,7 @@ class UserController extends CRUDController private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry - ) - { - } + ) {} /** * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", diff --git a/src/Bundle/ChillMainBundle/Controller/UserExportController.php b/src/Bundle/ChillMainBundle/Controller/UserExportController.php index 41c2d1a85..7f14b5e64 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserExportController.php @@ -27,8 +27,7 @@ final readonly class UserExportController private UserRepositoryInterface $userRepository, private Security $security, private TranslatorInterface $translator, - ) { - } + ) {} /** * @throws \League\Csv\CannotInsertRecord diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php index 144c27688..55d7aceb7 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -21,8 +21,7 @@ class UserJobScopeHistoriesController extends AbstractController { public function __construct( private readonly Environment $engine, - ) { - } + ) {} /** * @Route("/{_locale}/admin/main/user/{id}/job-scope-history", name="admin_user_job_scope_history") diff --git a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php index b44ef52d6..ecdde78a5 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -28,8 +28,7 @@ final class UserProfileController extends AbstractController private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, - ) { - } + ) {} /** * User profile that allows editing of phonenumber and visualization of certain data. diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index dd7d642c9..4c4d8218c 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -29,9 +29,7 @@ use Symfony\Component\Serializer\SerializerInterface; class WorkflowApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {} /** * Return a list of workflow which are waiting an action for the user. diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index 51509e263..b19f03c3b 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -38,9 +38,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class WorkflowController extends AbstractController { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index 14878235d..ded78903d 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -55,8 +55,7 @@ final readonly class CronManager implements CronManagerInterface private EntityManagerInterface $entityManager, private iterable $jobs, private LoggerInterface $logger - ) { - } + ) {} public function run(?string $forceJob = null): void { diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php index c8010f604..29ee21ca6 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php @@ -344,11 +344,11 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface ->findOneBy(['countryCode' => $countryCode]); foreach ($lines as $line) { - $code = str_getcsv($line); + $code = str_getcsv((string) $line); $c = new PostalCode(); $c->setCountry($country) ->setCode($code[0]) - ->setName(\ucwords(\strtolower($code[1]))); + ->setName(\ucwords(\strtolower((string) $code[1]))); if (null !== ($code[3] ?? null)) { $c->setRefPostalCodeId($code[3]); diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index 907997258..e6ac2308a 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -21,9 +21,7 @@ use Symfony\Component\Security\Core\Security; class TrackCreateUpdateSubscriber implements EventSubscriber { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} public function getSubscribedEvents() { diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index beed15f31..de6af9625 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -15,9 +15,7 @@ class Point implements \JsonSerializable { public static string $SRID = '4326'; - private function __construct(private readonly ?float $lon, private readonly ?float $lat) - { - } + private function __construct(private readonly ?float $lon, private readonly ?float $lat) {} public static function fromArrayGeoJson(array $array): self { diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index a36e798a4..79e28e6f3 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -53,6 +53,5 @@ class SimpleGeographicalUnitDTO * @Serializer\Groups({"read"}) */ public int $layerId - ) { - } + ) {} } diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 0cede7b8e..fe02c1491 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -198,9 +198,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter return $this; } - public function eraseCredentials() - { - } + public function eraseCredentials() {} public function getAbsenceStart(): ?\DateTimeImmutable { diff --git a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php index c448077e3..4746b6129 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php +++ b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php @@ -26,8 +26,7 @@ final readonly class ExportFormHelper private AuthorizationHelperForCurrentUserInterface $authorizationHelper, private ExportManager $exportManager, private FormFactoryInterface $formFactory, - ) { - } + ) {} public function getDefaultData(string $step, DirectExportInterface|ExportInterface $export, array $options = []): array { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 3be1af08a..0fad30b4f 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -15,9 +15,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class DateTimeHelper { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function getLabel($header): callable { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php index 07a4f9f88..9161316e7 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -79,9 +79,7 @@ class ExportAddressHelper */ private ?array $unitRefsKeysCache = []; - public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function addSelectClauses(int $params, QueryBuilder $queryBuilder, $entityName = 'address', $prefix = 'add') { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php index fc19f7466..1b561390a 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -21,9 +21,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ class TranslatableStringExportLabelHelper { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function getLabel(string $key, array $values, string $header) { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index 36b126df9..ee164b93c 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -16,9 +16,7 @@ use Chill\MainBundle\Templating\Entity\UserRender; class UserHelper { - public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) - { - } + public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {} /** * Return a callable that will transform a value into a string representing a user. diff --git a/src/Bundle/ChillMainBundle/Export/ListInterface.php b/src/Bundle/ChillMainBundle/Export/ListInterface.php index 53442f0e7..9b88525ca 100644 --- a/src/Bundle/ChillMainBundle/Export/ListInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ListInterface.php @@ -20,6 +20,4 @@ namespace Chill\MainBundle\Export; * * When used, the `ExportManager` will not handle aggregator for this class. */ -interface ListInterface extends ExportInterface -{ -} +interface ListInterface extends ExportInterface {} diff --git a/src/Bundle/ChillMainBundle/Export/SortExportElement.php b/src/Bundle/ChillMainBundle/Export/SortExportElement.php index 0536f6569..6228109ed 100644 --- a/src/Bundle/ChillMainBundle/Export/SortExportElement.php +++ b/src/Bundle/ChillMainBundle/Export/SortExportElement.php @@ -17,8 +17,7 @@ final readonly class SortExportElement { public function __construct( private TranslatorInterface $translator, - ) { - } + ) {} /** * @param array $elements diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 39e839fc2..4f6022afe 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -19,9 +19,7 @@ use Symfony\Component\Security\Core\Security; final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} public function mapDataToForms($viewData, iterable $forms) { diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index ca2fd3ace..ef040d16b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -16,9 +16,7 @@ use Symfony\Component\Form\DataMapperInterface; class ScopePickerDataMapper implements DataMapperInterface { - public function __construct(private readonly ?Scope $scope = null) - { - } + public function __construct(private readonly ?Scope $scope = null) {} public function mapDataToForms($data, iterable $forms) { diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php index aba5e2bc4..42606ebd7 100644 --- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php +++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php @@ -17,9 +17,7 @@ class CustomizeFormEvent extends \Symfony\Contracts\EventDispatcher\Event { final public const NAME = 'chill_main.customize_form'; - public function __construct(protected string $type, protected FormBuilderInterface $builder) - { - } + public function __construct(protected string $type, protected FormBuilderInterface $builder) {} public function getBuilder(): FormBuilderInterface { diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php index e4748d850..7f61cccce 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -24,9 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class LocationFormType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php index c04a4b158..04094537b 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php @@ -17,9 +17,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; final readonly class AddressToIdDataTransformer implements DataTransformerInterface { - public function __construct(private AddressRepository $addressRepository) - { - } + public function __construct(private AddressRepository $addressRepository) {} public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index 9a8b0a6d7..d328d38f0 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class CenterTransformer implements DataTransformerInterface { - public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false) - { - } + public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false) {} public function reverseTransform($id) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php index bd54b0c09..d193ea2ef 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -22,9 +22,7 @@ use Symfony\Component\Serializer\SerializerInterface; class EntityToJsonTransformer implements DataTransformerInterface { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type) - { - } + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type) {} public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php index 436b72ce3..808093278 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php @@ -17,9 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface; class MultipleObjectsToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) {} /** * Transforms a string (id) to an object (item). diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php index ffdee60bd..e56778bf2 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php @@ -17,9 +17,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ObjectToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) {} /** * Transforms a string (id) to an object. diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php index 5f9117577..dde8b7b9e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php @@ -18,9 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class PostalCodeToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository) - { - } + public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository) {} public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php index cb5adec47..2779f2cdd 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php @@ -18,9 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ScopeTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly EntityManagerInterface $em) {} public function reverseTransform($id) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php index 1ea01d5f8..cfcf4a471 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php @@ -19,9 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class AggregatorType extends AbstractType { - public function __construct() - { - } + public function __construct() {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php index 930712084..e5d0887f3 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php @@ -29,9 +29,7 @@ class ExportType extends AbstractType final public const PICK_FORMATTER_KEY = 'pick_formatter'; - public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) - { - } + public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php index 8491d8f6a..bcf842e73 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php @@ -22,9 +22,7 @@ class FilterType extends AbstractType { final public const ENABLED_FIELD = 'enabled'; - public function __construct() - { - } + public function __construct() {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index 01e3ba60a..a093dda44 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -33,8 +33,7 @@ final class PickCenterType extends AbstractType private readonly ExportManager $exportManager, private readonly RegroupmentRepository $regroupmentRepository, private readonly AuthorizationHelperForCurrentUserInterface $authorizationHelper - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php index 8750ee006..190e09f30 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php @@ -41,9 +41,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class PickAddressType extends AbstractType { - public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php index 12b170a73..ba6cc874d 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -34,9 +34,7 @@ use function count; */ class PickCenterType extends AbstractType { - public function __construct(protected AuthorizationHelperInterface $authorizationHelper, protected Security $security, protected CenterRepository $centerRepository) - { - } + public function __construct(protected AuthorizationHelperInterface $authorizationHelper, protected Security $security, protected CenterRepository $centerRepository) {} /** * add a data transformer if user can reach only one center. diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php index abe190de5..f9aa09ce8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php @@ -21,9 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickCivilityType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php index 7fb50fd4a..8aa216da1 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php @@ -19,9 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickLocationTypeType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php index 041176905..1a1ed4354 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php @@ -21,9 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickPostalCodeType extends AbstractType { - public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer) - { - } + public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index ad23e5655..aab9d4c51 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -27,9 +27,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickUserDynamicType extends AbstractType { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php index bea96b79b..9d1cdb626 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php @@ -20,9 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickUserLocationType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 44354922f..0d26b5a95 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -21,9 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PrivateCommentType extends AbstractType { - public function __construct(protected PrivateCommentDataMapper $dataMapper) - { - } + public function __construct(protected PrivateCommentDataMapper $dataMapper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 3adf95a9c..10d083bd8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -43,9 +43,7 @@ class ScopePickerType extends AbstractType private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) - { - } + ) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php index 370de1137..e9ff503df 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -26,9 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2CountryType extends AbstractType { - public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) - { - } + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index 9d634857a..68a3970ba 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -26,9 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2LanguageType extends AbstractType { - public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) - { - } + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 4a6bb8f9a..9d62fbc6a 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -36,9 +36,7 @@ use Symfony\Component\Validator\Constraints\Regex; class UserType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index f0360d4bb..3a3f1b8d3 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -34,9 +34,7 @@ use Symfony\Component\Workflow\Transition; class WorkflowStepType extends AbstractType { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index e08543e8c..b61f38a35 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -24,9 +24,7 @@ use Symfony\Component\Security\Core\User\UserInterface; final readonly class NotificationByUserCounter implements NotificationCounterInterface { - public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) - { - } + public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) {} public function addNotification(UserInterface $u): int { diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 7eba06242..7b535f1a7 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -24,9 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class NotificationMailer { - public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {} public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void { diff --git a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php index 7259c5a35..3268fee05 100644 --- a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php @@ -18,9 +18,7 @@ use Symfony\Component\HttpKernel\Event\TerminateEvent; class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) {} public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php index a55104d23..b1acff57b 100644 --- a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php +++ b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php @@ -11,6 +11,4 @@ declare(strict_types=1); namespace Chill\MainBundle\Notification\Exception; -class NotificationHandlerNotFound extends \RuntimeException -{ -} +class NotificationHandlerNotFound extends \RuntimeException {} diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index d62d6bc75..2d50cb850 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -34,9 +34,7 @@ class Mailer * * @param mixed[] $routeParameters */ - public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) - { - } + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) {} /** * @return string diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php index 04116a434..aa6e700bc 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php @@ -17,9 +17,7 @@ use Doctrine\ORM\EntityManagerInterface; final readonly class NotificationHandlerManager { - public function __construct(private iterable $handlers, private EntityManagerInterface $em) - { - } + public function __construct(private iterable $handlers, private EntityManagerInterface $em) {} /** * @throw NotificationHandlerNotFound if handler is not found diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php index 9b606d18d..5c5cb3dcf 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php @@ -23,9 +23,7 @@ class NotificationPresence { private array $cache = []; - public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) - { - } + public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) {} /** * @param list $more diff --git a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php index 8dd2935dd..a65758f5f 100644 --- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php @@ -21,9 +21,7 @@ use Twig\Extension\RuntimeExtensionInterface; class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) - { - } + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) {} public function counterNotificationFor(Environment $environment, string $relatedEntityClass, int $relatedEntityId, array $more = [], array $options = []): string { diff --git a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php index b887accaa..4c9cb68fe 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php +++ b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php @@ -18,9 +18,7 @@ class PageGenerator implements \Iterator { protected int $current = 1; - public function __construct(protected Paginator $paginator) - { - } + public function __construct(protected Paginator $paginator) {} public function current(): Page { diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php index 072437f09..34a405a20 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php +++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php @@ -57,8 +57,7 @@ class Paginator implements PaginatorInterface * the key in the GET parameter to indicate the number of item per page. */ protected string $itemPerPageKey - ) { - } + ) {} public function count(): int { diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index f7829b332..6453db4ae 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -39,8 +39,7 @@ final readonly class PaginatorFactory implements PaginatorFactoryInterface * the request or inside the paginator. */ private int $itemPerPage = 20 - ) { - } + ) {} /** * create a paginator instance. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php index 69da56eca..51d57c9e9 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php @@ -16,9 +16,7 @@ use Twig\TwigFilter; class Templating extends AbstractExtension { - public function __construct(protected PhonenumberHelper $phonenumberHelper) - { - } + public function __construct(protected PhonenumberHelper $phonenumberHelper) {} public function formatPhonenumber($phonenumber) { diff --git a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php index 439bb3558..b9e454b46 100644 --- a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php +++ b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php @@ -16,6 +16,4 @@ use Redis; /** * Redis client configured by chill main. */ -class ChillRedis extends \Redis -{ -} +class ChillRedis extends \Redis {} diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index 5b830ce27..f14424f6f 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -19,9 +19,7 @@ use Doctrine\ORM\EntityManagerInterface; class UserACLAwareRepository implements UserACLAwareRepositoryInterface { - public function __construct(private readonly ParentRoleHelper $parentRoleHelper, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly ParentRoleHelper $parentRoleHelper, private readonly EntityManagerInterface $em) {} public function findUsersByReachedACL(string $role, $center, $scope = null, bool $onlyEnabled = true): array { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php index 6247cf769..37c47e1bd 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php @@ -26,9 +26,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface /** * SectionMenuBuilder constructor. */ - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator, protected ParameterBagInterface $parameterBag) - { - } + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator, protected ParameterBagInterface $parameterBag) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php index 9775fe474..3427face3 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php @@ -22,9 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly NotificationByUserCounter $notificationByUserCounter, private readonly WorkflowByUserCounter $workflowByUserCounter, private readonly Security $security, private readonly TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private readonly RequestStack $requestStack) - { - } + public function __construct(private readonly NotificationByUserCounter $notificationByUserCounter, private readonly WorkflowByUserCounter $workflowByUserCounter, private readonly Security $security, private readonly TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private readonly RequestStack $requestStack) {} public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php index a1bd1d52f..e16b10e8f 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php @@ -29,9 +29,7 @@ class MenuComposer private RouteCollection $routeCollection; - public function __construct(private readonly RouterInterface $router, private readonly FactoryInterface $menuFactory, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly RouterInterface $router, private readonly FactoryInterface $menuFactory, private readonly TranslatorInterface $translator) {} public function addLocalMenuBuilder(LocalMenuBuilderInterface $menuBuilder, $menuId) { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index 7431833ab..b6892ec53 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -35,9 +35,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface 'activeRouteKey' => null, ]; - public function __construct(private readonly MenuComposer $menuComposer) - { - } + public function __construct(private readonly MenuComposer $menuComposer) {} /** * Render a Menu corresponding to $menuId. diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php index 84d7d3786..12568287d 100644 --- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php +++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php @@ -17,9 +17,7 @@ use Chill\MainBundle\Search\SearchApiQuery; class SearchUserApiProvider implements SearchApiInterface { - public function __construct(private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly UserRepository $userRepository) {} public function getResult(string $key, array $metadata, float $pertinence) { diff --git a/src/Bundle/ChillMainBundle/Search/Model/Result.php b/src/Bundle/ChillMainBundle/Search/Model/Result.php index 8646819d7..1866da2f2 100644 --- a/src/Bundle/ChillMainBundle/Search/Model/Result.php +++ b/src/Bundle/ChillMainBundle/Search/Model/Result.php @@ -19,8 +19,7 @@ class Result * mixed an arbitrary result. */ private $result - ) { - } + ) {} public function getRelevance(): float { diff --git a/src/Bundle/ChillMainBundle/Search/ParsingException.php b/src/Bundle/ChillMainBundle/Search/ParsingException.php index b70dd81eb..241079925 100644 --- a/src/Bundle/ChillMainBundle/Search/ParsingException.php +++ b/src/Bundle/ChillMainBundle/Search/ParsingException.php @@ -11,6 +11,4 @@ declare(strict_types=1); namespace Chill\MainBundle\Search; -class ParsingException extends \Exception -{ -} +class ParsingException extends \Exception {} diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php index b7307c140..267b90313 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApi.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php @@ -20,9 +20,7 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder; class SearchApi { - public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) {} public function getResults(string $pattern, array $types, array $parameters): Collection { diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index 4fc1cf928..14f448746 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -17,9 +17,7 @@ class SearchApiResult { private mixed $result; - public function __construct(private readonly float $relevance) - { - } + public function __construct(private readonly float $relevance) {} /** * @Serializer\Groups({"read"}) diff --git a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php index c753013cb..b992b00c1 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php @@ -13,9 +13,7 @@ namespace Chill\MainBundle\Search\Utils; class SearchExtractionResult { - public function __construct(private readonly string $filteredSubject, private readonly array $found) - { - } + public function __construct(private readonly string $filteredSubject, private readonly array $found) {} public function getFilteredSubject(): string { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php index 352c28be2..d80020285 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php @@ -18,6 +18,4 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter; * * This abstract Voter provide generic methods to handle object specific to Chill */ -abstract class AbstractChillVoter extends Voter implements ChillVoterInterface -{ -} +abstract class AbstractChillVoter extends Voter implements ChillVoterInterface {} diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index 48c9b836f..4cfab08bb 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -34,8 +34,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly UserACLAwareRepositoryInterface $userACLAwareRepository, private readonly ParentRoleHelper $parentRoleHelper - ) { - } + ) {} /** * Filter an array of centers, return only center which are reachable. diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php index 0a9d837a6..bb59cc003 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Security; class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrentUserInterface { - public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security) - { - } + public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security) {} public function getReachableCenters(string $role, ?Scope $scope = null): array { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php index 2ed1856d2..f8b0102c7 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php @@ -14,6 +14,4 @@ namespace Chill\MainBundle\Security\Authorization; /** * Provides methods for compiling voter and build admin role fields. */ -interface ChillVoterInterface -{ -} +interface ChillVoterInterface {} diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php index edfe83256..071388fcf 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php @@ -18,8 +18,7 @@ final readonly class DefaultVoterHelper implements VoterHelperInterface public function __construct( private AuthorizationHelper $authorizationHelper, private array $configuration - ) { - } + ) {} public function supports($attribute, $subject): bool { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php index 1f16004b2..805ba03e5 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php @@ -13,9 +13,7 @@ namespace Chill\MainBundle\Security\Authorization; class DefaultVoterHelperFactory implements VoterHelperFactoryInterface { - public function __construct(protected AuthorizationHelper $authorizationHelper) - { - } + public function __construct(protected AuthorizationHelper $authorizationHelper) {} public function generate($context): VoterGeneratorInterface { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php index e0183cb7f..6a1fe5356 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php @@ -15,9 +15,7 @@ final class DefaultVoterHelperGenerator implements VoterGeneratorInterface { private array $configuration = []; - public function __construct(private readonly AuthorizationHelper $authorizationHelper) - { - } + public function __construct(private readonly AuthorizationHelper $authorizationHelper) {} public function addCheckFor(?string $class, array $attributes): self { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php index 1da50e22e..44766a583 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php @@ -27,9 +27,7 @@ class EntityWorkflowVoter extends Voter final public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW'; - public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) - { - } + public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php index 637516ab9..9718cf013 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -20,9 +20,7 @@ class WorkflowEntityDeletionVoter extends Voter /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) - { - } + public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php index 5985d8567..264b77056 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php @@ -30,8 +30,7 @@ class PasswordRecoverEvent extends \Symfony\Contracts\EventDispatcher\Event private readonly ?User $user = null, private $ip = null, private readonly bool $safelyGenerated = false, - ) { - } + ) {} public function getIp() { diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php index 46712c6a6..e868262e2 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php @@ -20,9 +20,7 @@ class RecoverPasswordHelper { final public const RECOVER_PASSWORD_ROUTE = 'password_recover'; - public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer) - { - } + public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer) {} /** * @param bool $absolute diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php index 9855477fd..903b8c5c5 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php @@ -16,9 +16,7 @@ final readonly class CenterResolverDispatcher implements CenterResolverDispatche /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers = []) - { - } + public function __construct(private iterable $resolvers = []) {} public function resolveCenter($entity, ?array $options = []) { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php index 2ded14071..f629459b4 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php @@ -18,9 +18,7 @@ final readonly class CenterResolverManager implements CenterResolverManagerInter /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers = []) - { - } + public function __construct(private iterable $resolvers = []) {} public function resolveCenters($entity, ?array $options = []): array { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php index 3959cc5a3..032c28a9b 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php @@ -15,9 +15,7 @@ use Twig\TwigFilter; final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension { - public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) - { - } + public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) {} public function getFilters() { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index a61d92b4a..387bc724e 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -19,9 +19,7 @@ final readonly class ScopeResolverDispatcher /** * @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers) - { - } + public function __construct(private iterable $resolvers) {} public function isConcerned($entity, ?array $options = []): bool { diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index 408128c6f..c624c6a99 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -21,9 +21,7 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; class UserProvider implements UserProviderInterface { - public function __construct(protected EntityManagerInterface $em) - { - } + public function __construct(protected EntityManagerInterface $em) {} public function loadUserByUsername($username): UserInterface { diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php index 9d80eabe9..6349f5d85 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php @@ -15,9 +15,7 @@ use Chill\MainBundle\Pagination\PaginatorInterface; class Collection { - public function __construct(private $items, private readonly PaginatorInterface $paginator) - { - } + public function __construct(private $items, private readonly PaginatorInterface $paginator) {} public function getItems() { diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php index 4ef3fe849..476d68568 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php @@ -13,9 +13,7 @@ namespace Chill\MainBundle\Serializer\Model; class Counter implements \JsonSerializable { - public function __construct(private ?int $counter) - { - } + public function __construct(private ?int $counter) {} public function getCounter(): ?int { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index 1a5ebe86b..bbae6bd40 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -47,9 +47,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'confidential', ]; - public function __construct(private readonly AddressRender $addressRender) - { - } + public function __construct(private readonly AddressRender $addressRender) {} /** * @param Address $address diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index 8e937ee66..7c41bcb8a 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -20,9 +20,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class CenterNormalizer implements DenormalizerInterface, NormalizerInterface { - public function __construct(private readonly CenterRepository $repository) - { - } + public function __construct(private readonly CenterRepository $repository) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index 4cf80ccd7..59f0302f0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -23,9 +23,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa { use NormalizerAwareTrait; - public function __construct(private readonly UserRepository $userRepository) - { - } + public function __construct(private readonly UserRepository $userRepository) {} /** * @param CommentEmbeddable $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index 69e7744e4..9ee8bf158 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -20,9 +20,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface { - public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) - { - } + public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index b90f587bb..ed34a45be 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -19,9 +19,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class DoctrineExistingEntityNormalizer implements DenormalizerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php index 83e84f7a0..b1f3807ed 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php @@ -23,9 +23,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn { use NormalizerAwareTrait; - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) - { - } + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) {} /** * @param EntityWorkflow $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 46dbd00cc..f5ffc245b 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -21,9 +21,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz { use NormalizerAwareTrait; - public function __construct(private readonly MetadataExtractor $metadataExtractor) - { - } + public function __construct(private readonly MetadataExtractor $metadataExtractor) {} /** * @param EntityWorkflowStep $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 70cd9a838..aa30fe3fd 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -23,9 +23,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - public function __construct(private readonly NotificationHandlerManager $notificationHandlerManager, private readonly EntityManagerInterface $entityManager, private readonly Security $security) - { - } + public function __construct(private readonly NotificationHandlerManager $notificationHandlerManager, private readonly EntityManagerInterface $entityManager, private readonly Security $security) {} /** * @param Notification $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php index 1d7ee43ce..515e831c0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -18,9 +18,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index 9843c5dd5..55a887001 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -38,9 +38,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware 'isAbsent' => false, ]; - public function __construct(private readonly UserRender $userRender) - { - } + public function __construct(private readonly UserRender $userRender) {} public function normalize($object, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php index 80174053a..a4589b836 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php @@ -100,8 +100,7 @@ final readonly class CollateAddressWithReferenceOrPostalCode implements CollateA public function __construct( private Connection $connection, private LoggerInterface $logger, - ) { - } + ) {} /** * @throws \Throwable diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php index 0267b126d..603265682 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php @@ -22,8 +22,7 @@ final readonly class CollateAddressWithReferenceOrPostalCodeCronJob implements C public function __construct( private ClockInterface $clock, private CollateAddressWithReferenceOrPostalCodeInterface $collateAddressWithReferenceOrPostalCode, - ) { - } + ) {} public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index 46c79a250..6e39b6f92 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -21,8 +21,7 @@ final readonly class RefreshAddressToGeographicalUnitMaterializedViewCronJob imp public function __construct( private Connection $connection, private ClockInterface $clock, - ) { - } + ) {} public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php b/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php index 3484fe288..b545d3979 100644 --- a/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php +++ b/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php @@ -23,8 +23,7 @@ class ViewEntityInfoManager private readonly iterable $vienEntityInfoProviders, private readonly Connection $connection, private readonly LoggerInterface $logger, - ) { - } + ) {} public function synchronizeOnDB(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php index 681d49747..25749aa89 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php @@ -20,9 +20,7 @@ class AddressReferenceBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) - { - } + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {} public function import(string $lang, array $lists): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php index 9407bd600..7e4c93b3f 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php @@ -45,9 +45,7 @@ final class AddressReferenceBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) {} public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php index a8b910424..fd17f2cd2 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php @@ -17,9 +17,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class AddressReferenceFromBano { - public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) - { - } + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {} public function import(string $departementNo): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php index 32e8f0984..6a7bff632 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php @@ -64,9 +64,7 @@ final readonly class AddressToReferenceMatcher '{{ reviewed }}' => Address::ADDR_REFERENCE_STATUS_REVIEWED, ]; - public function __construct(private Connection $connection, private LoggerInterface $logger) - { - } + public function __construct(private Connection $connection, private LoggerInterface $logger) {} public function checkAddressesMatchingReferences(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index 6b6885ff2..705314642 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -43,9 +43,7 @@ final class GeographicalUnitBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) {} public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php index 2ac71abb7..a95ba1abc 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php @@ -20,9 +20,7 @@ class PostalCodeBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {} public function import(string $lang = 'fr'): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php index 5f7f52d72..a0fc5a5db 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php @@ -54,9 +54,7 @@ class PostalCodeBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection) - { - } + public function __construct(private readonly Connection $defaultConnection) {} public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php index e5934af3b..a7998af44 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php @@ -25,9 +25,7 @@ class PostalCodeFRFromOpenData { private const CSV = 'https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal/data-files/019HexaSmal.csv'; - public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {} public function import(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php index 0d5d6b2d8..3edee4763 100644 --- a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php +++ b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php @@ -22,9 +22,7 @@ class ChillMailer implements MailerInterface { private string $prefix = '[Chill] '; - public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger) - { - } + public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger) {} public function send(RawMessage $message, ?Envelope $envelope = null): void { diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index 942310da4..445b35cb0 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -69,8 +69,7 @@ class RollingDate private readonly string $roll, private readonly ?\DateTimeImmutable $fixedDate = null, private readonly \DateTimeImmutable $pivotDate = new \DateTimeImmutable('now') - ) { - } + ) {} public function getFixedDate(): ?\DateTimeImmutable { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php index 82dea7bc6..16bc87790 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php @@ -20,7 +20,5 @@ namespace Chill\MainBundle\Service\ShortMessage; class NullShortMessageSender implements ShortMessageSenderInterface { - public function send(ShortMessage $shortMessage): void - { - } + public function send(ShortMessage $shortMessage): void {} } diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php index e028cf3c4..a2a5b6ed4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php @@ -26,9 +26,7 @@ class ShortMessage final public const PRIORITY_MEDIUM = 'medium'; - public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') - { - } + public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') {} public function getContent(): string { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php index 55490b2eb..344ff3c17 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php @@ -25,9 +25,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class ShortMessageHandler implements MessageHandlerInterface { - public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter) - { - } + public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter) {} public function __invoke(ShortMessage $message): void { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php index 76e45acbd..bbe4f0575 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php @@ -20,9 +20,7 @@ namespace Chill\MainBundle\Service\ShortMessage; class ShortMessageTransporter implements ShortMessageTransporterInterface { - public function __construct(private readonly ShortMessageSenderInterface $sender) - { - } + public function __construct(private readonly ShortMessageSenderInterface $sender) {} public function send(ShortMessage $shortMessage): void { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php index bf43d76d4..d81123c9a 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php @@ -36,8 +36,7 @@ class OvhShortMessageSender implements ShortMessageSenderInterface // for DI, must remains as third argument private readonly LoggerInterface $logger, private readonly PhoneNumberUtil $phoneNumberUtil - ) { - } + ) {} public function send(ShortMessage $shortMessage): void { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index 8a4d99f82..f59b1cd66 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -30,9 +30,7 @@ class AddressRender implements ChillEntityRenderInterface 'extended_infos' => false, ]; - public function __construct(private readonly \Twig\Environment $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly \Twig\Environment $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function renderBox($addr, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index 80536c528..a4d0f48e6 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -21,9 +21,7 @@ class CommentRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly \Twig\Environment $engine) - { - } + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly \Twig\Environment $engine) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index f246b0185..790996847 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -27,9 +27,7 @@ class UserRender implements ChillEntityRenderInterface 'at' => null, ]; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php index ecc54acf6..4ca9eda41 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php @@ -22,8 +22,7 @@ final readonly class FilterOrderGetActiveFilterHelper private TranslatorInterface $translator, private PropertyAccessorInterface $propertyAccessor, private UserRender $userRender, - ) { - } + ) {} /** * Return all the data required to display the active filters. diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 9f42461c6..6421ffcba 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -51,8 +51,7 @@ final class FilterOrderHelper public function __construct( private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack, - ) { - } + ) {} public function addSingleCheckbox(string $name, string $label): self { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index 14189b88d..b213203df 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -37,9 +37,7 @@ class FilterOrderHelperBuilder */ private array $userPickers = []; - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) - { - } + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) {} public function addSingleCheckbox(string $name, string $label): self { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index c9c094a15..0aff466dc 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -16,9 +16,7 @@ use Symfony\Component\HttpFoundation\RequestStack; class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface { - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) - { - } + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) {} public function create(string $context, ?array $options = []): FilterOrderHelperBuilder { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index 40eca8679..6d91cdd83 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -25,8 +25,7 @@ class Templating extends AbstractExtension public function __construct( private readonly RequestStack $requestStack, private readonly FilterOrderGetActiveFilterHelper $filterOrderGetActiveFilterHelper, - ) { - } + ) {} public function getFilters(): array { diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php index bdcc1d9d9..eceae8d9c 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php @@ -22,9 +22,7 @@ class TranslatableStringTwig extends AbstractExtension /** * TranslatableStringTwig constructor. */ - public function __construct(private readonly TranslatableStringHelper $helper) - { - } + public function __construct(private readonly TranslatableStringHelper $helper) {} /** * Returns a list of filters to add to the existing list. diff --git a/src/Bundle/ChillMainBundle/Test/DummyPaginator.php b/src/Bundle/ChillMainBundle/Test/DummyPaginator.php index ff6c55a46..a44c65e9b 100644 --- a/src/Bundle/ChillMainBundle/Test/DummyPaginator.php +++ b/src/Bundle/ChillMainBundle/Test/DummyPaginator.php @@ -23,8 +23,7 @@ class DummyPaginator implements PaginatorFactoryInterface private readonly UrlGeneratorInterface $urlGenerator, private readonly string $route, private readonly array $routeParameters = [] - ) { - } + ) {} public function create(int $totalItems, ?string $route = null, ?array $routeParameters = null): PaginatorInterface { diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index 417e1117b..9d0a15f6d 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -161,9 +161,7 @@ final class CronManagerTest extends TestCase class JobCanRun implements CronJobInterface { - public function __construct(private readonly string $key) - { - } + public function __construct(private readonly string $key) {} public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index 76a07f3ea..7739bc7b9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -532,17 +532,14 @@ class DummyFilterWithApplying implements FilterInterface public function __construct( private readonly ?string $role, private readonly string $applyOn - ) { - } + ) {} public function getTitle() { return 'dummy'; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { @@ -559,9 +556,7 @@ class DummyFilterWithApplying implements FilterInterface return $this->role; } - public function alterQuery(QueryBuilder $qb, $data) - { - } + public function alterQuery(QueryBuilder $qb, $data) {} public function applyOn() { @@ -577,17 +572,14 @@ class DummyExport implements ExportInterface * @var array */ private readonly array $supportedModifiers, - ) { - } + ) {} public function getTitle() { return 'dummy'; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php index 3ce835fc0..cd820bb1c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php @@ -117,13 +117,9 @@ class SortExportElementTest extends KernelTestCase private function makeAggregator(string $title): AggregatorInterface { return new class ($title) implements AggregatorInterface { - public function __construct(private readonly string $title) - { - } + public function __construct(private readonly string $title) {} - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { @@ -150,9 +146,7 @@ class SortExportElementTest extends KernelTestCase return null; } - public function alterQuery(QueryBuilder $qb, $data) - { - } + public function alterQuery(QueryBuilder $qb, $data) {} public function applyOn() { @@ -164,18 +158,14 @@ class SortExportElementTest extends KernelTestCase private function makeFilter(string $title): FilterInterface { return new class ($title) implements FilterInterface { - public function __construct(private readonly string $title) - { - } + public function __construct(private readonly string $title) {} public function getTitle() { return $this->title; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { @@ -192,9 +182,7 @@ class SortExportElementTest extends KernelTestCase return null; } - public function alterQuery(QueryBuilder $qb, $data) - { - } + public function alterQuery(QueryBuilder $qb, $data) {} public function applyOn() { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index 5248f50d6..052e61f64 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -34,9 +34,7 @@ final class TokenManagerTest extends KernelTestCase $this->tokenManager = new TokenManager('secret', $logger); } - public static function setUpBefore() - { - } + public static function setUpBefore() {} public function testGenerate() { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php index 1ec23fdb3..733e17fec 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php @@ -35,9 +35,7 @@ final class DefaultScopeResolverTest extends TestCase { $scope = new Scope(); $entity = new class ($scope) implements HasScopeInterface { - public function __construct(private readonly Scope $scope) - { - } + public function __construct(private readonly Scope $scope) {} public function getScope() { @@ -53,9 +51,7 @@ final class DefaultScopeResolverTest extends TestCase public function testHasScopesInterface() { $entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface { - public function __construct(private readonly Scope $scopeA, private readonly Scope $scopeB) - { - } + public function __construct(private readonly Scope $scopeA, private readonly Scope $scopeB) {} public function getScopes(): iterable { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php index dd4b7f121..35245174c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php @@ -36,9 +36,7 @@ final class ScopeResolverDispatcherTest extends TestCase { $scope = new Scope(); $entity = new class ($scope) implements HasScopeInterface { - public function __construct(private readonly Scope $scope) - { - } + public function __construct(private readonly Scope $scope) {} public function getScope() { diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index 6b4253104..53d8faa16 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -37,9 +37,7 @@ class TimelineBuilder */ private array $providersByContext = []; - public function __construct(private readonly EntityManagerInterface $em, private readonly Environment $twig) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly Environment $twig) {} /** * add a provider id. diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php index e736ba749..584e634ea 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php @@ -15,9 +15,7 @@ class TimelineSingleQuery { private bool $distinct = false; - public function __construct(private ?string $id = null, private ?string $date = null, private ?string $key = null, private ?string $from = null, private ?string $where = null, private array $parameters = []) - { - } + public function __construct(private ?string $id = null, private ?string $date = null, private ?string $key = null, private ?string $from = null, private ?string $where = null, private array $parameters = []) {} public function buildSql(): string { diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php index 8980b8376..0bbf1d373 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php @@ -21,9 +21,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RoleScopeScopePresence extends ConstraintValidator { - public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {} public function validate($value, Constraint $constraint) { diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php index f0fd1880c..0c02885ad 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php @@ -18,9 +18,7 @@ use Symfony\Component\Validator\ConstraintValidator; final class ValidPhonenumber extends ConstraintValidator { - public function __construct(private readonly LoggerInterface $logger, private readonly PhoneNumberHelperInterface $phonenumberHelper) - { - } + public function __construct(private readonly LoggerInterface $logger, private readonly PhoneNumberHelperInterface $phonenumberHelper) {} /** * @param string $value diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index 3ea5d495b..a1b631265 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -22,9 +22,7 @@ use Symfony\Component\Workflow\Event\Event; final readonly class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface { - public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) - { - } + public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) {} public function addNotification(UserInterface $u): int { diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php index 6c45cef3d..9a1f52280 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php +++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php @@ -20,9 +20,7 @@ class EntityWorkflowManager /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private readonly iterable $handlers, private readonly Registry $registry) - { - } + public function __construct(private readonly iterable $handlers, private readonly Registry $registry) {} public function getHandler(EntityWorkflow $entityWorkflow, array $options = []): EntityWorkflowHandlerInterface { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php index 804a6587f..b1fa80458 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php @@ -23,9 +23,7 @@ use Symfony\Component\Workflow\TransitionBlocker; class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly LoggerInterface $chillLogger, private readonly Security $security, private readonly UserRender $userRender) - { - } + public function __construct(private readonly LoggerInterface $chillLogger, private readonly Security $security, private readonly UserRender $userRender) {} public function addDests(Event $event): void { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index 07cf8cc14..e290a567e 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -23,9 +23,7 @@ use Symfony\Component\Workflow\Registry; class NotificationOnTransition implements EventSubscriberInterface { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) {} public static function getSubscribedEvents(): array { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php index bd07a5a28..90a6e19db 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php @@ -20,9 +20,7 @@ use Symfony\Component\Workflow\Registry; class SendAccessKeyEventSubscriber { - public function __construct(private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) - { - } + public function __construct(private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) {} public function postPersist(EntityWorkflowStep $step): void { diff --git a/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php b/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php index f4280b50f..9d91b3357 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php +++ b/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php @@ -11,6 +11,4 @@ declare(strict_types=1); namespace Chill\MainBundle\Workflow\Exception; -class HandlerNotFoundException extends \RuntimeException -{ -} +class HandlerNotFoundException extends \RuntimeException {} diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index 8f0caa62e..f99449dc3 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -19,9 +19,7 @@ use Symfony\Component\Workflow\WorkflowInterface; class MetadataExtractor { - public function __construct(private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function availableWorkflowFor(string $relatedEntityClass, ?int $relatedEntityId = 0): array { diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php index 9302cf7f9..c9ba7cf79 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php @@ -20,9 +20,7 @@ use Symfony\Component\Security\Core\Security; class WorkflowNotificationHandler implements NotificationHandlerInterface { - public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Security $security) - { - } + public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Security $security) {} public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php index e9edb11d9..f2b7d80db 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php @@ -23,9 +23,7 @@ use Twig\Extension\RuntimeExtensionInterface; class WorkflowTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly EntityWorkflowRepository $repository, private readonly MetadataExtractor $metadataExtractor, private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly EntityWorkflowRepository $repository, private readonly MetadataExtractor $metadataExtractor, private readonly NormalizerInterface $normalizer) {} public function getTransitionByString(EntityWorkflow $entityWorkflow, string $key): ?Transition { diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php index f6590c9d3..2020c7b52 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php @@ -21,9 +21,7 @@ use Symfony\Component\Workflow\WorkflowInterface; class EntityWorkflowCreationValidator extends \Symfony\Component\Validator\ConstraintValidator { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager) - { - } + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager) {} /** * @param EntityWorkflow $value diff --git a/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php b/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php index 5ae675b51..55f5a6420 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php @@ -16,9 +16,7 @@ use Doctrine\Migrations\AbstractMigration; class Version20100000000000 extends AbstractMigration { - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} public function up(Schema $schema): void { diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php index c46b40ee5..4bd9bd18f 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php @@ -16,9 +16,7 @@ use Doctrine\Migrations\AbstractMigration; final class Version20220513151853 extends AbstractMigration { - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} public function getDescription(): string { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index f65533958..64d2b8f12 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -22,9 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonAddressMoveEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) {} public static function getSubscribedEvents(): array { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index 297da8673..084fe8ff5 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserRefEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister) - { - } + public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister) {} public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php index 33d88e7de..4a0e922d2 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php @@ -20,8 +20,7 @@ readonly class AccompanyingPeriodStepChangeCronjob implements CronJobInterface public function __construct( private ClockInterface $clock, private AccompanyingPeriodStepChangeRequestor $requestor, - ) { - } + ) {} public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php index 71d28c57f..534672efc 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php @@ -23,8 +23,7 @@ class AccompanyingPeriodStepChangeMessageHandler implements MessageHandlerInterf public function __construct( private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodStepChanger $changer, - ) { - } + ) {} public function __invoke(AccompanyingPeriodStepChangeRequestMessage $message): void { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php index 7e9f87939..fe597a724 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php @@ -30,8 +30,7 @@ class AccompanyingPeriodStepChanger private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly Registry $workflowRegistry, - ) { - } + ) {} public function __invoke(AccompanyingPeriod $period, string $transition, ?string $workflowName = null): void { diff --git a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php index 465807ebd..ac3363db0 100644 --- a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php +++ b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php @@ -52,8 +52,7 @@ class ActionEvent extends \Symfony\Contracts\EventDispatcher\Event * an array of key value data to describe the movement. */ protected $metadata = [] - ) { - } + ) {} /** * Add Sql which will be executed **after** the delete statement. diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php index b2deb17ca..f08bd7dff 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php @@ -19,8 +19,7 @@ class PersonMoveCenterHistoryHandler implements PersonMoveSqlHandlerInterface { public function __construct( private readonly PersonCenterHistoryRepository $centerHistoryRepository, - ) { - } + ) {} public function supports(string $className, string $field): bool { diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php index 48fa57b85..292c805a0 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php @@ -33,8 +33,7 @@ class PersonMove private readonly EntityManagerInterface $em, private readonly PersonMoveManager $personMoveManager, private readonly EventDispatcherInterface $eventDispatcher - ) { - } + ) {} /** * Return the sql used to move or delete entities associated to a person to diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php index 230c2d4e2..0c9230d90 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php @@ -20,8 +20,7 @@ class PersonMoveManager * @var iterable */ private readonly iterable $handlers, - ) { - } + ) {} /** * @param class-string $className diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php index d91c38f78..3f233c174 100644 --- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php +++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php @@ -24,8 +24,7 @@ class ConfigPersonAltNamesHelper * the raw config, directly from the container parameter. */ private $config - ) { - } + ) {} /** * get the choices as key => values. diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 741163cc3..6caa6be4c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -46,9 +46,7 @@ use Symfony\Component\Workflow\Registry; final class AccompanyingCourseApiController extends ApiController { - public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} public function commentApi($id, Request $request, string $_format): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index b77f890c8..cbead99f4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -17,6 +17,7 @@ use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; +use Symfony\Bridge\Doctrine\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; @@ -30,9 +31,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseCommentController extends AbstractController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator) - { - } + public function __construct( + private readonly EntityManagerInterface $entityManager, + private readonly FormFactoryInterface $formFactory, + private readonly TranslatorInterface $translator, + private readonly ManagerRegistry $managerRegistry, + ) {} /** * Page of comments in Accompanying Course section. diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 5855692f1..21378b9d7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -20,9 +20,7 @@ use Symfony\Component\Security\Core\Security; class AccompanyingCourseWorkEvaluationDocumentController extends AbstractController { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index 0c81e21b9..f5516114f 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -31,9 +31,7 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodRegulationListController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} /** * @Route("/{_locale}/person/periods/undispatched", name="chill_person_course_list_regulation") diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index aa9a265e2..60b8e9cff 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -29,9 +29,7 @@ use Symfony\Component\Serializer\SerializerInterface; class AccompanyingPeriodWorkEvaluationApiController { - public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) - { - } + public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) {} /** * @Route("/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}", diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 9a9ffa86d..00503ab3e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -44,8 +44,7 @@ class HouseholdCompositionController extends AbstractController private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly UrlGeneratorInterface $urlGenerator - ) { - } + ) {} /** * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 666a40c3b..ae74d365b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -34,9 +34,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class HouseholdController extends AbstractController { - public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index 198dcde23..aa2f80a43 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -45,9 +45,7 @@ class HouseholdMemberController extends ApiController private readonly Security $security, private readonly PositionRepository $positionRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, - ) - { - } + ) {} /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 463e53897..b1df6cb16 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -29,9 +29,7 @@ class PersonAddressController extends AbstractController /** * PersonAddressController constructor. */ - public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"}) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 99c3899e6..3d8d1bdbe 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -47,8 +47,7 @@ final class PersonController extends AbstractController private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, private readonly ValidatorInterface $validator, private readonly EntityManagerInterface $em, - ) { - } + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit") diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 0e5ec8eee..119780b47 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -40,9 +40,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll private readonly EventDispatcherInterface $eventDispatcher, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, - ) - { - } + ) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index 7a112371d..a9d60d18e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -25,9 +25,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceController extends AbstractController { - public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index f8e305552..7cd95773e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -39,9 +39,7 @@ use Symfony\Component\Validator\Constraints\NotNull; class ReassignAccompanyingPeriodController extends AbstractController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) {} /** * @Route("/{_locale}/person/accompanying-periods/reassign", name="chill_course_list_reassign") diff --git a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php index eac149245..80cc8c79b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php @@ -21,9 +21,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class RelationshipApiController extends ApiController { - public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) - { - } + public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) {} /** * @ParamConverter("person", options={"id": "person_id"}) diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index 97bc7ec1e..4cf3e0d6e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -27,9 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class ResidentialAddressController extends AbstractController { - public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index b6b7baf00..b97f2ed30 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -22,9 +22,7 @@ use Symfony\Component\Routing\Annotation\Route; class SocialWorkEvaluationApiController extends AbstractController { - public function __construct(private readonly PaginatorFactory $paginatorFactory) - { - } + public function __construct(private readonly PaginatorFactory $paginatorFactory) {} /** * @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json", diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php index cbbd9a748..2a7f39712 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php @@ -21,9 +21,7 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkGoalApiController extends ApiController { - public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) - { - } + public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) {} public function listBySocialAction(Request $request, SocialAction $action): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php index aaedfd330..9b97d8129 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php @@ -21,9 +21,7 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkResultApiController extends ApiController { - public function __construct(private readonly ResultRepository $resultRepository) - { - } + public function __construct(private readonly ResultRepository $resultRepository) {} public function listByGoal(Request $request, Goal $goal): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php index 5ecc41a4c..6b341e926 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php @@ -26,8 +26,7 @@ final class SocialWorkSocialActionApiController extends ApiController private readonly SocialIssueRepository $socialIssueRepository, private readonly PaginatorFactory $paginator, private readonly ClockInterface $clock, - ) { - } + ) {} public function listBySocialIssueApi($id, Request $request) { diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index fa41a7a4d..5cfc26cc7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -22,9 +22,7 @@ use Symfony\Component\HttpFoundation\Request; class TimelinePersonController extends AbstractController { - public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) - { - } + public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline") diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index d5dd41e5b..1f484fd91 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -21,9 +21,7 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) - { - } + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) {} /** * @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user") diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php index 63000093e..44992ebef 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php @@ -26,9 +26,7 @@ class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture */ private array $cacheEvaluations = []; - public function __construct(private readonly AccompanyingPeriodRepository $periodRepository, private readonly EvaluationRepository $evaluationRepository) - { - } + public function __construct(private readonly AccompanyingPeriodRepository $periodRepository, private readonly EvaluationRepository $evaluationRepository) {} public function getDependencies() { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php index baf18cebc..2acbcbfbd 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php @@ -37,8 +37,7 @@ class LoadCustomFields extends AbstractFixture implements OrderedFixtureInterfac private readonly EntityManagerInterface $entityManager, private readonly CustomFieldChoice $customFieldChoice, private readonly CustomFieldText $customFieldText, - ) { - } + ) {} // put your code here public function getOrder() diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 8fff20a39..3efcc6386 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -24,9 +24,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface { use PersonRandomHelper; - public function __construct(private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly EntityManagerInterface $em) {} public function getDependencies(): array { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php index 9c04d73cd..dc1e7b4dd 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php @@ -19,9 +19,7 @@ use League\Csv\Reader; class LoadSocialWorkMetadata extends Fixture implements OrderedFixtureInterface { - public function __construct(private readonly SocialWorkMetadata $importer) - { - } + public function __construct(private readonly SocialWorkMetadata $importer) {} public function getOrder() { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 4f9c480d0..d555dec42 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -788,7 +788,7 @@ class AccompanyingPeriod implements if (self::STEP_DRAFT === $this->getStep()) { return [[self::STEP_DRAFT]]; } - if (str_starts_with($this->getStep(), 'CONFIRM')) { + if (str_starts_with((string) $this->getStep(), 'CONFIRM')) { return [[self::STEP_DRAFT, self::STEP_CONFIRMED]]; } if (self::STEP_CLOSED === $this->getStep()) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php index fe552dfe0..d68292927 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php @@ -84,6 +84,5 @@ class AccompanyingPeriodInfo * @ORM\Column(type="text") */ public readonly string $discriminator, - ) { - } + ) {} } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php index 8ce1c7749..0086faab2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php @@ -59,8 +59,7 @@ class AccompanyingPeriodWorkReferrerHistory implements TrackCreationInterface, T * @ORM\Column(type="date_immutable", nullable=false) */ private \DateTimeImmutable $startDate - ) { - } + ) {} public function getId(): ?int { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php index 41b798a3f..ab9ca7c7d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -58,8 +58,7 @@ class UserHistory implements TrackCreationInterface * @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "now()"}) */ private \DateTimeImmutable $startDate = new \DateTimeImmutable('now') - ) { - } + ) {} public function getAccompanyingPeriod(): AccompanyingPeriod { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index cd28da9a7..6f56d82ec 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -1788,9 +1788,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI } /** - * @param Collection $spokenLanguages + * @param (\Doctrine\Common\Collections\Collection&\iterable<\Chill\MainBundle\Entity\Language>) $spokenLanguages */ - public function setSpokenLanguages($spokenLanguages): self + public function setSpokenLanguages(mixed $spokenLanguages): self { $this->spokenLanguages = $spokenLanguages; diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php index 89ee1f5af..04cad642b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php @@ -59,8 +59,7 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac * @ORM\Column(type="date_immutable", nullable=false) */ private ?\DateTimeImmutable $startDate = null - ) { - } + ) {} public function getCenter(): ?Center { diff --git a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php index a65f68102..cf15018fd 100644 --- a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php +++ b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php @@ -29,9 +29,7 @@ class PersonAddressMoveEvent extends Event private ?HouseholdMember $previousMembership = null; - public function __construct(private readonly Person $person) - { - } + public function __construct(private readonly Person $person) {} /** * Get the date of the move. diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index 60d521424..c6b366fc8 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodWorkEventListener { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index 6d15566af..522b2ecdd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationAggregator implements AggregatorInterface { - public function __construct(private readonly LocationRepository $locationRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly LocationRepository $locationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index 9ea9998b3..259d5fb66 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveAggregator implements AggregatorInterface { - public function __construct(private readonly ClosingMotiveRepositoryInterface $motiveRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly ClosingMotiveRepositoryInterface $motiveRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index 3c404c513..0e3e5f735 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ConfidentialAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index bc2232a65..bc18315c1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -27,8 +27,7 @@ class CreatorJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepository $jobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -79,9 +78,7 @@ class CreatorJobAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index f0dbec2c4..f5dc99115 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -26,9 +26,7 @@ final readonly class DurationAggregator implements AggregatorInterface 'day', ]; - public function __construct(private TranslatorInterface $translator) - { - } + public function __construct(private TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index c215eeb6a..0217166d2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index de2f9305e..a90896ccd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class EvaluationAggregator implements AggregatorInterface { - public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index 2d6dbeae4..3fa612988 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -28,9 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class GeographicalUnitStatAggregator implements AggregatorInterface { - public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index d7dff6265..de42039c1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class IntensityAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php index cfb9d53aa..bac34096f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php @@ -28,8 +28,7 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface public function __construct( private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { @@ -73,9 +72,7 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php index 632d0402d..3859eded5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php @@ -23,8 +23,7 @@ final readonly class PersonParticipatingAggregator implements AggregatorInterfac public function __construct( private LabelPersonHelper $labelPersonHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index 78349dd56..823b10d86 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -27,9 +27,7 @@ final readonly class ReferrerAggregator implements AggregatorInterface private const P = 'acp_ref_agg_date'; - public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index b0a44bcd1..9f58b6539 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -27,8 +27,7 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { @@ -79,9 +78,7 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 824d7431f..ec168ceaf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class RequestorAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) - { - } + public function __construct(private TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index d7cdfbab1..06dbc906d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ScopeAggregator implements AggregatorInterface { - public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php index 23159cae8..dd33603b4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php @@ -28,8 +28,7 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa public function __construct( private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { @@ -73,9 +72,7 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index 4459d634a..7abad2602 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class SocialActionAggregator implements AggregatorInterface { - public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) - { - } + public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 02746f82a..8c0cbfbd5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class SocialIssueAggregator implements AggregatorInterface { - public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) - { - } + public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index 5623a7212..a9439a63f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -27,9 +27,7 @@ final readonly class StepAggregator implements AggregatorInterface private const P = 'acp_step_agg_date'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) - { - } + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php index 0bf536929..0702edf6f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php @@ -27,8 +27,7 @@ final readonly class UserJobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -79,9 +78,7 @@ final readonly class UserJobAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php index b4bc40c10..321801e28 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php @@ -27,8 +27,7 @@ final readonly class UserWorkingOnCourseAggregator implements AggregatorInterfac public function __construct( private UserRender $userRender, private UserRepositoryInterface $userRepository, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php index b5776ebeb..6b6a5ce4a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php @@ -25,8 +25,7 @@ final readonly class ByClosingMotiveAggregator implements AggregatorInterface public function __construct( private ClosingMotiveRepositoryInterface $closingMotiveRepository, private ClosingMotiveRender $closingMotiveRender, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php index 005d012f9..e2494526a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php @@ -27,8 +27,7 @@ final readonly class ByStepAggregator implements AggregatorInterface public function __construct( private TranslatorInterface $translator - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index 593e23420..9ff2ad50a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationTypeAggregator implements AggregatorInterface { - public function __construct(private readonly EvaluationRepository $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly EvaluationRepository $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php index 8960cbd86..4dfddab81 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HavingEndDateAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index 750841337..e013c2f0f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ChildrenNumberAggregator implements AggregatorInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 45263dd52..3dc3a1398 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CompositionAggregator implements AggregatorInterface { - public function __construct(private readonly HouseholdCompositionTypeRepository $typeRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly HouseholdCompositionTypeRepository $typeRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 68ed28492..2ca286b57 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -24,8 +24,7 @@ final readonly class AgeAggregator implements AggregatorInterface, ExportElement { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php index 06647dbc7..af1018f6e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php @@ -27,9 +27,7 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface { private const PREFIX = 'acp_by_household_compo_agg'; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php index fd48bdb01..cd48a3f51 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php @@ -27,8 +27,7 @@ final readonly class CenterAggregator implements AggregatorInterface public function __construct( private CenterRepositoryInterface $centerRepository, private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index e54714d7a..b8d204dc5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -25,9 +25,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) - { - } + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index 05a9273e5..0181c6e7b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -20,9 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class GenderAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) - { - } + public function __construct(private TranslatorInterface $translator) {} public function addRole(): ?string { @@ -41,9 +39,7 @@ final readonly class GenderAggregator implements AggregatorInterface return Declarations::PERSON_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php index 8691f8cd3..8ce51a3ab 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php @@ -26,9 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitAggregator implements AggregatorInterface { - public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index f44b949dc..eb1e52d9b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -28,9 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index c0f86ea25..1555a5a12 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class MaritalStatusAggregator implements AggregatorInterface { - public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index bc11565e4..9daca5b34 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -24,9 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) - { - } + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php index aa06fff61..a8ec614d4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php @@ -26,8 +26,7 @@ final readonly class PostalCodeAggregator implements AggregatorInterface public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index 901bd1cb6..9abf5c1e7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ActionTypeAggregator implements AggregatorInterface { - public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) - { - } + public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php index d879e42f5..f7c203a4e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php @@ -25,8 +25,7 @@ class CreatorAggregator implements AggregatorInterface public function __construct( private readonly UserRepository $userRepository, private readonly UserRender $userRender - ) { - } + ) {} public function addRole(): ?string { @@ -47,9 +46,7 @@ class CreatorAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php index ea4499e1d..1f7fdca5a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php @@ -27,8 +27,7 @@ class CreatorJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepository $jobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -64,9 +63,7 @@ class CreatorJobAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php index 6654212b0..c57607693 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php @@ -27,8 +27,7 @@ class CreatorScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepository $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -64,9 +63,7 @@ class CreatorScopeAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php index 95e1b8518..a9f8e020a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php @@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CurrentActionAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index 84367578e..ce1e381f2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class GoalAggregator implements AggregatorInterface { - public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php index de4e1d46e..e1549f315 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class GoalResultAggregator implements AggregatorInterface { - public function __construct(private readonly ResultRepository $resultRepository, private readonly GoalRepository $goalRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly ResultRepository $resultRepository, private readonly GoalRepository $goalRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php index f02e05f4f..f58246a25 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php @@ -25,9 +25,7 @@ final readonly class HandlingThirdPartyAggregator implements AggregatorInterface { private const PREFIX = 'acpw_handling3party_agg'; - public function __construct(private LabelThirdPartyHelper $labelThirdPartyHelper) - { - } + public function __construct(private LabelThirdPartyHelper $labelThirdPartyHelper) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index 1cd226e27..c8336b09b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -28,8 +28,7 @@ final readonly class JobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -59,9 +58,7 @@ final readonly class JobAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index 9488cb091..c97229048 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -29,8 +29,7 @@ final readonly class ReferrerAggregator implements AggregatorInterface private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 53628d329..63a037f21 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ResultAggregator implements AggregatorInterface { - public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 060712f6a..dfffaa9e4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -28,8 +28,7 @@ final readonly class ScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { @@ -59,9 +58,7 @@ final readonly class ScopeAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php index 209bf8889..ad3f8f745 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php @@ -34,9 +34,7 @@ class AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod implements ExportInt $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php index db3b84ce7..8d34837ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php @@ -34,9 +34,7 @@ class AvgDurationAPWorkPersonAssociatedOnWork implements ExportInterface, Groupe $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index c5c66cd01..0cbe7b3e8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -35,9 +35,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) - { - } + public function buildForm(FormBuilderInterface $builder) {} public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 6c9efcfc3..7d0e52169 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -34,8 +34,7 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp private RollingDateConverterInterface $rollingDateConverter, private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index 6ebfa1bec..688681e97 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -92,8 +92,7 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri private readonly AggregateStringHelper $aggregateStringHelper, private readonly SocialActionRepository $socialActionRepository, private readonly FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php index f55f254b8..ed64da7b0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -92,8 +92,7 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements private readonly AggregateStringHelper $aggregateStringHelper, private readonly SocialActionRepository $socialActionRepository, private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index fe707d56a..71d9924be 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -81,8 +81,7 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter private readonly AggregateStringHelper $aggregateStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter, private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index a11df19c7..1a1fd0316 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -135,9 +135,7 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return PersonVoter::DUPLICATE; } - public function validateForm($data, ExecutionContextInterface $context) - { - } + public function validateForm($data, ExecutionContextInterface $context) {} protected function getHeaders(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php index d29ba3fde..d283c8d8a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php @@ -41,8 +41,7 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index d34eb7a15..6bcb4f8b8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOnDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index fb5d6dc02..3b7c4fe25 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOneDayBetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index c79f94daf..915a2c9e6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index 442dc505b..7fb032050 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 230267904..4c8baf147 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -28,9 +28,7 @@ class ConfidentialFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index 790afc66b..cc7e21b08 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -29,8 +29,7 @@ class CreatorJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index 10528a007..671b87407 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -28,9 +28,7 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 95dcb5c62..bec01c249 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationFilter implements FilterInterface { - public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index ce193e1a4..3b1183c99 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -33,9 +33,7 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php index 818f7567a..8a9f734aa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php @@ -26,8 +26,7 @@ final readonly class HandlingThirdPartyFilter implements FilterInterface public function __construct( private ThirdPartyRender $thirdPartyRender, - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php index 7df3ff0d2..72bcce39e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HasNoReferrerFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 741a19961..778e4181a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HasTemporaryLocationFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php index b6a05a466..d6436f8b4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php @@ -29,8 +29,7 @@ final readonly class HavingAnAccompanyingPeriodInfoWithinDatesFilter implements { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index d1d3de19d..3eb8bbb24 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -28,9 +28,7 @@ class IntensityFilter implements FilterInterface private const DEFAULT_CHOICE = 'occasional'; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php index 8ba1b585d..099320c95 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php @@ -39,8 +39,7 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface private UserJobRepositoryInterface $userJobRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php index 72197234c..60486371e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php @@ -26,8 +26,7 @@ final readonly class NotAssociatedWithAReferenceAddressFilter implements FilterI { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 2427b1637..1b85f6cd7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class OpenBetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index 7ded268f6..617577cde 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class OriginFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 22a4b560f..30f67f664 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -28,9 +28,7 @@ class ReferrerFilter implements FilterInterface private const PU = 'acp_referrer_filter_users'; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php index c58aad3bb..a5b43375f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php @@ -42,8 +42,7 @@ final readonly class ReferrerFilterBetweenDates implements FilterInterface public function __construct( private RollingDateConverterInterface $rollingDateConverter, private UserRender $userRender - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 90f6953f1..0b7ce6994 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -31,9 +31,7 @@ final readonly class RequestorFilter implements FilterInterface 'no requestor' => 'no_requestor', ]; - public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em) - { - } + public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php index 9aec79c94..403ddd0b5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php @@ -39,8 +39,7 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface private ScopeRepositoryInterface $scopeRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index 702c7533c..dc5ffa042 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -31,8 +31,7 @@ final readonly class SocialActionFilter implements FilterInterface private SocialActionRender $actionRender, private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php index 8b0a4c085..dfd627eda 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php @@ -39,9 +39,7 @@ class StepFilterBetweenDates implements FilterInterface 'course.inactive_long' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG, ]; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php index c88bf1e34..8b36b1b5b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php @@ -43,9 +43,7 @@ class StepFilterOnDate implements FilterInterface 'course.inactive_long' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG, ]; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index d6bc25198..3c6c12c63 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -30,8 +30,7 @@ class UserJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php index bfbe8e66d..e7ed194f1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php @@ -30,8 +30,7 @@ class UserScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php index af7674570..85d5db9d6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php @@ -34,8 +34,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface public function __construct( private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php index 8026f4573..1625953f6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php @@ -33,8 +33,7 @@ final readonly class ByDateFilter implements FilterInterface { public function __construct( private RollingDateConverterInterface $rollingDateConverter - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php index 337b27e8a..337c30a89 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php @@ -23,8 +23,7 @@ final readonly class ByStepFilter implements FilterInterface { public function __construct( private TranslatorInterface $translator, - ) { - } + ) {} public function getTitle() { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php index 3bb8eb417..a0d8d0033 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByEndDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php index 8c46fbfc2..401cd79a5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php @@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByStartDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index fce1600d1..20472420c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class EvaluationTypeFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EvaluationRepositoryInterface $evaluationRepository) - { - } + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EvaluationRepositoryInterface $evaluationRepository) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 8555fbac9..6094d56ee 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -25,9 +25,7 @@ class MaxDateFilter implements FilterInterface 'maxdate is not specified' => false, ]; - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index c35b9cc69..733e41480 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -28,8 +28,7 @@ readonly class CompositionFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php index 7c79f473a..8cd675abe 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php @@ -23,9 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index 1c34f90ee..aa97ad54c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -25,9 +25,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index 45d190eee..dd14c71ef 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -24,9 +24,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php index 77f4f758f..e873a6598 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php @@ -29,9 +29,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByHouseholdCompositionFilter implements FilterInterface { - public function __construct(private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index 3cbd46a7b..82cda25ed 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -23,9 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class DeadOrAliveFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php index 8caf64fbf..1bc32d9bb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php @@ -24,9 +24,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php index a0aefe75b..e2041c3fa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php @@ -27,9 +27,7 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index d6af8204d..6c4cdf802 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -19,9 +19,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; class MaritalStatusFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index 556be8188..4c83fafe3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -26,9 +26,7 @@ class NationalityFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index ff511fe91..ea8e01baf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -26,9 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ResidentialAddressAtThirdpartyFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index acd5ede84..3c2d7a3a6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -23,9 +23,7 @@ use Doctrine\ORM\QueryBuilder; class ResidentialAddressAtUserFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 1df656a00..289af5f07 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -25,8 +25,7 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php index 079040b7f..c34c7eb40 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php @@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class WithoutHouseholdComposition implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php index 92258ccf9..32bbbaf6e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php @@ -24,8 +24,7 @@ final readonly class AccompanyingPeriodWorkEndDateBetweenDateFilter implements F { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php index 7b404796e..880543355 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php @@ -24,8 +24,7 @@ final readonly class AccompanyingPeriodWorkStartDateBetweenDateFilter implements { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php index d413cdb37..2b7a6ef07 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php @@ -29,8 +29,7 @@ class CreatorJobFilter implements FilterInterface public function __construct( private readonly UserJobRepository $userJobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php index cedae69f6..16ed52755 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php @@ -29,8 +29,7 @@ class CreatorScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepository $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 4622f61f9..d3e54f2a5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -29,8 +29,7 @@ class JobFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index 3997139c2..4d456fdb2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -24,9 +24,7 @@ final readonly class ReferrerFilter implements FilterInterface { private const PREFIX = 'acpw_referrer_filter'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 2569c3d5b..d4867a884 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -29,8 +29,7 @@ class ScopeFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 7204e6e11..c84ed7f40 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -26,9 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface; class SocialWorkTypeFilter implements FilterInterface { - public function __construct(private readonly SocialActionRender $socialActionRender, private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly SocialActionRender $socialActionRender, private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php index 2b3c3674e..9dd9a7399 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php @@ -16,9 +16,7 @@ use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; class LabelPersonHelper { - public function __construct(private readonly PersonRepository $personRepository, private readonly PersonRenderInterface $personRender) - { - } + public function __construct(private readonly PersonRepository $personRepository, private readonly PersonRenderInterface $personRender) {} public function getLabel(string $key, array $values, string $header): callable { diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index 2c2bc1d02..4aa0733d7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -83,8 +83,7 @@ final readonly class ListAccompanyingPeriodHelper private TranslatorInterface $translator, private UserHelper $userHelper, private LabelPersonHelper $labelPersonHelper, - ) { - } + ) {} public function getQueryKeys($data) { diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index eef69e4fc..576885f2d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -69,9 +69,7 @@ class ListPersonHelper 'lifecycleUpdate', ]; - public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly CenterRepositoryInterface $centerRepository, private readonly CivilityRepositoryInterface $civilityRepository, private readonly CountryRepository $countryRepository, private readonly LanguageRepositoryInterface $languageRepository, private readonly MaritalStatusRepositoryInterface $maritalStatusRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator, private readonly UserRepositoryInterface $userRepository) - { - } + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly CenterRepositoryInterface $centerRepository, private readonly CivilityRepositoryInterface $civilityRepository, private readonly CountryRepository $countryRepository, private readonly LanguageRepositoryInterface $languageRepository, private readonly MaritalStatusRepositoryInterface $maritalStatusRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator, private readonly UserRepositoryInterface $userRepository) {} /** * Those keys are the "direct" keys, which are created when we decide to use to list all the keys. diff --git a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php index 5116ff1b0..fd7ef3ecb 100644 --- a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php +++ b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php @@ -26,9 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class ClosingMotiveType extends AbstractType { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php index 0fe60cbe9..2df66039f 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php @@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HouseholdCompositionType extends AbstractType { - public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index a4946b52d..2063b0e21 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -29,9 +29,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php index cce3ca46d..0d7a3bb4b 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -23,9 +23,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class SocialIssueType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php index 17aad8bd0..6d983be37 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php @@ -21,9 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonAltNameType extends AbstractType { - public function __construct(private readonly ConfigPersonAltNamesHelper $configHelper, private readonly TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private readonly ConfigPersonAltNamesHelper $configHelper, private readonly TranslatableStringHelper $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index a55721011..0e84bfc83 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -24,9 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonPhoneType extends AbstractType { - public function __construct(private readonly PhonenumberHelper $phonenumberHelper, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly PhonenumberHelper $phonenumberHelper, private readonly EntityManagerInterface $em) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php index 71fd36225..01e3b3585 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php @@ -26,9 +26,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickPersonDynamicType extends AbstractType { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php index 0fe09e56a..19258f23d 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php @@ -20,9 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialActionType extends AbstractType { - public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) - { - } + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php index 3e6ae1e97..b61343423 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php @@ -20,9 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialIssueType extends AbstractType { - public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) - { - } + public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php index c33244635..2016fb80a 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php @@ -25,9 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2MaritalStatusType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index e61fbe105..ee93efd6b 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -42,8 +42,7 @@ class MembersEditor private readonly ValidatorInterface $validator, private readonly ?Household $household, private readonly EventDispatcherInterface $eventDispatcher - ) { - } + ) {} /** * Add a person to the household. diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php index cb6f7d4ea..071866b96 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php @@ -17,9 +17,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class MembersEditorFactory { - public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator) - { - } + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator) {} public function createEditor(?Household $household = null): MembersEditor { diff --git a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php index 870f021f5..c82038b40 100644 --- a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php @@ -28,9 +28,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface /** * SectionMenuBuilder constructor. */ - public function __construct(protected ParameterBagInterface $parameterBag, private readonly Security $security, protected TranslatorInterface $translator) - { - } + public function __construct(protected ParameterBagInterface $parameterBag, private readonly Security $security, protected TranslatorInterface $translator) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php index 4f1146391..668f868ae 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php @@ -18,9 +18,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; final readonly class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) - { - } + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) {} public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php index f69c49071..40aff8570 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php @@ -18,9 +18,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvalu final readonly class AccompanyingPeriodWorkEvaluationDocumentNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository) - { - } + public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository) {} public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php index abb8123bc..e147fa520 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php @@ -18,9 +18,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepos final readonly class AccompanyingPeriodWorkNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) - { - } + public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {} public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php index f6619317f..739387941 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php @@ -37,9 +37,7 @@ class AccompanyingPeriodPrivacyEvent extends \Symfony\Contracts\EventDispatcher\ { final public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; - public function __construct(protected $period, protected $args = []) - { - } + public function __construct(protected $period, protected $args = []) {} public function getArgs(): array { diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php index 4e728c635..df57a08fd 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php @@ -48,9 +48,7 @@ class PrivacyEvent extends \Symfony\Contracts\EventDispatcher\Event /** * PrivacyEvent constructor. */ - public function __construct(private readonly Person $person, private readonly array $args = ['action' => 'show']) - { - } + public function __construct(private readonly Person $person, private readonly array $args = ['action' => 'show']) {} public function addPerson(Person $person) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index e058c4e8d..32c2a6f80 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -40,8 +40,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin private Security $security, private AuthorizationHelperForCurrentUserInterface $authorizationHelper, private CenterResolverManagerInterface $centerResolver - ) { - } + ) {} public function buildQueryOpenedAccompanyingCourseByUserAndPostalCodes(?User $user, array $postalCodes = []): QueryBuilder { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php index 6460ba958..26121ffdc 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php @@ -21,9 +21,7 @@ use Symfony\Component\Security\Core\Security; final readonly class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryInterface { - public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) - { - } + public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) {} public function addACL(QueryBuilder $qb, string $alias = 'h'): QueryBuilder { diff --git a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php index c1bb427fd..fc5d0606d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php @@ -13,6 +13,4 @@ namespace Chill\PersonBundle\Repository\Person; use Doctrine\Persistence\ObjectRepository; -interface PersonCenterHistoryInterface extends ObjectRepository -{ -} +interface PersonCenterHistoryInterface extends ObjectRepository {} diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index f59f843ac..303773c3e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -25,9 +25,7 @@ use Symfony\Component\Security\Core\Security; final readonly class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface { - public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) - { - } + public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) {} public function buildAuthorizedQuery( ?string $default = null, @@ -112,8 +110,8 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor $andWhereSearchClause = []; $andWhereSearchClauseArgs = []; - if ('' !== trim($default)) { - foreach (\explode(' ', $default) as $str) { + if ('' !== trim((string) $default)) { + foreach (\explode(' ', (string) $default) as $str) { if ('' === trim($str)) { continue; } diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index b22253abe..9ca72ecac 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -36,9 +36,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf 'birthdate-after', 'gender', 'nationality', 'phonenumber', 'city', ]; - public function __construct(private readonly \Twig\Environment $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository) - { - } + public function __construct(private readonly \Twig\Environment $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php index 1f04df11b..6fdd66a84 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php @@ -22,9 +22,7 @@ use Symfony\Component\Security\Core\Security; class SearchHouseholdApiProvider implements SearchApiInterface { - public function __construct(private readonly HouseholdRepository $householdRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) - { - } + public function __construct(private readonly HouseholdRepository $householdRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) {} public function getResult(string $key, array $metadata, float $pertinence) { diff --git a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php index 0d721c657..8444a41ec 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php @@ -22,9 +22,7 @@ use Symfony\Component\Security\Core\Security; class SearchPersonApiProvider implements SearchApiInterface { - public function __construct(private readonly PersonRepository $personRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) - { - } + public function __construct(private readonly PersonRepository $personRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) {} public function getResult(string $key, array $metadata, float $pertinence) { diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php index 383e76276..3bba4f5c5 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php @@ -22,9 +22,7 @@ class AccompanyingPeriodCommentVoter extends Voter final public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT'; - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php index 5a59e6b4b..5750a7b58 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php @@ -20,9 +20,7 @@ class AccompanyingPeriodResourceVoter extends Voter { final public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_RESOURCE_EDIT'; - public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) - { - } + public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php index eb49e0cbe..77c131cd9 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php @@ -25,9 +25,7 @@ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter { final public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_DOCUMENT_SHOW'; - public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) - { - } + public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php index 41a464581..ce5faca8d 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php @@ -28,9 +28,7 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI final public const STATS = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_STATS'; - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index 80480cd33..e266fe0ae 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -71,9 +71,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'pinnedComment' => AccompanyingPeriod\Comment::class, ]; - public function __construct(private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SocialIssueRender $socialIssueRender, private readonly ClosingMotiveRender $closingMotiveRender, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) - { - } + public function __construct(private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SocialIssueRender $socialIssueRender, private readonly ClosingMotiveRender $closingMotiveRender, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) {} /** * @param AccompanyingPeriod|null $period diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index f5720e5bc..2e26e96c4 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -28,9 +28,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface use ObjectToPopulateTrait; - public function __construct(private readonly ResourceRepository $repository) - { - } + public function __construct(private readonly ResourceRepository $repository) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php index 036b62ec0..e5cd50f09 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php @@ -35,9 +35,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte final public const GROUP_EDIT = 'accompanying_period_work:edit'; - public function __construct(private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly EntityManagerInterface $em) - { - } + public function __construct(private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly EntityManagerInterface $em) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php index b476c2f5f..1e42dac06 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php @@ -25,9 +25,7 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware private const SKIP = 'accompanying_period_work_evaluation_document_skip'; - public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) - { - } + public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) {} public function normalize($object, ?string $format = null, array $context = []): array { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 016098535..efab6babf 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -26,9 +26,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz private const IGNORE_EVALUATION = 'evaluation:ignore'; - public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) - { - } + public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) {} /** * @param AccompanyingPeriodWorkEvaluation $object diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php index 438e89093..b0e87df97 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php @@ -28,9 +28,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac private const IGNORE_WORK = 'ignore:work'; - public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) - { - } + public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) {} /** * @param AccompanyingPeriodWork $object diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index d9679a699..0e358483e 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -27,9 +27,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize { use DenormalizerAwareTrait; - public function __construct(private readonly MembersEditorFactory $factory) - { - } + public function __construct(private readonly MembersEditorFactory $factory) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 2f2458c90..c8f9cf455 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -40,9 +40,7 @@ class PersonDocGenNormalizer implements private const CIRCULAR_KEY = 'person:circular'; - public function __construct(private readonly PersonRenderInterface $personRender, private readonly RelationshipRepository $relationshipRepository, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SummaryBudgetInterface $summaryBudget) - { - } + public function __construct(private readonly PersonRenderInterface $personRender, private readonly RelationshipRepository $relationshipRepository, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SummaryBudgetInterface $summaryBudget) {} public function normalize($person, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 3d99adf17..eae33f399 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -48,8 +48,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar private readonly CenterResolverManagerInterface $centerResolverManager, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly PhoneNumberHelperInterface $phoneNumberHelper - ) { - } + ) {} public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php index 96f9ea934..36ec86966 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php @@ -19,6 +19,4 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ interface PersonJsonNormalizerInterface extends DenormalizerInterface, - NormalizerInterface -{ -} + NormalizerInterface {} diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php index 78a6d8769..402f5ff03 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php @@ -22,9 +22,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N { use NormalizerAwareTrait; - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} /** * @param Relationship $relation diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php index 12c36b286..78a91bd9c 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php @@ -21,9 +21,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - public function __construct(private readonly SocialActionRender $render) - { - } + public function __construct(private readonly SocialActionRender $render) {} public function normalize($socialAction, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php index e2a60b20c..778336d2b 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php @@ -21,9 +21,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz { use NormalizerAwareTrait; - public function __construct(private readonly SocialIssueRender $render) - { - } + public function __construct(private readonly SocialIssueRender $render) {} public function normalize($socialIssue, $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php index 99314ebdc..b45da9d2f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php @@ -25,9 +25,7 @@ class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerA private const IGNORE_ENTITY_WORKFLOW = 'ignore:entity_workflow'; - public function __construct(private readonly Registry $registry, private readonly MetadataExtractor $metadataExtractor) - { - } + public function __construct(private readonly Registry $registry, private readonly MetadataExtractor $metadataExtractor) {} /** * @param EntityWorkflow $object diff --git a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php index d82156994..44d2e38d5 100644 --- a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php +++ b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php @@ -20,9 +20,7 @@ use Psr\Log\LoggerInterface; class OldDraftAccompanyingPeriodRemover implements OldDraftAccompanyingPeriodRemoverInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger) - { - } + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger) {} public function remove(\DateInterval $interval): void { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index 592ab21fb..b01e7c5f3 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -60,8 +60,7 @@ class AccompanyingPeriodContext implements private readonly BaseContextData $baseContextData, private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository - ) { - } + ) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php index c3f754eab..4c1be8159 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php @@ -29,9 +29,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ class AccompanyingPeriodWorkContext implements DocGeneratorContextWithPublicFormInterface { - public function __construct(private readonly AccompanyingPeriodContext $periodContext, private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly AccompanyingPeriodContext $periodContext, private readonly NormalizerInterface $normalizer) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index 8887e65c9..6ecaa99b4 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -37,9 +37,7 @@ class AccompanyingPeriodWorkEvaluationContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private readonly AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, private readonly EntityManagerInterface $em, private readonly EvaluationRepository $evaluationRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, private readonly EntityManagerInterface $em, private readonly EvaluationRepository $evaluationRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php index d865d686a..7f142fdbf 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php @@ -31,8 +31,7 @@ class PersonContextWithThirdParty implements DocGeneratorContextWithAdminFormInt private readonly PersonContextInterface $personContext, private readonly NormalizerInterface $normalizer, private readonly ThirdPartyRepository $thirdPartyRepository - ) { - } + ) {} public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodViewEntityInfoProvider.php b/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodViewEntityInfoProvider.php index a157c392b..19059ef47 100644 --- a/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodViewEntityInfoProvider.php +++ b/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodViewEntityInfoProvider.php @@ -21,8 +21,7 @@ class AccompanyingPeriodViewEntityInfoProvider implements ViewEntityInfoProvider */ private readonly iterable $unions, private readonly AccompanyingPeriodInfoQueryBuilder $builder, - ) { - } + ) {} public function getViewQuery(): string { diff --git a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php index 7d6e199bd..a9617e3c9 100644 --- a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php +++ b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php @@ -30,8 +30,7 @@ final readonly class AccompanyingPeriodWorkEvaluationGenericDocProvider implemen public function __construct( private Security $security, private EntityManagerInterface $entityManager, - ) { - } + ) {} public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Renderer/AccompanyingPeriodWorkEvaluationGenericDocRenderer.php b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Renderer/AccompanyingPeriodWorkEvaluationGenericDocRenderer.php index 207d90edd..7c6f2264f 100644 --- a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Renderer/AccompanyingPeriodWorkEvaluationGenericDocRenderer.php +++ b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Renderer/AccompanyingPeriodWorkEvaluationGenericDocRenderer.php @@ -20,8 +20,7 @@ final readonly class AccompanyingPeriodWorkEvaluationGenericDocRenderer implemen { public function __construct( private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository, - ) { - } + ) {} public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index 7ce08fd3b..21406072d 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -27,9 +27,7 @@ use Doctrine\Persistence\ObjectRepository; final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface { - public function __construct(private SocialIssueRepository $socialIssueRepository, private SocialActionRepository $socialActionRepository, private GoalRepository $goalRepository, private ResultRepository $resultRepository, private EvaluationRepository $evaluationRepository, private EntityManagerInterface $entityManager) - { - } + public function __construct(private SocialIssueRepository $socialIssueRepository, private SocialActionRepository $socialActionRepository, private GoalRepository $goalRepository, private ResultRepository $resultRepository, private EvaluationRepository $evaluationRepository, private EntityManagerInterface $entityManager) {} /** * @throws \Exception diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadataInterface.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadataInterface.php index f61d22252..f31612606 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadataInterface.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadataInterface.php @@ -11,6 +11,4 @@ declare(strict_types=1); namespace Chill\PersonBundle\Service\Import; -interface SocialWorkMetadataInterface extends ChillImporter -{ -} +interface SocialWorkMetadataInterface extends ChillImporter {} diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php index e09c659c0..29ed4226a 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php @@ -30,8 +30,7 @@ final readonly class ClosingMotiveRender implements ChillEntityRenderInterface public function __construct( private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator - ) { - } + ) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index fe41d974e..a09ad11f5 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -23,9 +23,7 @@ class PersonRender implements PersonRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {} public function renderBox($person, array $options): string { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php index 2f69d31a9..203281b67 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -19,6 +19,4 @@ use Chill\PersonBundle\Entity\Person; * * @extends ChillEntityRenderInterface */ -interface PersonRenderInterface extends ChillEntityRenderInterface -{ -} +interface PersonRenderInterface extends ChillEntityRenderInterface {} diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php index 87e658766..b9cf28fb7 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php @@ -20,9 +20,7 @@ use Chill\PersonBundle\Entity\Person\PersonResourceKind; */ final readonly class ResourceKindRender implements ChillEntityRenderInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(private TranslatableStringHelper $translatableStringHelper) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php index a13df7ecc..657ed0f53 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php @@ -43,9 +43,7 @@ class SocialActionRender implements ChillEntityRenderInterface */ final public const SHOW_AND_CHILDREN = 'show_and_children'; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {} public function renderBox($socialAction, array $options): string { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index 17e211892..af8622f67 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -37,9 +37,7 @@ final readonly class SocialIssueRender implements ChillEntityRenderInterface */ public const SHOW_AND_CHILDREN = 'show_and_children'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine, private TranslatorInterface $translator) - { - } + public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine, private TranslatorInterface $translator) {} public function renderBox($socialIssue, array $options): string { diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php index dc5252108..75e3877bc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php @@ -121,9 +121,7 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T protected function generateClass(AccompanyingPeriod $period, Collection $socialIssues): AccompanyingPeriodLinkedWithSocialIssuesEntityInterface { return new class ($period, $socialIssues) implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface { - public function __construct(public $period, public $socialIssues) - { - } + public function __construct(public $period, public $socialIssues) {} public function getAccompanyingPeriod(): AccompanyingPeriod { diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php index b16560831..3926c19d2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php @@ -123,8 +123,8 @@ class ConflictTest extends WebTestCase public function generateAccompanyingPeriodWork(): iterable { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); - $userRepository = self::$container->get(UserRepositoryInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); + $userRepository = self::getContainer()->get(UserRepositoryInterface::class); $user = $userRepository->findOneByUsernameOrEmail('center a_social'); $period = new AccompanyingPeriod(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php index 053dfef1c..ee2373e11 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php @@ -43,9 +43,7 @@ final class PersonControllerUpdateTest extends WebTestCase /** * Prepare client and create a random person. */ - protected function setUp(): void - { - } + protected function setUp(): void {} protected function tearDown(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php index 8e9cdaf6d..6b83fa952 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php @@ -29,7 +29,7 @@ final class PersonParticipatingAggregatorTest extends AbstractAggregatorTest protected function setUp(): void { self::bootKernel(); - $this->labelPersonHelper = self::$container->get(LabelPersonHelper::class); + $this->labelPersonHelper = self::getContainer()->get(LabelPersonHelper::class); } public function getAggregator() @@ -46,7 +46,7 @@ final class PersonParticipatingAggregatorTest extends AbstractAggregatorTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php index 2ce63af34..475a67470 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php @@ -32,8 +32,8 @@ class ByClosingMotiveAggregatorTest extends AbstractAggregatorTest { parent::setUp(); self::bootKernel(); - $this->closingMotiveRender = self::$container->get(ClosingMotiveRender::class); - $this->closingMotiveRepository = self::$container->get(ClosingMotiveRepositoryInterface::class); + $this->closingMotiveRender = self::getContainer()->get(ClosingMotiveRender::class); + $this->closingMotiveRepository = self::getContainer()->get(ClosingMotiveRepositoryInterface::class); } public function getAggregator() @@ -54,7 +54,7 @@ class ByClosingMotiveAggregatorTest extends AbstractAggregatorTest public function getQueryBuilders() { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php index 74a30d1a6..687a07e97 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php @@ -47,7 +47,7 @@ class ByDateAggregatorTest extends AbstractAggregatorTest public function getQueryBuilders() { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php index 65752fea2..4e15b5286 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -44,7 +44,7 @@ class ByStepAggregatorTest extends AbstractAggregatorTest public function getQueryBuilders() { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php index 19adee99f..6d3a30a4e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php @@ -30,7 +30,7 @@ final class CountAccompanyingCourseStepHistoryTest extends AbstractExportTest public function getExport() { - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); yield new CountAccompanyingCourseStepHistory($em, $this->getParameters(true)); yield new CountAccompanyingCourseStepHistory($em, $this->getParameters(false)); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php index 5c1b8b9c7..7c07014da 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php @@ -30,7 +30,7 @@ class HasTemporaryLocationFilterTest extends AbstractFilterTest { self::bootKernel(); - $this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + $this->rollingDateConverter = self::getContainer()->get(RollingDateConverterInterface::class); } public function getFilter() @@ -56,7 +56,7 @@ class HasTemporaryLocationFilterTest extends AbstractFilterTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php index c71088159..796bbb30a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php @@ -55,7 +55,7 @@ class NotAssociatedWithAReferenceAddressFilterTest extends AbstractFilterTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php index 9b0eb4d72..af7b1e0fa 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php @@ -34,8 +34,8 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest { parent::setUp(); self::bootKernel(); - $this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); - $this->userRender = self::$container->get(UserRender::class); + $this->rollingDateConverter = self::getContainer()->get(RollingDateConverterInterface::class); + $this->userRender = self::getContainer()->get(UserRender::class); } public function getFilter() @@ -46,7 +46,7 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest public function getFormData() { self:self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $users = $em->createQueryBuilder() ->from(User::class, 'u') @@ -68,7 +68,7 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); yield $em->createQueryBuilder() ->from(AccompanyingPeriod::class, 'acp') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php index 978bf9488..77f131c98 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php @@ -32,7 +32,7 @@ class ByDateFilterTest extends AbstractFilterTest parent::setUp(); self::bootKernel(); - $this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + $this->rollingDateConverter = self::getContainer()->get(RollingDateConverterInterface::class); } public function getFilter() @@ -53,7 +53,7 @@ class ByDateFilterTest extends AbstractFilterTest public function getQueryBuilders() { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index 2924be7e7..77ff35ad6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -52,7 +52,7 @@ class ByStepFilterTest extends AbstractFilterTest public function getQueryBuilders() { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php index d9c58e743..6951ce0bd 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php @@ -30,7 +30,7 @@ final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest { self::bootKernel(); - $this->filter = self::$container->get(WithParticipationBetweenDatesFilter::class); + $this->filter = self::getContainer()->get(WithParticipationBetweenDatesFilter::class); } public function getFilter() @@ -52,7 +52,7 @@ final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() diff --git a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php index 401ef5a07..6973eba1d 100644 --- a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php @@ -31,9 +31,7 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt { private const SUPPORTED_CONTEXTS = ['person', 'center']; - public function __construct(protected EntityManager $em, private readonly Security $security, private readonly AuthorizationHelper $authorizationHelper) - { - } + public function __construct(protected EntityManager $em, private readonly Security $security, private readonly AuthorizationHelper $authorizationHelper) {} public function getEntities(array $ids) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php index 3c3ff4d4d..6198e4e47 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php @@ -23,9 +23,7 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class AccompanyingPeriodValidityValidator extends ConstraintValidator { - public function __construct(private readonly ActivityRepository $activityRepository, private readonly SocialIssueRender $socialIssueRender, private readonly TokenStorageInterface $token) - { - } + public function __construct(private readonly ActivityRepository $activityRepository, private readonly SocialIssueRender $socialIssueRender, private readonly TokenStorageInterface $token) {} public function validate($period, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php index 4de58387a..4b4a13c18 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php @@ -20,9 +20,7 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class LocationValidityValidator extends ConstraintValidator { - public function __construct(private readonly PersonRenderInterface $render) - { - } + public function __construct(private readonly PersonRenderInterface $render) {} public function validate($period, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index 7ab10d1f9..d3c25199b 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -24,9 +24,7 @@ class ParticipationOverlapValidator extends ConstraintValidator { private const MAX_PARTICIPATION = 1; - public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) - { - } + public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) {} public function validate($participations, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index 96f63f19b..d7573c400 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -21,9 +21,7 @@ use Symfony\Component\Validator\ConstraintValidator; class ResourceDuplicateCheckValidator extends ConstraintValidator { - public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) - { - } + public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) {} public function validate($resources, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index 8c1eebce2..2ca0af42c 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -24,9 +24,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; */ class HouseholdMembershipSequentialValidator extends ConstraintValidator { - public function __construct(private readonly PersonRenderInterface $render) - { - } + public function __construct(private readonly PersonRenderInterface $render) {} public function validate($person, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php index 4c340fc81..8a54de53e 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php @@ -20,9 +20,7 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class RelationshipNoDuplicateValidator extends ConstraintValidator { - public function __construct(private readonly RelationshipRepository $relationshipRepository) - { - } + public function __construct(private readonly RelationshipRepository $relationshipRepository) {} public function validate($value, Constraint $constraint) { diff --git a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php index b80c91f6e..aab72f148 100644 --- a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php +++ b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php @@ -34,9 +34,7 @@ class PersonListWidget implements WidgetInterface { protected UserInterface $user; - public function __construct(protected PersonRepository $personRepository, protected EntityManagerInterface $entityManager, protected AuthorizationHelperInterface $authorizationHelper, protected TokenStorageInterface $tokenStorage) - { - } + public function __construct(protected PersonRepository $personRepository, protected EntityManagerInterface $entityManager, protected AuthorizationHelperInterface $authorizationHelper, protected TokenStorageInterface $tokenStorage) {} public function render(Environment $env, $place, array $context, array $config) { diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php index 19c8949c9..0fc13224e 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php @@ -21,9 +21,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private readonly AccompanyingPeriodWorkEvaluationDocumentRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly AccompanyingPeriodWorkEvaluationDocumentRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function getDeletionRoles(): array { diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php index 17a1eba45..63b34d1dc 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php @@ -22,9 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function getDeletionRoles(): array { diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index b78b81a20..5c74e5b17 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -23,9 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private readonly AccompanyingPeriodWorkRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly AccompanyingPeriodWorkRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function getDeletionRoles(): array { diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php index da6cf8552..159e969a3 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php @@ -19,9 +19,7 @@ use Doctrine\Migrations\AbstractMigration; */ class Version20160422000000 extends AbstractMigration { - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} public function up(Schema $schema): void { diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210419112619.php b/src/Bundle/ChillPersonBundle/migrations/Version20210419112619.php index 8db3880ed..e713486d0 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20210419112619.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210419112619.php @@ -19,9 +19,7 @@ use Doctrine\Migrations\AbstractMigration; */ final class Version20210419112619 extends AbstractMigration { - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} public function getDescription(): string { diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20231121070151.php b/src/Bundle/ChillPersonBundle/migrations/Version20231121070151.php index c85132aff..1123ef1c3 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20231121070151.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20231121070151.php @@ -29,7 +29,5 @@ final class Version20231121070151 extends AbstractMigration $this->addSql("UPDATE chill_person_person SET gender = 'both' WHERE chill_person_person.gender = 'neuter'"); } - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} } diff --git a/src/Bundle/ChillReportBundle/ChillReportBundle.php b/src/Bundle/ChillReportBundle/ChillReportBundle.php index ef92fa192..76bc4c9b2 100644 --- a/src/Bundle/ChillReportBundle/ChillReportBundle.php +++ b/src/Bundle/ChillReportBundle/ChillReportBundle.php @@ -13,6 +13,4 @@ namespace Chill\ReportBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillReportBundle extends Bundle -{ -} +class ChillReportBundle extends Bundle {} diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php index 02c7ffb46..13c16672b 100644 --- a/src/Bundle/ChillReportBundle/Controller/ReportController.php +++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -38,8 +38,7 @@ class ReportController extends AbstractController private readonly PaginatorFactory $paginator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry - ) { - } + ) {} /** * Create a new report for a given person and of a given type. diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index 7f281c2cb..1761e3522 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -46,9 +46,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface protected array $slugs = []; - public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em) - { - } + public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em) {} public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php index 68fc7b001..0346f2ab3 100644 --- a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php +++ b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php @@ -19,9 +19,7 @@ use Doctrine\ORM\Query\Expr; class ReportDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) - { - } + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php index 743d83c8a..6c0769e56 100644 --- a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php @@ -44,9 +44,7 @@ final class ReportVoterTest extends KernelTestCase */ protected $voter; - public static function setUpBeforeClass(): void - { - } + public static function setUpBeforeClass(): void {} protected function setUp(): void { diff --git a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php index 6a3f00dd5..17b600149 100644 --- a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php +++ b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php @@ -25,9 +25,7 @@ use Symfony\Component\Security\Core\Security; */ class TimelineReportProvider implements TimelineProviderInterface { - public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) - { - } + public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) {} public function fetchQuery($context, array $args) { diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index b46d41191..200a8fbac 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -60,8 +60,7 @@ final class SingleTaskController extends AbstractController private readonly SingleTaskRepository $singleTaskRepository, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, - ) { - } + ) {} /** * @Route( diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php index 2d4c7cef9..7e572e078 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php @@ -27,9 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class SingleTaskType extends AbstractType { - public function __construct(private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) - { - } + public function __construct(private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillTaskBundle/Repository/AbstractTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/AbstractTaskRepository.php index d19420580..6ac7f10ec 100644 --- a/src/Bundle/ChillTaskBundle/Repository/AbstractTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/AbstractTaskRepository.php @@ -17,6 +17,4 @@ namespace Chill\TaskBundle\Repository; * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ -abstract class AbstractTaskRepository extends \Doctrine\ORM\EntityRepository -{ -} +abstract class AbstractTaskRepository extends \Doctrine\ORM\EntityRepository {} diff --git a/src/Bundle/ChillTaskBundle/Repository/RecurringTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/RecurringTaskRepository.php index 4bbedd1bb..985aa9935 100644 --- a/src/Bundle/ChillTaskBundle/Repository/RecurringTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/RecurringTaskRepository.php @@ -17,6 +17,4 @@ namespace Chill\TaskBundle\Repository; * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ -class RecurringTaskRepository extends \Doctrine\ORM\EntityRepository -{ -} +class RecurringTaskRepository extends \Doctrine\ORM\EntityRepository {} diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index d72c23298..3f0966a45 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -23,9 +23,7 @@ use Symfony\Component\Security\Core\Security; final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface { - public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper) - { - } + public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper) {} public function buildBaseQuery( ?string $pattern = null, diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php index 477788aa7..614870264 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskStateRepository.php @@ -22,8 +22,7 @@ class SingleTaskStateRepository public function __construct( private readonly Connection $connection - ) { - } + ) {} /** * Return a list of all states associated to at least one single task in the database. diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index 3b2de6ed5..2b39ead51 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -29,8 +29,7 @@ class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event private readonly AbstractTask|AccompanyingPeriod|Person|null $subject, private readonly string $attribute, private readonly TokenInterface $token - ) { - } + ) {} public function getAttribute() { diff --git a/src/Bundle/ChillTaskBundle/Tests/Controller/TaskControllerTest.php b/src/Bundle/ChillTaskBundle/Tests/Controller/TaskControllerTest.php index d4169549c..e8758290a 100644 --- a/src/Bundle/ChillTaskBundle/Tests/Controller/TaskControllerTest.php +++ b/src/Bundle/ChillTaskBundle/Tests/Controller/TaskControllerTest.php @@ -18,6 +18,4 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; * * @coversNothing */ -final class TaskControllerTest extends WebTestCase -{ -} +final class TaskControllerTest extends WebTestCase {} diff --git a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php index fa4c2527e..98b38a989 100644 --- a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php +++ b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php @@ -30,9 +30,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface { final public const TYPE = 'chill_task.transition'; - public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security) - { - } + public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security) {} public function fetchQuery($context, $args) { diff --git a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowDefinition.php b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowDefinition.php index 76a8da7c8..81fea25e6 100644 --- a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowDefinition.php +++ b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowDefinition.php @@ -11,6 +11,4 @@ declare(strict_types=1); namespace Chill\TaskBundle\Workflow; -interface TaskWorkflowDefinition -{ -} +interface TaskWorkflowDefinition {} diff --git a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php index 41e18d62c..e92cdae93 100644 --- a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php +++ b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php @@ -16,9 +16,7 @@ use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; class LabelThirdPartyHelper { - public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository) - { - } + public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository) {} public function getLabel(string $key, array $values, string $header): callable { diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php index b2ef89132..77720331d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php @@ -24,9 +24,7 @@ class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractTyp { private const PREFIX_TYPE = 'chill_3party.key_label.'; - public function __construct(private readonly ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private readonly ThirdPartyTypeManager $thirdPartyTypeManager, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private readonly ThirdPartyTypeManager $thirdPartyTypeManager, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php index e46e4544e..5e704fdcb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php @@ -26,9 +26,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickThirdpartyDynamicType extends AbstractType { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) - { - } + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {} public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php index 3538a7877..04246d8c8 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Security; final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface { - public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository) - { - } + public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository) {} public function buildQuery(?string $filterString = null): QueryBuilder { diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 844302295..8970fec1c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -44,18 +44,14 @@ FROM rows, searches */ class ThirdPartyApiSearch implements SearchApiInterface { - public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository) - { - } + public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository) {} public function getResult(string $key, array $metadata, float $pertinence) { return $this->thirdPartyRepository->find($metadata['id']); } - public function prepare(array $metadatas): void - { - } + public function prepare(array $metadatas): void {} public function provideQuery(string $pattern, array $parameters): SearchApiQuery { diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index b2271e8df..26f175705 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -24,9 +24,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf { use NormalizerAwareTrait; - public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) - { - } + public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function normalize($thirdParty, $format = null, array $context = []) { diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index 4a7403f17..a36ceda4e 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -23,9 +23,7 @@ class ThirdPartyRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(protected \Twig\Environment $engine, protected TranslatableStringHelper $translatableStringHelper) - { - } + public function __construct(protected \Twig\Environment $engine, protected TranslatableStringHelper $translatableStringHelper) {} public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillWopiBundle/src/ChillWopiBundle.php b/src/Bundle/ChillWopiBundle/src/ChillWopiBundle.php index 5ca164db1..401eb9970 100644 --- a/src/Bundle/ChillWopiBundle/src/ChillWopiBundle.php +++ b/src/Bundle/ChillWopiBundle/src/ChillWopiBundle.php @@ -13,6 +13,4 @@ namespace Chill\WopiBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -final class ChillWopiBundle extends Bundle -{ -} +final class ChillWopiBundle extends Bundle {} diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php index feae8d708..053b7abd0 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php @@ -37,9 +37,7 @@ use Twig\Environment; */ final readonly class Editor { - public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private Environment $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) - { - } + public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private Environment $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) {} public function __invoke(string $fileId, Request $request): Response { diff --git a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php index b85d1b8b3..89eec1685 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php @@ -22,9 +22,7 @@ use Twig\Environment; final readonly class Responder implements ResponderInterface { - public function __construct(private Environment $twig, private UrlGeneratorInterface $urlGenerator, private SerializerInterface $serializer) - { - } + public function __construct(private Environment $twig, private UrlGeneratorInterface $urlGenerator, private SerializerInterface $serializer) {} public function file( $file, diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php index 53e9ad819..1496ba479 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php @@ -19,9 +19,7 @@ use Symfony\Component\Security\Core\Security; class AuthorizationManager implements \ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface { - public function __construct(private readonly JWTTokenManagerInterface $tokenManager, private readonly Security $security) - { - } + public function __construct(private readonly JWTTokenManagerInterface $tokenManager, private readonly Security $security) {} public function isRestrictedWebViewOnly(string $accessToken, Document $document, RequestInterface $request): bool { diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php index 594bdffcc..e6889778c 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php @@ -28,8 +28,7 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface public function __construct( private readonly ChillRedis $redis, private readonly int $ttlAfterDeleteSeconds = self::LOCK_GRACEFUL_DURATION_TIME - ) { - } + ) {} public function deleteLock(Document $document, RequestInterface $request): bool { diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php index 189b780b2..9f2dac4f0 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php @@ -17,9 +17,7 @@ use Psr\Http\Message\ResponseInterface; final readonly class ChillWopi implements WopiInterface { - public function __construct(private WopiInterface $wopi) - { - } + public function __construct(private WopiInterface $wopi) {} public function checkFileInfo( string $fileId, diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php index 4a0857521..f72ae3cde 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Security; class UserManager implements \ChampsLibres\WopiBundle\Contracts\UserManagerInterface { - public function __construct(private readonly Security $security) - { - } + public function __construct(private readonly Security $security) {} public function getUserFriendlyName(string $accessToken, string $fileId, RequestInterface $request): ?string { diff --git a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php index a087c20d9..b2efd260a 100644 --- a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php +++ b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php @@ -25,8 +25,7 @@ class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends Abstra { public function __construct( private readonly ClassAnalyzer $classAnalyzer, - ) { - } + ) {} public function getRuleDefinition(): RuleDefinition { From 2ddfd564017ce7a56a2f6d8989bf1ef2276ebd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 13 Feb 2024 19:12:14 +0100 Subject: [PATCH 054/251] fix phpstan and rector errors, fix path for rector rules --- .../Controller/CustomFieldController.php | 2 +- .../CRUD/Controller/AbstractCRUDController.php | 4 +--- .../ChillMainBundle/Tests/Export/SortExportElementTest.php | 2 +- .../Controller/AccompanyingCourseCommentController.php | 2 +- src/Bundle/ChillPersonBundle/Entity/Person.php | 6 +++--- .../ByStepAggregatorTest.php | 2 +- .../ByStepFilterTest.php | 2 +- ...ndleAddFormDefaultDataOnExportFilterAggregatorRector.php | 6 +++--- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index 2bb381d8b..85b5d9261 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -14,7 +14,7 @@ namespace Chill\CustomFieldsBundle\Controller; use Chill\CustomFieldsBundle\Entity\CustomField; use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup; use Chill\CustomFieldsBundle\Form\CustomFieldType; -use Symfony\Bridge\Doctrine\ManagerRegistry; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 882187fad..ea5e55a69 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -39,8 +39,6 @@ abstract class AbstractCRUDController extends AbstractController */ protected array $crudConfig = []; - public function __construct(private readonly ManagerRegistry $managerRegistry) {} - /** * get the role given from the config. */ @@ -183,7 +181,7 @@ abstract class AbstractCRUDController extends AbstractController $expectedVersion = $request->query->getInt('entity_version'); try { - $manager = $this->managerRegistry->getManagerForClass($this->getEntityClass()); + $manager = $this->getManagerRegistry()->getManagerForClass($this->getEntityClass()); if ($manager instanceof EntityManagerInterface) { $manager->lock($e, LockMode::OPTIMISTIC, $expectedVersion); diff --git a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php index cd820bb1c..02cf0a90f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php @@ -102,7 +102,7 @@ class SortExportElementTest extends KernelTestCase private function makeTranslator(): TranslatorInterface { return new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) { return $id; } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index cbead99f4..d4a78fc18 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -16,8 +16,8 @@ use Chill\PersonBundle\Form\AccompanyingCourseCommentType; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\Persistence\ManagerRegistry; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; -use Symfony\Bridge\Doctrine\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 6f56d82ec..d337d5d7f 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -503,7 +503,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI /** * The person's spoken languages. * - * @var Collection + * @var Collection * * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language") * @@ -1788,9 +1788,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI } /** - * @param (\Doctrine\Common\Collections\Collection&\iterable<\Chill\MainBundle\Entity\Language>) $spokenLanguages + * @param (\Doctrine\Common\Collections\Collection) $spokenLanguages */ - public function setSpokenLanguages(mixed $spokenLanguages): self + public function setSpokenLanguages(Collection $spokenLanguages): self { $this->spokenLanguages = $spokenLanguages; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php index 4e15b5286..6b75f6634 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -27,7 +27,7 @@ class ByStepAggregatorTest extends AbstractAggregatorTest public function getAggregator() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) { return $id; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index 77ff35ad6..18415ac89 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -28,7 +28,7 @@ class ByStepFilterTest extends AbstractFilterTest public function getFilter() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) { return $id; } diff --git a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php index b2efd260a..81279823b 100644 --- a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php +++ b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php @@ -17,14 +17,14 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Export\ListInterface; use PhpParser\Node; -use Rector\Core\Rector\AbstractRector; +use Rector\Rector\AbstractRector; use Rector\Symfony\NodeAnalyzer\ClassAnalyzer; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; -class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends AbstractRector +final readonly class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends AbstractRector { public function __construct( - private readonly ClassAnalyzer $classAnalyzer, + private ClassAnalyzer $classAnalyzer, ) {} public function getRuleDefinition(): RuleDefinition From 510023d630cd0500c60bfff92feb2661ce3b9cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 13 Feb 2024 21:04:09 +0100 Subject: [PATCH 055/251] fix cs --- .../ChillMainBundle/Tests/Export/SortExportElementTest.php | 2 +- .../ByStepAggregatorTest.php | 2 +- .../AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php index 02cf0a90f..cd820bb1c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php @@ -102,7 +102,7 @@ class SortExportElementTest extends KernelTestCase private function makeTranslator(): TranslatorInterface { return new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php index 6b75f6634..4e15b5286 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -27,7 +27,7 @@ class ByStepAggregatorTest extends AbstractAggregatorTest public function getAggregator() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index 18415ac89..77ff35ad6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -28,7 +28,7 @@ class ByStepFilterTest extends AbstractFilterTest public function getFilter() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } From 8a2f3d3dd0979b38f2715a2afb5fe8e0abca4038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 13 Feb 2024 21:04:22 +0100 Subject: [PATCH 056/251] Simplify setCenters method and remove readonly property The commit simplifies the setCenters method in the ThirdParty class by directly assigning the incoming centers collection to the $centers property. Additionally, the readonly keyword has been removed from the $centers property declaration, allowing its value to be modified. --- .../ChillThirdPartyBundle/Entity/ThirdParty.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index ee8065662..56a2e4dcd 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -149,7 +149,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\JoinTable(name="chill_3party.party_center") */ - private readonly Collection $centers; + private Collection $centers; /** * Contact Persons: One Institutional ThirdParty has Many Contact Persons. @@ -691,15 +691,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin */ public function setCenters(Collection $centers) { - foreach ($centers as $center) { - $this->addCenter($center); - } - - foreach ($this->centers as $center) { - if (false === $centers->contains($center)) { - $this->removeCenter($center); - } - } + $this->centers = $centers; return $this; } From 9064356bd1d7bbdfdb8c48b87aecaafaec833f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 10:08:53 +0100 Subject: [PATCH 057/251] allow 45 direct deprecations --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 24b42e181..63519eb9d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ variables: # force a timezone TZ: Europe/Brussels # avoid direct deprecations (using symfony phpunit bridge: https://symfony.com/doc/4.x/components/phpunit_bridge.html#internal-deprecations - SYMFONY_DEPRECATIONS_HELPER: max[total]=99999999&max[self]=0&max[direct]=0&verbose=0 + SYMFONY_DEPRECATIONS_HELPER: max[total]=99999999&max[self]=0&max[direct]=45&verbose=0 stages: - Composer install From d5115b37187fad8030f7921285ac9947fc4b6fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 11:10:31 +0100 Subject: [PATCH 058/251] upgrade rector and adapt list --- composer.json | 2 +- rector.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 0aa12badf..a000d5b3c 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,7 @@ "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": ">= 7.5", - "rector/rector": "^0.19.0", + "rector/rector": "^1.0.0", "symfony/debug-bundle": "^5.4", "symfony/dotenv": "^5.4", "symfony/maker-bundle": "^1.20", diff --git a/rector.php b/rector.php index 6b7e1d241..ae5c97531 100644 --- a/rector.php +++ b/rector.php @@ -37,7 +37,6 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->sets([ LevelSetList::UP_TO_PHP_82, \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_50, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, ]); From f251e6f1008051469d0536b7499dd9faf344a240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 12:28:14 +0100 Subject: [PATCH 059/251] upgrade phpunit: make data provider static --- rector.php | 6 ++ .../AsideActivityControllerTest.php | 2 +- .../Controller/CalendarControllerTest.php | 2 +- .../MSGraph/MSUserAbsenceReaderTest.php | 2 +- .../MSGraph/MSUserAbsenceSyncTest.php | 2 +- .../DefaultRangeGeneratorTest.php | 2 +- .../CustomFields/CustomFieldsChoiceTest.php | 4 +- .../Serializer/Encoder/DocGenEncoderTest.php | 2 +- .../TempUrlOpenstackGeneratorTest.php | 4 +- .../Templating/AsyncUploadExtensionTest.php | 2 +- ...ngCourseDocumentGenericDocProviderTest.php | 2 +- .../PersonDocumentGenericDocProviderTest.php | 2 +- .../PersonDocumentACLAwareRepositoryTest.php | 2 +- .../Tests/StoredObjectManagerTest.php | 2 +- .../EventACLAwareRepositoryTest.php | 2 +- .../Controller/AddressControllerTest.php | 2 +- .../AddressReferenceApiControllerTest.php | 2 +- .../Controller/SearchApiControllerTest.php | 2 +- .../Tests/Doctrine/DQL/AgeTest.php | 2 +- .../Doctrine/DQL/JsonBuildObjectTest.php | 2 +- .../Tests/Doctrine/DQL/JsonExtractTest.php | 2 +- .../Tests/Entity/NotificationTest.php | 2 +- .../Tests/Pagination/PageTest.php | 4 +- .../Tests/Pagination/PaginatorTest.php | 8 +- .../Phonenumber/PhonenumberHelperTest.php | 2 +- .../Utils/ExtractDateFromPatternTest.php | 2 +- .../ExtractPhonenumberFromPatternTest.php | 2 +- .../Normalizer/DateNormalizerTest.php | 2 +- .../DoctrineExistingEntityNormalizerTest.php | 2 +- .../Normalizer/PhonenumberNormalizerTest.php | 2 +- .../Normalizer/UserNormalizerTest.php | 2 +- .../RollingDate/RollingDateConverterTest.php | 2 +- .../Templating/Entity/AddressRenderTest.php | 18 ++--- ...ccompanyingPeriodStepChangeCronjobTest.php | 2 +- .../ConflictTest.php | 2 +- .../AccompanyingCourseApiControllerTest.php | 8 +- .../AccompanyingCourseControllerTest.php | 2 +- .../Controller/HouseholdApiControllerTest.php | 4 +- .../Controller/HouseholdControllerTest.php | 2 +- .../HouseholdMemberControllerTest.php | 4 +- .../Controller/PersonApiControllerTest.php | 4 +- ...onControllerUpdateWithHiddenFieldsTest.php | 2 +- .../PersonDuplicateControllerViewTest.php | 2 +- .../RelationshipApiControllerTest.php | 2 +- .../EventListener/PersonCreateEventTest.php | 4 +- .../ActiveOnDateFilterTest.php | 4 +- ...FilterListAccompanyingPeriodHelperTest.php | 7 +- ...companyingPeriodACLAwareRepositoryTest.php | 79 +++++++++++-------- .../Normalizer/PersonDocGenNormalizerTest.php | 4 +- .../AccompanyingPeriodContextTest.php | 2 +- .../DocGenerator/PersonContextTest.php | 2 +- ...ngPeriodCalendarGenericDocProviderTest.php | 14 ++-- ...odWorkEvaluationGenericDocProviderTest.php | 2 +- .../PersonCalendarGenericDocProviderTest.php | 7 +- .../Entity/ClosingMotiveRenderTest.php | 2 +- .../TimelineAccompanyingPeriodTest.php | 2 +- .../Household/MaxHolderValidatorTest.php | 2 +- 57 files changed, 142 insertions(+), 121 deletions(-) diff --git a/rector.php b/rector.php index ae5c97531..b46dd36a6 100644 --- a/rector.php +++ b/rector.php @@ -41,6 +41,12 @@ return static function (RectorConfig $rectorConfig): void { \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, ]); + // migrate for phpunit + $rectorConfig->rules([ + \Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector::class, + \Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector::class + ]); + // some routes are added twice if it remains activated // $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php index 3c2137d84..21e78e6cf 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php @@ -30,7 +30,7 @@ final class AsideActivityControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function generateAsideActivityId(): iterable + public static function generateAsideActivityId(): iterable { self::bootKernel(); diff --git a/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php index 37b97fcf9..ef2597367 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php @@ -42,7 +42,7 @@ final class CalendarControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function provideAccompanyingPeriod(): iterable + public static function provideAccompanyingPeriod(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php index 4307f32a3..3d3a71854 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderTest.php @@ -59,7 +59,7 @@ class MSUserAbsenceReaderTest extends TestCase self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null'); } - public function provideDataTestUserAbsence(): iterable + public static function provideDataTestUserAbsence(): iterable { // contains data that was retrieved from microsoft graph api on 2023-07-06 diff --git a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSyncTest.php b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSyncTest.php index 244c7e468..690fe5222 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSyncTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSyncTest.php @@ -46,7 +46,7 @@ class MSUserAbsenceSyncTest extends TestCase self::assertEquals($expectedAbsenceStart, $user->getAbsenceStart(), $message); } - public function provideDataTestSyncUserAbsence(): iterable + public static function provideDataTestSyncUserAbsence(): iterable { yield [new User(), false, false, null, 'user present remains present']; yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent']; diff --git a/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultRangeGeneratorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultRangeGeneratorTest.php index 552595414..1d28c43c0 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultRangeGeneratorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultRangeGeneratorTest.php @@ -35,7 +35,7 @@ final class DefaultRangeGeneratorTest extends TestCase * * Jeudi => envoi des rdv du samedi et dimanche * * Vendredi => Envoi des rdv du lundi. */ - public function generateData(): \Iterator + public static function generateData(): \Iterator { yield [ new \DateTimeImmutable('2022-06-13 10:45:00'), diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php index 48d4847d6..b9d00d052 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php @@ -55,7 +55,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase * * @return array */ - public function emptyDataProvider() + public static function emptyDataProvider() { return [ // 0 @@ -101,7 +101,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase ]; } - public function serializedRepresentationDataProvider() + public static function serializedRepresentationDataProvider() { return [ [ diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php index a5aa1e9e9..b48f19719 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php @@ -31,7 +31,7 @@ final class DocGenEncoderTest extends TestCase $this->encoder = new DocGenEncoder(); } - public function generateEncodeData() + public static function generateEncodeData() { yield [['tests' => 'ok'], ['tests' => 'ok'], 'A simple test with a simple array']; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php index 77d2f8252..e6250202f 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Driver/OpenstackObjectStore/TempUrlOpenstackGeneratorTest.php @@ -107,7 +107,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase self::assertGreaterThanOrEqual(20, strlen($signedUrl->prefix)); } - public function dataProviderGenerate(): iterable + public static function dataProviderGenerate(): iterable { $now = \DateTimeImmutable::createFromFormat('U', '1702041743'); $expireDelay = 1800; @@ -138,7 +138,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase } } - public function dataProviderGeneratePost(): iterable + public static function dataProviderGeneratePost(): iterable { $now = \DateTimeImmutable::createFromFormat('U', '1702041743'); $expireDelay = 1800; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php index 78ed1a1d9..e309c02ec 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/AsyncUpload/Templating/AsyncUploadExtensionTest.php @@ -68,7 +68,7 @@ class AsyncUploadExtensionTest extends KernelTestCase self::assertEquals('url', $actual); } - public function dataProviderStoredObject(): iterable + public static function dataProviderStoredObject(): iterable { yield [(new StoredObject())->setFilename('blabla')]; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php index 6c2afe08c..a4f5234d5 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php @@ -69,7 +69,7 @@ class AccompanyingCourseDocumentGenericDocProviderTest extends KernelTestCase self::assertIsInt($nb); } - public function provideSearchArguments(): iterable + public static function provideSearchArguments(): iterable { yield [null, null, null]; yield [new \DateTimeImmutable('1 month ago'), null, null]; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/PersonDocumentGenericDocProviderTest.php b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/PersonDocumentGenericDocProviderTest.php index 5b5b2eeb5..602dd7f4c 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/PersonDocumentGenericDocProviderTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/PersonDocumentGenericDocProviderTest.php @@ -73,7 +73,7 @@ class PersonDocumentGenericDocProviderTest extends KernelTestCase self::assertIsInt($nb, 'Test that the query is syntactically correct'); } - public function provideDataBuildFetchQueryForPerson(): iterable + public static function provideDataBuildFetchQueryForPerson(): iterable { yield [null, null, null]; yield [new \DateTimeImmutable('1 year ago'), null, null]; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php index e20f2da86..c1db6ad3e 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php @@ -142,7 +142,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase yield [$period, new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), 'test']; } - public function provideDataBuildFetchQueryForPerson(): iterable + public static function provideDataBuildFetchQueryForPerson(): iterable { yield [null, null, null]; yield [new \DateTimeImmutable('1 year ago'), null, null]; diff --git a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php index e0a9eca35..94558c1b0 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php @@ -31,7 +31,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; */ final class StoredObjectManagerTest extends TestCase { - public function getDataProvider(): \Generator + public static function getDataProvider(): \Generator { /* HAPPY SCENARIO */ diff --git a/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php b/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php index 15160c3c7..4bcaac1f6 100644 --- a/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Repository/EventACLAwareRepositoryTest.php @@ -60,7 +60,7 @@ class EventACLAwareRepositoryTest extends KernelTestCase $this->assertIsArray($repository->findAllViewable($filters)); } - public function generateFilters(): iterable + public static function generateFilters(): iterable { yield [[]]; } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php index e16293a7e..4a65c434c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php @@ -32,7 +32,7 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W self::ensureKernelShutdown(); } - public function generateAddressIds(): iterable + public static function generateAddressIds(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/AddressReferenceApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/AddressReferenceApiControllerTest.php index dfce605d2..335f6f29b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/AddressReferenceApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/AddressReferenceApiControllerTest.php @@ -25,7 +25,7 @@ final class AddressReferenceApiControllerTest extends WebTestCase { use PrepareClientTrait; - public function provideData() + public static function provideData() { self::bootKernel(); /** @var EntityManagerInterface $em */ diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php index 925fa1527..4f265658b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php @@ -24,7 +24,7 @@ final class SearchApiControllerTest extends WebTestCase { use PrepareClientTrait; - public function generateSearchData() + public static function generateSearchData() { yield ['per', ['person', 'thirdparty']]; diff --git a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/AgeTest.php b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/AgeTest.php index f52e250f3..cdb24b4b7 100644 --- a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/AgeTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/AgeTest.php @@ -31,7 +31,7 @@ final class AgeTest extends KernelTestCase $this->entityManager = self::getContainer()->get(EntityManagerInterface::class); } - public function generateQueries(): iterable + public static function generateQueries(): iterable { yield [ 'SELECT AGE(a.validFrom, a.validTo) FROM '.Address::class.' a', diff --git a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonBuildObjectTest.php b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonBuildObjectTest.php index 23665eaf8..a62b3a92e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonBuildObjectTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonBuildObjectTest.php @@ -51,7 +51,7 @@ class JsonBuildObjectTest extends KernelTestCase self::assertIsArray($result); } - public function provideQueries(): iterable + public static function provideQueries(): iterable { yield ['SELECT JSON_BUILD_OBJECT(1, 2, 3, 4) FROM '.Address::class.' a', [], []]; yield ["SELECT JSON_BUILD_OBJECT('st', a.street, 'sn', a.streetNumber) FROM ".Address::class.' a', [], []]; diff --git a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonExtractTest.php b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonExtractTest.php index 0c113e804..dec63a64c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonExtractTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Doctrine/DQL/JsonExtractTest.php @@ -31,7 +31,7 @@ final class JsonExtractTest extends KernelTestCase $this->em = self::getContainer()->get(EntityManagerInterface::class); } - public function dataGenerateDql(): iterable + public static function dataGenerateDql(): iterable { yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM '.Country::class.' c', []]; diff --git a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php index f2f259211..26a9b5980 100644 --- a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php @@ -44,7 +44,7 @@ final class NotificationTest extends KernelTestCase $em->flush(); } - public function generateNotificationData() + public static function generateNotificationData() { self::bootKernel(); $userRepository = self::getContainer()->get(UserRepository::class); diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php index 9b0866024..14bb7dfe6 100644 --- a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php @@ -43,7 +43,7 @@ final class PageTest extends KernelTestCase * * @return array */ - public function generateGetFirstItemNumber() + public static function generateGetFirstItemNumber() { return [ [1, 10, 0], @@ -61,7 +61,7 @@ final class PageTest extends KernelTestCase * * @return array */ - public function generateGetLastItemNumber() + public static function generateGetLastItemNumber() { return [ [1, 10, 9], diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php index 8ba207aa6..579348196 100644 --- a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php @@ -43,7 +43,7 @@ final class PaginatorTest extends KernelTestCase * * @return array */ - public function generateHasNextPage() + public static function generateHasNextPage() { return [ [10, 10, 1, false], @@ -53,7 +53,7 @@ final class PaginatorTest extends KernelTestCase ]; } - public function generateHasPage() + public static function generateHasPage() { return [ [10, 10, -1, false], @@ -72,7 +72,7 @@ final class PaginatorTest extends KernelTestCase * * @return array */ - public function generateHasPreviousPage() + public static function generateHasPreviousPage() { return [ [10, 10, 1, false], @@ -88,7 +88,7 @@ final class PaginatorTest extends KernelTestCase * * @return array */ - public function generatePageNumber() + public static function generatePageNumber() { return [ [12, 10, 2], diff --git a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php index 184c994e4..6f65c612f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php @@ -25,7 +25,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; */ final class PhonenumberHelperTest extends KernelTestCase { - public function formatPhonenumbers() + public static function formatPhonenumbers() { yield [ 'BE', diff --git a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php index f592b0e1a..00339b100 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase; */ final class ExtractDateFromPatternTest extends TestCase { - public function provideSubjects() + public static function provideSubjects() { yield ['15/06/1981', '', 1, '1981-06-15']; diff --git a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php index 68b1ba9a8..96d7d4622 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php @@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; */ final class ExtractPhonenumberFromPatternTest extends KernelTestCase { - public function provideData() + public static function provideData() { yield ['BE', 'Diallo', 0, [], 'Diallo', 'no phonenumber']; diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php index 8d80490c1..74f44d05e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php @@ -32,7 +32,7 @@ final class DateNormalizerTest extends KernelTestCase $this->prophet = new Prophet(); } - public function generateDataNormalize() + public static function generateDataNormalize() { $datetime = \DateTime::createFromFormat('Y-m-d H:i:sO', '2021-06-05 15:05:01+02:00'); $date = \DateTime::createFromFormat('Y-m-d H:i:sO', '2021-06-05 00:00:00+02:00'); diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php index 3587a406f..da1adbf89 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php @@ -35,7 +35,7 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase $this->normalizer = new DoctrineExistingEntityNormalizer($em, $serializerFactory); } - public function dataProviderUserId() + public static function dataProviderUserId() { self::bootKernel(); diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php index 583dfc4cc..b36abdd3f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php @@ -28,7 +28,7 @@ final class PhonenumberNormalizerTest extends TestCase { use ProphecyTrait; - public function dataProviderNormalizePhonenumber() + public static function dataProviderNormalizePhonenumber() { $phonenumberUtil = PhoneNumberUtil::getInstance(); diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php index 15334298e..ab59e0a63 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php @@ -40,7 +40,7 @@ final class UserNormalizerTest extends TestCase /** * @throws NumberParseException */ - public function dataProviderUserNormalizer() + public static function dataProviderUserNormalizer() { $user = new User(); $userNoPhone = new User(); diff --git a/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateConverterTest.php b/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateConverterTest.php index 25f3d03e6..5b2dfb954 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateConverterTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateConverterTest.php @@ -29,7 +29,7 @@ final class RollingDateConverterTest extends TestCase $this->converter = new RollingDateConverter(); } - public function generateDataConversionDate(): iterable + public static function generateDataConversionDate(): iterable { $format = 'Y-m-d His'; diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php index 0e72807c5..0fbc69eab 100644 --- a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php @@ -30,7 +30,7 @@ final class AddressRenderTest extends KernelTestCase self::bootKernel(); } - public function addressDataProviderBEWithBuilding(): \Iterator + public static function addressDataProviderBEWithBuilding(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -50,7 +50,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium']; } - public function addressDataProviderBEWithSteps(): \Iterator + public static function addressDataProviderBEWithSteps(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -70,7 +70,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium']; } - public function addressDataProviderFRWithBuilding(): \Iterator + public static function addressDataProviderFRWithBuilding(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -90,7 +90,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France']; } - public function addressDataProviderFRWithSteps(): \Iterator + public static function addressDataProviderFRWithSteps(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -110,7 +110,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France']; } - public function complexAddressDataProviderBE(): \Iterator + public static function complexAddressDataProviderBE(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -134,7 +134,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 — Rue ABC, 5 — 012345 Locality — Belgium']; } - public function complexAddressDataProviderFR(): \Iterator + public static function complexAddressDataProviderFR(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -160,7 +160,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 — Résidence "Les Bleuets" — 5, Rue ABC — A droite de la porte — 012345 Locality CEDEX — France']; } - public function noFullAddressDataProviderBE(): \Iterator + public static function noFullAddressDataProviderBE(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -177,7 +177,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, '012345 Locality — Belgium']; } - public function simpleAddressDataProviderBE(): \Iterator + public static function simpleAddressDataProviderBE(): \Iterator { $addr = new Address(); $country = (new Country()) @@ -195,7 +195,7 @@ final class AddressRenderTest extends KernelTestCase yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium']; } - public function simpleAddressDataProviderFR(): \Iterator + public static function simpleAddressDataProviderFR(): \Iterator { $addr = new Address(); $country = (new Country()) diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjobTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjobTest.php index bdfca0d58..a3e361e55 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjobTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjobTest.php @@ -41,7 +41,7 @@ class AccompanyingPeriodStepChangeCronjobTest extends TestCase $this->assertEquals($canRun, $cronJob->canRun($cronJobExecution)); } - public function provideRunTimes(): iterable + public static function provideRunTimes(): iterable { // can run, during the night yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-14T00:00:00+02:00'), true]; diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php index 3926c19d2..8f182cac5 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCoursWorkApiController/ConflictTest.php @@ -120,7 +120,7 @@ class ConflictTest extends WebTestCase self::assertResponseStatusCodeSame(409); } - public function generateAccompanyingPeriodWork(): iterable + public static function generateAccompanyingPeriodWork(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php index 8d4283b30..301d90056 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php @@ -48,7 +48,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function dataGenerateNewAccompanyingCourse() + public static function dataGenerateNewAccompanyingCourse() { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -85,7 +85,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function dataGenerateRandomAccompanyingCourse() + public static function dataGenerateRandomAccompanyingCourse() { // note about max result for person query, and maxGenerated: // @@ -152,7 +152,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function dataGenerateRandomAccompanyingCourseWithSocialIssue() + public static function dataGenerateRandomAccompanyingCourseWithSocialIssue() { // note about max result for person query, and maxGenerated: // @@ -224,7 +224,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function dataGenerateRandomRequestorValidData(): \Iterator + public static function dataGenerateRandomRequestorValidData(): \Iterator { $dataLength = 2; $maxResults = 100; diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php index 0f553162a..4f8f1453d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php @@ -41,7 +41,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function dataGenerateRandomUsers(): \Iterator + public static function dataGenerateRandomUsers(): \Iterator { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php index d01455a96..fc73123cb 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -92,7 +92,7 @@ final class HouseholdApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function generateHouseholdId() + public static function generateHouseholdId() { self::bootKernel(); @@ -124,7 +124,7 @@ final class HouseholdApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function generatePersonId() + public static function generatePersonId() { self::bootKernel(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php index 25827600b..92ed1460a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php @@ -39,7 +39,7 @@ final class HouseholdControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function generateValidHouseholdIds() + public static function generateValidHouseholdIds() { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php index 0c7105fc5..66b754eb3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php @@ -30,7 +30,7 @@ final class HouseholdMemberControllerTest extends WebTestCase { use PrepareClientTrait; - public function provideValidDataEditMember(): \Iterator + public static function provideValidDataEditMember(): \Iterator { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -48,7 +48,7 @@ final class HouseholdMemberControllerTest extends WebTestCase yield [\array_pop($membershipIds)['id']]; } - public function provideValidDataMove(): \Iterator + public static function provideValidDataMove(): \Iterator { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php index 74b5f3d98..397dfdc78 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php @@ -26,7 +26,7 @@ final class PersonApiControllerTest extends WebTestCase { use PrepareClientTrait; - public function dataGetPersonFromCenterA(): \Iterator + public static function dataGetPersonFromCenterA(): \Iterator { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -49,7 +49,7 @@ final class PersonApiControllerTest extends WebTestCase yield \array_pop($personIds); } - public function dataGetPersonFromCenterB(): \Iterator + public static function dataGetPersonFromCenterB(): \Iterator { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php index db77c5672..a290e56e8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php @@ -188,7 +188,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase * * @return mixed[] */ - public function validTextFieldsProvider() + public static function validTextFieldsProvider() { return [ ['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()], diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php index b425ac71c..e64711e43 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php @@ -23,7 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class PersonDuplicateControllerViewTest extends WebTestCase { - public function providePersonData(): iterable + public static function providePersonData(): iterable { self::bootKernel(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php index d62b4c863..0de5e8b12 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php @@ -40,7 +40,7 @@ final class RelationshipApiControllerTest extends WebTestCase self::ensureKernelShutdown(); } - public function personProvider(): array + public static function personProvider(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php index c05e5dd5d..417cc6d01 100644 --- a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase; */ final class PersonCreateEventTest extends TestCase { - public function generateAltNames(): iterator + public static function generateAltNames(): iterator { yield ['vinCENT', 'VINCENT']; @@ -32,7 +32,7 @@ final class PersonCreateEventTest extends TestCase yield ['émile', 'ÉMILE']; } - public function generateNames(): iterator + public static function generateNames(): iterator { yield ['émelie-marie', 'Émelie-Marie', 'lenaerts', 'LENAERTS']; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php index 8927cf858..09be30f1f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php @@ -38,7 +38,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -47,7 +47,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): array { self::bootKernel(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Helper/FilterListAccompanyingPeriodHelperTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Helper/FilterListAccompanyingPeriodHelperTest.php index ee4e7bdfe..0cdbea864 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Helper/FilterListAccompanyingPeriodHelperTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Helper/FilterListAccompanyingPeriodHelperTest.php @@ -90,10 +90,11 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase self::assertIsArray($result); } - public function dataProviderTestAddFilterAccompanyingPeriod(): iterable + public static function dataProviderTestAddFilterAccompanyingPeriod(): iterable { - self::setUp(); - $qb = $this->entityManager->createQueryBuilder(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $qb = $entityManager->createQueryBuilder(); $qb ->select('acp.id') diff --git a/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php index 1486b1890..917a42ef2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php @@ -140,20 +140,23 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase } } - public function provideDataFindByUserAndPostalCodesOpenedAccompanyingPeriod(): iterable + public static function provideDataFindByUserAndPostalCodesOpenedAccompanyingPeriod(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class); + $centerRepository = self::getContainer()->get(CenterRepositoryInterface::class); - if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { + if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } - if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) + if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } - $persons = $this->entityManager + $persons = $entityManager ->createQuery('SELECT p FROM '.Person::class.' p JOIN p.centerCurrent current_center') ->setMaxResults(4) ->getResult(); @@ -165,7 +168,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase /** @var Person $person */ [$person, $anotherPerson, $person2, $person3] = $persons; - $scopes = $this->scopeRepository->findAll(); + $scopes = $scopeRepository->findAll(); if (3 > count($scopes)) { throw new \RuntimeException('not enough scopes for this test'); @@ -173,14 +176,14 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase $scopesCanSee = [$scopes[0]]; $scopesGroup2 = [$scopes[1]]; - $centers = $this->centerRepository->findActive(); + $centers = $centerRepository->findActive(); $aCenterNotAssociatedToPerson = array_values(array_filter($centers, fn (Center $c) => $c !== $person->getCenter()))[0]; if (2 > count($centers)) { throw new \RuntimeException('not enough centers for this test'); } - $period = $this->buildPeriod($person, $scopesCanSee, $user, true); + $period = self::buildPeriod($person, $scopesCanSee, $user, true); $period->setUser($user); yield [ @@ -233,7 +236,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase 'period should not be visible for user having right in another scope (with multiple centers)', ]; - $period = $this->buildPeriod($person, $scopesCanSee, $user, true); + $period = self::buildPeriod($person, $scopesCanSee, $user, true); $period->setUser($user); $period->setConfidential(true); @@ -267,7 +270,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase 'period confidential be visible if user has required scopes', ]; - $this->entityManager->flush(); + $entityManager->flush(); } /** @@ -314,21 +317,24 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase } } - public function provideDataFindByUndispatched(): iterable + public static function provideDataFindByUndispatched(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class); + $centerRepository = self::getContainer()->get(CenterRepositoryInterface::class); - if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { + if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } - if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) + if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } /** @var Person $person */ - $persons = $this->entityManager + $persons = $entityManager ->createQuery('SELECT p FROM '.Person::class.' p ') ->setMaxResults(4) ->getResult(); @@ -339,7 +345,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase [$person, $anotherPerson, $person2, $person3] = $persons; - $scopes = $this->scopeRepository->findAll(); + $scopes = $scopeRepository->findAll(); if (3 > count($scopes)) { throw new \RuntimeException('not enough scopes for this test'); @@ -347,13 +353,13 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase $scopesCanSee = [$scopes[0]]; $scopesGroup2 = [$scopes[1]]; - $centers = $this->centerRepository->findActive(); + $centers = $centerRepository->findActive(); if (2 > count($centers)) { throw new \RuntimeException('not enough centers for this test'); } - $period = $this->buildPeriod($person, $scopesCanSee, $user, true); + $period = self::buildPeriod($person, $scopesCanSee, $user, true); // expected scope: can see the period yield [ @@ -405,7 +411,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase 'period should not be visible for user having right in another scope (with multiple centers)', ]; - $this->entityManager->flush(); + $entityManager->flush(); } /** @@ -445,20 +451,22 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase } } - public function provideDataForFindByPerson(): iterable + public static function provideDataForFindByPerson(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class); - if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { + if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } - if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) + if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId()) ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('no user found'); } - if (null === $centerA = $this->entityManager->createQuery('SELECT c FROM '.Center::class.' c WHERE c.name LIKE :cn')->setParameter('cn', 'Center A') + if (null === $centerA = $entityManager->createQuery('SELECT c FROM '.Center::class.' c WHERE c.name LIKE :cn')->setParameter('cn', 'Center A') ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('Center A not found'); } @@ -473,13 +481,13 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase ->setBirthdate((new \DateTime('today'))->sub(new \DateInterval('P'.random_int(18, 100).'Y'))) ->setCenter($centerA) ; - $this->entityManager->persist($p); + $entityManager->persist($p); self::$entitiesToDelete[] = [Person::class, $p->getId()]; } [$person, $anotherPerson, $person2, $person3] = $persons; - $scopes = $this->scopeRepository->findAll(); + $scopes = $scopeRepository->findAll(); if (3 > count($scopes)) { throw new \RuntimeException('not enough scopes for this test'); @@ -488,7 +496,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase $scopesGroup2 = [$scopes[1]]; // case: a period is in draft state - $period = $this->buildPeriod($person, $scopesCanSee, $user, false); + $period = self::buildPeriod($person, $scopesCanSee, $user, false); yield [$user, $person, $scopesCanSee, [], [$period], 'a user can see his period during draft state']; @@ -496,7 +504,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase yield [$anotherUser, $person, $scopesCanSee, [], [], 'another user is not allowed to see the period of someone else in draft state']; // the period is confirmed - $period = $this->buildPeriod($anotherPerson, $scopesCanSee, $user, true); + $period = self::buildPeriod($anotherPerson, $scopesCanSee, $user, true); // the other user can now see it yield [$user, $anotherPerson, $scopesCanSee, [], [$period], 'a user see his period when confirmed']; @@ -504,7 +512,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase yield [$anotherUser, $anotherPerson, $scopesGroup2, [], [], 'another user without the required scopes is not allowed to see the period when not draft']; // this period will be confidential - $period = $this->buildPeriod($person2, $scopesCanSee, $user, true); + $period = self::buildPeriod($person2, $scopesCanSee, $user, true); $period->setConfidential(true)->setUser($user, true); yield [$user, $person2, $scopesCanSee, [], [$period], 'a user see his period when confirmed and confidential with required scopes']; @@ -513,16 +521,19 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase yield [$anotherUser, $person2, $scopesCanSee, $scopesCanSee, [$period], 'a user see the period when confirmed and confidential if he has required scope to see the period']; // period draft with creator = null - $period = $this->buildPeriod($person3, $scopesCanSee, null, false); + $period = self::buildPeriod($person3, $scopesCanSee, null, false); yield [$user, $person3, $scopesCanSee, [], [$period], 'a user see a period when draft if no creator on the period']; - $this->entityManager->flush(); + $entityManager->flush(); } /** * @param array $scopes */ - private function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod + private static function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod { + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $registry = self::getContainer()->get(Registry::class); + $period = new AccompanyingPeriod(); $period->addPerson($person); if (null !== $creator) { @@ -533,11 +544,11 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase $period->addScope($scope); } - $this->entityManager->persist($period); + $entityManager->persist($period); self::$periodsIdsToDelete[] = $period->getId(); if ($confirm) { - $workflow = $this->registry->get($period, 'accompanying_period_lifecycle'); + $workflow = $registry->get($period, 'accompanying_period_lifecycle'); $workflow->apply($period, 'confirm'); } diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php index 53656136b..4c7ceee42 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php @@ -77,7 +77,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase $this->normalizer = self::getContainer()->get(NormalizerInterface::class); } - public function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable + public static function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable { yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read']]]; @@ -88,7 +88,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read'], 'docgen:person:with-budget' => true]]; } - public function generateData() + public static function generateData() { $person = new Person(); $person diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php index d2eb29a1a..c73de9f78 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php @@ -124,7 +124,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase call_user_func($assertionsOnData, $data); } - public function provideNormalizedData(): iterable + public static function provideNormalizedData(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php index 4c5c41b9f..ff360ccaa 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php @@ -115,7 +115,7 @@ final class PersonContextTest extends KernelTestCase call_user_func($assertionsOnData, $data); } - public function provideNormalizedData(): iterable + public static function provideNormalizedData(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProviderTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProviderTest.php index 2fda9c3b8..cae53d9a5 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProviderTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProviderTest.php @@ -99,11 +99,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase self::assertStringContainsStringIgnoringCase('TRUE = FALSE', $sql); } - public function provideDataForPerson(): iterable + public static function provideDataForPerson(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); - if (null === $person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p WHERE SIZE(p.accompanyingPeriodParticipations) > 0') + if (null === $person = $entityManager->createQuery('SELECT p FROM '.Person::class.' p WHERE SIZE(p.accompanyingPeriodParticipations) > 0') ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('There is no person'); } @@ -116,11 +117,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase yield [$person, null, new \DateTimeImmutable('6 month ago'), null]; } - public function provideDataForAccompanyingPeriod(): iterable + public static function provideDataForAccompanyingPeriod(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); - if (null === $period = $this->entityManager->createQuery('SELECT p FROM '.AccompanyingPeriod::class.' p ') + if (null === $period = $entityManager->createQuery('SELECT p FROM '.AccompanyingPeriod::class.' p ') ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('There is no accompanying period'); } diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php index 74ffc2340..8d49a54e8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php @@ -70,7 +70,7 @@ class AccompanyingPeriodWorkEvaluationGenericDocProviderTest extends KernelTestC self::assertIsInt($nb, 'Test that there are no errors'); } - public function provideSearchArguments(): iterable + public static function provideSearchArguments(): iterable { yield [null, null, null]; yield [new \DateTimeImmutable('1 month ago'), null, null]; diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/PersonCalendarGenericDocProviderTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/PersonCalendarGenericDocProviderTest.php index 9bbe500fe..fe11c2374 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/PersonCalendarGenericDocProviderTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/PersonCalendarGenericDocProviderTest.php @@ -52,11 +52,12 @@ class PersonCalendarGenericDocProviderTest extends KernelTestCase self::assertIsInt($nb); } - public function provideDataForPerson(): iterable + public static function provideDataForPerson(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); - if (null === $person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p ') + if (null === $person = $entityManager->createQuery('SELECT p FROM '.Person::class.' p ') ->setMaxResults(1)->getSingleResult()) { throw new \RuntimeException('There is no person'); } diff --git a/src/Bundle/ChillPersonBundle/Tests/Templating/Entity/ClosingMotiveRenderTest.php b/src/Bundle/ChillPersonBundle/Tests/Templating/Entity/ClosingMotiveRenderTest.php index eba8fc077..e85267981 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Templating/Entity/ClosingMotiveRenderTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Templating/Entity/ClosingMotiveRenderTest.php @@ -50,7 +50,7 @@ class ClosingMotiveRenderTest extends KernelTestCase self::assertStringContainsString($expectedContent, $actual); } - public function provideClosingMotiveWithRenderString(): iterable + public static function provideClosingMotiveWithRenderString(): iterable { $closingMotive = (new ClosingMotive())->setName(['fr' => 'Left']); diff --git a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php index 6a2ff3d77..2a81a57d8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php @@ -28,7 +28,7 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase { use PrepareClientTrait; - public function provideDataPersonWithAccompanyingPeriod() + public static function provideDataPersonWithAccompanyingPeriod() { self::bootKernel(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php index c01682804..2880afb35 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; */ final class MaxHolderValidatorTest extends ConstraintValidatorTestCase { - public function provideInvalidHousehold() + public static function provideInvalidHousehold() { $household = new Household(); $position = (new Position()) From edcf78d6cc5f7ab3ac6df986c0e0b0672650aa32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 22:28:03 +0100 Subject: [PATCH 060/251] Update PHPUnit configuration and reorganize test files for rector rules --- phpunit.rector.xml | 38 ++++++------------- ...aultDataOnExportFilterAggregatorRector.php | 2 +- ...DataOnExportFilterAggregatorRectorTest.php | 2 +- ...th-no-method-get-form-default-data.php.inc | 0 ...th-no-method-get-form-default-data.php.inc | 0 ...th-no-method-get-form-default-data.php.inc | 0 ...-default-data-with-chained-builder.php.inc | 0 ...le-reuse-data-on-form-default-data.php.inc | 0 .../Fixture/filter-no-data-on-builder.php.inc | 0 ...er-reuse-data-on-form-default-data.php.inc | 0 ...th-no-method-get-form-default-data.php.inc | 0 ...th-no-method-get-form-default-data.php.inc | 0 ...sting-get-form-default-data-method.php.inc | 0 .../config/config.php | 0 14 files changed, 13 insertions(+), 29 deletions(-) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/aggregator-with-no-method-get-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/direct-export-with-no-method-get-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/export-with-no-method-get-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data-with-chained-builder.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-no-data-on-builder.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-reuse-data-on-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-with-no-method-get-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/list-with-no-method-get-form-default-data.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/skip-filter-existing-get-form-default-data-method.php.inc (100%) rename utils/rector/tests/{Rector => }/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/config/config.php (100%) diff --git a/phpunit.rector.xml b/phpunit.rector.xml index f8d9d3a11..532711523 100644 --- a/phpunit.rector.xml +++ b/phpunit.rector.xml @@ -1,29 +1,13 @@ - - - - utils/rector/tests - - - - - - utils/rector/src - - + + + + utils/rector/tests + + + + + utils/rector/src + + diff --git a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php index 81279823b..9bb1335da 100644 --- a/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php +++ b/utils/rector/src/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector.php @@ -21,7 +21,7 @@ use Rector\Rector\AbstractRector; use Rector\Symfony\NodeAnalyzer\ClassAnalyzer; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; -final readonly class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends AbstractRector +final class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends AbstractRector { public function __construct( private ClassAnalyzer $classAnalyzer, diff --git a/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRectorTest.php b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRectorTest.php index 8a33b326a..55ec56446 100644 --- a/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRectorTest.php +++ b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRectorTest.php @@ -28,7 +28,7 @@ class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRectorTest extends Ab $this->doTestFile($file); } - public function provideData(): \Iterator + public static function provideData(): \Iterator { return self::yieldFilesFromDirectory(__DIR__.'/Fixture'); } diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/aggregator-with-no-method-get-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/aggregator-with-no-method-get-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/aggregator-with-no-method-get-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/aggregator-with-no-method-get-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/direct-export-with-no-method-get-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/direct-export-with-no-method-get-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/direct-export-with-no-method-get-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/direct-export-with-no-method-get-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/export-with-no-method-get-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/export-with-no-method-get-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/export-with-no-method-get-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/export-with-no-method-get-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data-with-chained-builder.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data-with-chained-builder.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data-with-chained-builder.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data-with-chained-builder.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-multiple-reuse-data-on-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-no-data-on-builder.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-no-data-on-builder.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-no-data-on-builder.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-no-data-on-builder.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-reuse-data-on-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-reuse-data-on-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-reuse-data-on-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-reuse-data-on-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-with-no-method-get-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-with-no-method-get-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-with-no-method-get-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/filter-with-no-method-get-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/list-with-no-method-get-form-default-data.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/list-with-no-method-get-form-default-data.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/list-with-no-method-get-form-default-data.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/list-with-no-method-get-form-default-data.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/skip-filter-existing-get-form-default-data-method.php.inc b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/skip-filter-existing-get-form-default-data-method.php.inc similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/skip-filter-existing-get-form-default-data-method.php.inc rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/Fixture/skip-filter-existing-get-form-default-data-method.php.inc diff --git a/utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/config/config.php b/utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/config/config.php similarity index 100% rename from utils/rector/tests/Rector/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/config/config.php rename to utils/rector/tests/ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector/config/config.php From fa0204adbca2fcfb24290e845cb790f3bcfa537d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 22:30:16 +0100 Subject: [PATCH 061/251] Refactor test methods in AbstractFilterTest to be static + rector rules for updating existing All test methods in AbstractFilterTest class have been refactored to be static. A rector rule has been created to refactor existing test. --- .../Test/Export/AbstractFilterTest.php | 26 ++-- ...viderStaticForAbstractFilterTestRector.php | 90 ++++++++++++ ...rStaticForAbstractFilterTestRectorTest.php | 40 ++++++ .../abstract-filter-test-simple.php.inc | 132 ++++++++++++++++++ ...r-test-with-already-static-methods.php.inc | 68 +++++++++ .../config/config.php | 14 ++ 6 files changed, 357 insertions(+), 13 deletions(-) create mode 100644 utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-simple.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-with-already-static-methods.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/config/config.php diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index b8968b4d1..5c38515fc 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -46,11 +46,11 @@ abstract class AbstractFilterTest extends KernelTestCase /** * provide data for `testAliasDidNotDisappears`. */ - public function dataProviderAliasDidNotDisappears() + public static function dataProviderAliasDidNotDisappears() { - $datas = $this->getFormData(); + $datas = static::getFormData(); - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { @@ -61,11 +61,11 @@ abstract class AbstractFilterTest extends KernelTestCase } } - public function dataProviderAlterQuery() + public static function dataProviderAlterQuery() { - $datas = $this->getFormData(); + $datas = static::getFormData(); - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { @@ -76,11 +76,11 @@ abstract class AbstractFilterTest extends KernelTestCase } } - public function dataProvideQueryExecution(): iterable + public static function dataProvideQueryExecution(): iterable { - $datas = $this->getFormData(); + $datas = static::getFormData(); - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { @@ -91,9 +91,9 @@ abstract class AbstractFilterTest extends KernelTestCase } } - public function dataProviderDescriptionAction() + public static function dataProviderDescriptionAction() { - foreach ($this->getFormData() as $data) { + foreach (static::getFormData() as $data) { yield [$data]; } } @@ -117,7 +117,7 @@ abstract class AbstractFilterTest extends KernelTestCase * * @return array an array of data. Example : `array( array(), array('fields' => array(1,2,3), ...)` where an empty array and `array(1,2,3)` are possible values */ - abstract public function getFormData(); + abstract public static function getFormData(); /** * Return an array with different minimal query builders. @@ -127,7 +127,7 @@ abstract class AbstractFilterTest extends KernelTestCase * * @return QueryBuilder[] an array of query builder */ - abstract public function getQueryBuilders(); + abstract public static function getQueryBuilders(); /** * Compare aliases array before and after that filter alter query. diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php new file mode 100644 index 000000000..ddd149c1e --- /dev/null +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php @@ -0,0 +1,90 @@ +extends->toString()) { + return; + } + + $new = []; + $matched = false; + + foreach ($node->stmts as $k => $stmt) { + if (!$stmt instanceof Node\Stmt\ClassMethod) { + $new[] = $stmt; + continue; + } + + if ('getFormData' === $stmt->name->name || 'getQueryBuilders' === $stmt->name->name) { + if ($stmt->isStatic()) { + $new[] = $stmt; + continue; + } + + $matched = true; + $method = new Node\Stmt\ClassMethod($stmt->name->name); + $method->flags = Node\Stmt\Class_::MODIFIER_PUBLIC | Node\Stmt\Class_::MODIFIER_STATIC; + $method->returnType = match ($stmt->name->name) { + 'getFormData' => new Node\Identifier('array'), + 'getQueryBuilders' => new Node\Identifier('iterable'), + default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) + }; + + foreach ($stmt->getStmts() as $s) { + $method->stmts[] = $s; + } + + $new[] = $method; + } else { + $new[] = $stmt; + } + } + + if (!$matched) { + return null; + } + + $node->stmts = $new; + + return $node; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest.php b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest.php new file mode 100644 index 000000000..dd3afe883 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest.php @@ -0,0 +1,40 @@ +doTestFile($file); + } + + public static function provideData(): \Iterator + { + return self::yieldFilesFromDirectory(__DIR__.'/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__.'/config/config.php'; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-simple.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-simple.php.inc new file mode 100644 index 000000000..bea0535ca --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-simple.php.inc @@ -0,0 +1,132 @@ +filter; + } + + public function getFormData(): array + { + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(User::class, 'u') + ->select('u') + ->getQuery() + ->setMaxResults(1) + ->getResult(); + + $data = []; + + foreach ($array as $u) { + $data[] = ['accepted_referrers' => $u, 'date_calc' => new RollingDate(RollingDate::T_TODAY)]; + } + + return $data; + } + + public function getQueryBuilders(): iterable + { + self::bootKernel(); + + $em = self::getContainer()->get(EntityManagerInterface::class); + + yield $em->createQueryBuilder() + ->from(AccompanyingPeriod::class, 'acp') + ->select('acp.id'); + + $qb = $em->createQueryBuilder(); + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person'); + + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + + yield $qb; + } +} +----- +filter; + } + + public static function getFormData(): array + { + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); + $array = $em->createQueryBuilder() + ->from(User::class, 'u') + ->select('u') + ->getQuery() + ->setMaxResults(1) + ->getResult(); + $data = []; + foreach ($array as $u) { + $data[] = ['accepted_referrers' => $u, 'date_calc' => new RollingDate(RollingDate::T_TODAY)]; + } + return $data; + } + + public static function getQueryBuilders(): iterable + { + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); + yield $em->createQueryBuilder() + ->from(AccompanyingPeriod::class, 'acp') + ->select('acp.id'); + $qb = $em->createQueryBuilder(); + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person'); + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + yield $qb; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-with-already-static-methods.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-with-already-static-methods.php.inc new file mode 100644 index 000000000..2b38d467c --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/abstract-filter-test-with-already-static-methods.php.inc @@ -0,0 +1,68 @@ +filter; + } + + public static function getFormData(): array + { + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(User::class, 'u') + ->select('u') + ->getQuery() + ->setMaxResults(1) + ->getResult(); + + $data = []; + + foreach ($array as $u) { + $data[] = ['accepted_referrers' => $u, 'date_calc' => new RollingDate(RollingDate::T_TODAY)]; + } + + return $data; + } + + public static function getQueryBuilders(): iterable + { + self::bootKernel(); + + $em = self::getContainer()->get(EntityManagerInterface::class); + + yield $em->createQueryBuilder() + ->from(AccompanyingPeriod::class, 'acp') + ->select('acp.id'); + + $qb = $em->createQueryBuilder(); + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person'); + + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + + yield $qb; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/config/config.php b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/config/config.php new file mode 100644 index 000000000..4b55d1c06 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/config/config.php @@ -0,0 +1,14 @@ +rule(Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTesting::class); +}; From 1f460916b6f20b99d5b8d970f698c23e287a604c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 22:31:43 +0100 Subject: [PATCH 062/251] fixup! Update PHPUnit configuration and reorganize test files for rector rules --- phpunit.rector.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.rector.xml b/phpunit.rector.xml index 532711523..25e0d25aa 100644 --- a/phpunit.rector.xml +++ b/phpunit.rector.xml @@ -1,5 +1,5 @@ - + utils/rector/tests From 35d55cced41e8368dbdcd24077eb88be8da06109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 14 Feb 2024 22:35:15 +0100 Subject: [PATCH 063/251] Update test methods to static in AbstractFilterTest The methods getFormData() and getQueryBuilders() across multiple test classes have been updated to static methods. This refactoring is part of a broader effort to improve code structure and readability. A rector rule has been employed to assist in the systematic update of these existing methods. --- rector.php | 1 + .../Filter/ACPFilters/ActivityTypeFilterTest.php | 8 ++------ .../Filter/ACPFilters/ByCreatorFilterTest.php | 8 ++------ .../ACPFilters/BySocialActionFilterTest.php | 9 ++------- .../Filter/ACPFilters/BySocialIssueFilterTest.php | 8 ++------ .../Export/Filter/ActivityDateFilterTest.php | 7 ++----- .../Export/Filter/ActivityPresenceFilterTest.php | 8 ++------ .../Export/Filter/ActivityReasonFilterTest.php | 11 ++--------- .../Export/Filter/ActivityTypeFilterTest.php | 11 ++--------- .../Tests/Export/Filter/ByCreatorFilterTest.php | 8 ++------ .../Tests/Export/Filter/CreatorJobFilterTest.php | 4 ++-- .../Export/Filter/CreatorScopeFilterTest.php | 8 ++------ .../Tests/Export/Filter/EmergencyFilterTest.php | 5 ++--- .../Export/Filter/LocationTypeFilterTest.php | 8 ++------ .../PersonFilters/ActivityReasonFilterTest.php | 8 ++------ .../PersonHavingActivityBetweenDateFilterTest.php | 8 ++------ .../PersonHavingActivityBetweenDateFilterTest.php | 12 ++++-------- .../Tests/Export/Filter/PersonsFilterTest.php | 9 ++------- .../Export/Filter/SentReceivedFilterTest.php | 5 ++--- .../Tests/Export/Filter/UserFilterTest.php | 8 ++------ .../Tests/Export/Filter/AgentFilterTest.php | 11 ++--------- .../Export/Filter/BetweenDatesFilterTest.php | 5 ++--- .../Tests/Export/Filter/JobFilterTest.php | 6 ++---- .../Tests/Export/Filter/ScopeFilterTest.php | 6 ++---- .../ActiveOneDayBetweenDatesFilterTest.php | 5 ++--- .../AdministrativeLocationFilterTest.php | 8 ++------ .../ClosingMotiveFilterTest.php | 8 ++------ .../ConfidentialFilterTest.php | 5 ++--- .../EmergencyFilterTest.php | 5 ++--- .../EvaluationFilterTest.php | 8 ++------ .../GeographicalUnitStatFilterTest.php | 6 ++---- .../HasTemporaryLocationFilterTest.php | 5 ++--- .../IntensityFilterTest.php | 5 ++--- ...tAssociatedWithAReferenceAddressFilterTest.php | 6 ++---- .../OpenBetweenDatesFilterTest.php | 5 ++--- .../OriginFilterTest.php | 8 ++------ .../ReferrerFilterBetweenDatesTest.php | 13 ++++--------- .../ReferrerFilterTest.php | 15 ++++----------- .../RequestorFilterTest.php | 5 ++--- .../SocialActionFilterTest.php | 6 ++---- .../SocialIssueFilterTest.php | 7 ++----- .../AccompanyingCourseFilters/StepFilterTest.php | 5 ++--- .../UserJobFilterTest.php | 7 ++----- .../UserScopeFilterTest.php | 5 ++--- .../ByDateFilterTest.php | 5 ++--- .../ByStepFilterTest.php | 6 ++---- .../EvaluationTypeFilterTest.php | 8 ++------ .../EvaluationFilters/MaxDateFilterTest.php | 5 ++--- .../HouseholdFilters/CompositionFilterTest.php | 10 ++-------- .../Export/Filter/PersonFilters/AgeFilterTest.php | 5 ++--- .../Filter/PersonFilters/BirthdateFilterTest.php | 5 ++--- .../PersonFilters/DeadOrAliveFilterTest.php | 5 ++--- .../Filter/PersonFilters/DeathdateFilterTest.php | 5 ++--- .../Filter/PersonFilters/GenderFilterTest.php | 5 ++--- .../PersonFilters/MaritalStatusFilterTest.php | 8 ++------ .../PersonFilters/NationalityFilterTest.php | 8 ++------ .../ResidentialAddressAtThirdpartyFilterTest.php | 8 ++------ .../ResidentialAddressAtUserFilterTest.php | 5 ++--- .../WithParticipationBetweenDatesFilterTest.php | 5 ++--- .../SocialWorkFilters/CreatorFilterTest.php | 7 ++----- .../SocialWorkFilters/CreatorJobFilterTest.php | 6 ++---- .../SocialWorkFilters/CreatorScopeFilterTest.php | 6 ++---- .../HandlingThirdPartyFilterTest.php | 7 ++----- .../Filter/SocialWorkFilters/JobFilterTest.php | 6 ++---- .../SocialWorkFilters/ReferrerFilterTest.php | 8 ++------ .../Filter/SocialWorkFilters/ScopeFilterTest.php | 6 ++---- .../Tests/Export/Filter/ReportDateFilterTest.php | 5 ++--- 67 files changed, 139 insertions(+), 324 deletions(-) diff --git a/rector.php b/rector.php index b46dd36a6..4133bb7c4 100644 --- a/rector.php +++ b/rector.php @@ -52,6 +52,7 @@ return static function (RectorConfig $rectorConfig): void { // chill rules //$rectorConfig->rule(\Chill\Utils\Rector\Rector\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector::class); + $rectorConfig->rule(\Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTestRector::class); // skip some path... $rectorConfig->skip([ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php index f5ca24a14..ee9422385 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php @@ -41,20 +41,17 @@ final class ActivityTypeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ActivityType::class, 'at') ->select('at') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_activitytypes' => [], @@ -86,10 +83,9 @@ final class ActivityTypeFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ByCreatorFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ByCreatorFilterTest.php index 773b8c5d3..88e33a9ba 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ByCreatorFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ByCreatorFilterTest.php @@ -38,20 +38,17 @@ final class ByCreatorFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') ->getQuery() ->setMaxResults(2) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_users' => $a, @@ -61,10 +58,9 @@ final class ByCreatorFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialActionFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialActionFilterTest.php index 0ff72b061..ef5fdbf81 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialActionFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialActionFilterTest.php @@ -38,20 +38,16 @@ final class BySocialActionFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(SocialAction::class, 'sa') ->select('sa') ->getQuery() ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_socialactions' => new ArrayCollection([$a]), @@ -61,10 +57,9 @@ final class BySocialActionFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialIssueFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialIssueFilterTest.php index 0f567d8a2..dba709aab 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialIssueFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/BySocialIssueFilterTest.php @@ -39,20 +39,17 @@ final class BySocialIssueFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(SocialIssue::class, 'si') ->select('si') ->getQuery() ->setMaxResults(2) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_socialissues' => new ArrayCollection([$a]), @@ -62,12 +59,11 @@ final class BySocialIssueFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { if (null === self::$kernel) { self::bootKernel(); } - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityDateFilterTest.php index fa09a6cb0..d9b2e3144 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityDateFilterTest.php @@ -38,7 +38,7 @@ final class ActivityDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -48,16 +48,13 @@ final class ActivityDateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(activity.id)') ->from(Activity::class, 'activity'); - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php index de4c54495..01c94ce63 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php @@ -44,10 +44,9 @@ class ActivityPresenceFilterTest extends AbstractFilterTest return new ActivityPresenceFilter($this->translatableStringHelper, $this->translator); } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); - $presences = self::getContainer()->get(ActivityPresenceRepositoryInterface::class) ->findAll(); @@ -61,16 +60,13 @@ class ActivityPresenceFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(activity.id)') ->from(Activity::class, 'activity'); - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php index a9687d15a..555364f9a 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php @@ -49,35 +49,29 @@ final class ActivityReasonFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); $data = []; - $em = self::getContainer() ->get(EntityManagerInterface::class); - $reasons = $em->createQuery('SELECT reason ' .'FROM ChillActivityBundle:ActivityReason reason') ->getResult(); - // generate an array of 5 different combination of results for ($i = 0; 5 > $i; ++$i) { $data[] = ['reasons' => new ArrayCollection(array_splice($reasons, ($i + 1) * -1))]; $data[] = ['reasons' => array_splice($reasons, ($i + 1) * -1)]; } - self::ensureKernelShutdown(); return $data; } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(activity.id)') ->from('ChillActivityBundle:Activity', 'activity'); @@ -90,7 +84,6 @@ final class ActivityReasonFilterTest extends AbstractFilterTest ->from('ChillActivityBundle:Activity', 'activity') ->join('activity.reasons', 'reasons') ->join('reasons.category', 'category'); - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityTypeFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityTypeFilterTest.php index 87349dd12..a9c44d591 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityTypeFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityTypeFilterTest.php @@ -39,20 +39,16 @@ final class ActivityTypeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ActivityType::class, 'at') ->select('at') ->getQuery() ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'types' => new ArrayCollection([$a]), @@ -65,16 +61,13 @@ final class ActivityTypeFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(activity.id)') ->from(Activity::class, 'activity'); - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ByCreatorFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ByCreatorFilterTest.php index 9da5403b3..cbd168ce8 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ByCreatorFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ByCreatorFilterTest.php @@ -38,18 +38,15 @@ final class ByCreatorFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') ->getQuery() ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_users' => $a, @@ -59,12 +56,11 @@ final class ByCreatorFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { if (null === self::$kernel) { self::bootKernel(); } - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorJobFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorJobFilterTest.php index d7cbc1f39..9babab132 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorJobFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorJobFilterTest.php @@ -51,7 +51,7 @@ class CreatorJobFilterTest extends AbstractFilterTest ); } - public function getFormData() + public static function getFormData(): array { $this->setUp(); $jobs = $this->userJobRepository->findAll(); @@ -61,7 +61,7 @@ class CreatorJobFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::setUp(); diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorScopeFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorScopeFilterTest.php index f1ec8b63c..9fdb4ea61 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorScopeFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/CreatorScopeFilterTest.php @@ -38,20 +38,17 @@ final class CreatorScopeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Scope::class, 's') ->select('s') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'scopes' => $a, @@ -61,10 +58,9 @@ final class CreatorScopeFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/EmergencyFilterTest.php index 79abc750d..d1645533c 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/EmergencyFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/EmergencyFilterTest.php @@ -37,7 +37,7 @@ final class EmergencyFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_emergency' => true], @@ -45,10 +45,9 @@ final class EmergencyFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/LocationTypeFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/LocationTypeFilterTest.php index 17db5e622..b3ffa7abb 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/LocationTypeFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/LocationTypeFilterTest.php @@ -38,20 +38,17 @@ final class LocationTypeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(LocationType::class, 'lt') ->select('lt') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_locationtype' => $a, @@ -61,10 +58,9 @@ final class LocationTypeFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/ActivityReasonFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/ActivityReasonFilterTest.php index b96f1ead5..0c9637e2e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/ActivityReasonFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/ActivityReasonFilterTest.php @@ -39,20 +39,17 @@ final class ActivityReasonFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ActivityReason::class, 'ar') ->select('ar') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'reasons' => new ArrayCollection([$a]), @@ -62,10 +59,9 @@ final class ActivityReasonFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilterTest.php index b4f816dea..329256f3d 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilterTest.php @@ -38,20 +38,17 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ActivityReason::class, 'ar') ->select('ar') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'date_from' => \DateTime::createFromFormat('Y-m-d', '2021-07-01'), @@ -63,12 +60,11 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { if (null === self::$kernel) { self::bootKernel(); } - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php index b983c08a4..c5aa9f517 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php @@ -48,14 +48,13 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { $date_from = \DateTime::createFromFormat('Y-m-d', '2015-01-15'); - $date_to = new \DateTime(); // today + $date_to = new \DateTime(); + // today $reasons = $this->getActivityReasons(); - $data = []; - for ($i = 0; 4 > $i; ++$i) { $data[] = [ 'date_from' => $date_from, @@ -67,13 +66,11 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(person.id)') ->from('ChillPersonBundle:Person', 'person') @@ -85,7 +82,6 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest ->join('activity.person', 'person') // add a fake where clause ->where('person.id > 0'); - self::ensureKernelShutdown(); } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonsFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonsFilterTest.php index 17dcda570..cf2ab05ac 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonsFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonsFilterTest.php @@ -39,15 +39,13 @@ class PersonsFilterTest extends AbstractFilterTest return new PersonsFilter($this->personRender); } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $persons = $em->createQuery('SELECT p FROM '.Person::class.' p ') ->setMaxResults(2) ->getResult(); - self::ensureKernelShutdown(); return [ @@ -57,16 +55,13 @@ class PersonsFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('count(activity.id)') ->from(Activity::class, 'activity'); - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/SentReceivedFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/SentReceivedFilterTest.php index c782fd4f6..843bfea1d 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/SentReceivedFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/SentReceivedFilterTest.php @@ -37,7 +37,7 @@ final class SentReceivedFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_sentreceived' => Activity::SENTRECEIVED_SENT], @@ -45,10 +45,9 @@ final class SentReceivedFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/UserFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/UserFilterTest.php index 94383565b..569fb5403 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/UserFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/UserFilterTest.php @@ -38,20 +38,17 @@ final class UserFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $a) { $data[] = [ 'accepted_users' => $a, @@ -61,10 +58,9 @@ final class UserFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php index cef9cf01c..d0d07acfd 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php @@ -51,39 +51,32 @@ final class AgentFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') ->getQuery() ->getResult(); - $data = []; - foreach ($array as $a) { yield [ 'accepted_agents' => $a, ]; } - self::ensureKernelShutdown(); } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->select('cal.id') ->from(Calendar::class, 'cal') ; - self::ensureKernelShutdown(); } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php index 6cd41601d..ab09c2672 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php @@ -51,7 +51,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -61,10 +61,9 @@ final class BetweenDatesFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php index 010157acc..758b8ccbc 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php @@ -52,11 +52,10 @@ final class JobFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(UserJob::class, 'uj') ->select('uj') @@ -71,10 +70,9 @@ final class JobFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php index 88b2f9bf0..623f8f3f0 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php @@ -52,11 +52,10 @@ final class ScopeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Scope::class, 's') ->select('s') @@ -71,10 +70,9 @@ final class ScopeFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php index e08b2d4aa..8fd75acd6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php @@ -38,7 +38,7 @@ final class ActiveOneDayBetweenDatesFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class ActiveOneDayBetweenDatesFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php index c6eb04e05..a9c5e6f50 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php @@ -37,20 +37,17 @@ final class AdministrativeLocationFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Location::class, 'l') ->select('l') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $l) { $data[] = ['accepted_locations' => $l]; } @@ -58,10 +55,9 @@ final class AdministrativeLocationFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php index bf3384fcc..7b333df00 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php @@ -38,19 +38,16 @@ final class ClosingMotiveFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ClosingMotive::class, 'm') ->select('m') ->getQuery() ->getResult(); - $data = []; - foreach ($array as $m) { $data[] = ['accepted_closingmotives' => $m]; } @@ -58,10 +55,9 @@ final class ClosingMotiveFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php index 38c703cff..e2f20df2c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php @@ -36,7 +36,7 @@ final class ConfidentialFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_confidentials' => true], @@ -44,10 +44,9 @@ final class ConfidentialFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php index 3f6fa8e4d..ecc98d4fc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php @@ -36,7 +36,7 @@ final class EmergencyFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_emergency' => true], @@ -44,10 +44,9 @@ final class EmergencyFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php index de6305759..8a9fb3c51 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php @@ -37,20 +37,17 @@ final class EvaluationFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Evaluation::class, 'ev') ->select('ev') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $e) { $data[] = ['accepted_evaluations' => $e]; } @@ -58,10 +55,9 @@ final class EvaluationFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php index 1d3f271af..1f5323b82 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php @@ -39,11 +39,10 @@ final class GeographicalUnitStatFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $repo = self::getContainer()->get(GeographicalUnitRepositoryInterface::class); - $units = $repo->findAll(); return [ @@ -54,10 +53,9 @@ final class GeographicalUnitStatFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php index 7c07014da..0e5be0f64 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php @@ -38,7 +38,7 @@ class HasTemporaryLocationFilterTest extends AbstractFilterTest return new HasTemporaryLocationFilter($this->rollingDateConverter); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -52,10 +52,9 @@ class HasTemporaryLocationFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php index 8320345d1..8759b6881 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php @@ -37,7 +37,7 @@ final class IntensityFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_intensities' => 'occasional'], @@ -45,10 +45,9 @@ final class IntensityFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php index 796bbb30a..8978cdfa1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php @@ -44,19 +44,17 @@ class NotAssociatedWithAReferenceAddressFilterTest extends AbstractFilterTest return new NotAssociatedWithAReferenceAddressFilter($dateConverter); } - public function getFormData() + public static function getFormData(): array { return [ ['date_calc' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - return [ $em->createQueryBuilder() ->select('acp.id') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php index 33620ff6e..17515628a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php @@ -38,7 +38,7 @@ final class OpenBetweenDatesFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class OpenBetweenDatesFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php index 82c368f11..1e22d0a57 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php @@ -38,20 +38,17 @@ final class OriginFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Origin::class, 'o') ->select('o') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $l) { $data[] = ['accepted_origins' => $l]; } @@ -59,10 +56,9 @@ final class OriginFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php index af7b1e0fa..8415e2017 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php @@ -43,11 +43,11 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest return new ReferrerFilterBetweenDates($this->rollingDateConverter, $this->userRender); } - public function getFormData() + public static function getFormData(): array { - self:self::bootKernel(); + self: + self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $users = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') @@ -64,16 +64,13 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->from(AccompanyingPeriod::class, 'acp') ->select('acp.id'); - $qb = $em->createQueryBuilder(); $qb ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') @@ -81,9 +78,7 @@ class ReferrerFilterBetweenDatesTest extends AbstractFilterTest ->join('acp.participations', 'acppart') ->join('acppart.person', 'person') ; - $qb->select('COUNT(DISTINCT acpw.id) as export_result'); - yield $qb; } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php index 00cbc8dd4..45bb6df46 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php @@ -39,20 +39,18 @@ final class ReferrerFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { - self:self::bootKernel(); + self: + self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(User::class, 'u') ->select('u') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $u) { $data[] = ['accepted_referrers' => $u, 'date_calc' => new RollingDate(RollingDate::T_TODAY)]; } @@ -60,16 +58,13 @@ final class ReferrerFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - yield $em->createQueryBuilder() ->from(AccompanyingPeriod::class, 'acp') ->select('acp.id'); - $qb = $em->createQueryBuilder(); $qb ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') @@ -77,9 +72,7 @@ final class ReferrerFilterTest extends AbstractFilterTest ->join('acp.participations', 'acppart') ->join('acppart.person', 'person') ; - $qb->select('COUNT(DISTINCT acpw.id) as export_result'); - yield $qb; } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php index 6fb3b5291..459ff303f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php @@ -37,7 +37,7 @@ final class RequestorFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['accepted_choices' => 'participation'], @@ -47,10 +47,9 @@ final class RequestorFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php index 4190c8e1b..c90369d2d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php @@ -39,11 +39,10 @@ final class SocialActionFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(SocialAction::class, 'sa') ->select('sa') @@ -83,10 +82,9 @@ final class SocialActionFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php index f433e7987..b18e12010 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php @@ -39,26 +39,23 @@ final class SocialIssueFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(SocialIssue::class, 'si') ->select('si') ->getQuery() ->setMaxResults(1) ->getResult(); - yield ['accepted_socialissues' => new ArrayCollection($array)]; yield ['accepted_socialissues' => $array]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php index 34cafd926..d78f66b4d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php @@ -38,7 +38,7 @@ final class StepFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { foreach ([ ['accepted_steps_multi' => [AccompanyingPeriod::STEP_DRAFT]], @@ -51,10 +51,9 @@ final class StepFilterTest extends AbstractFilterTest } } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php index 6ac7da376..e6ae76ce7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php @@ -40,29 +40,26 @@ final class UserJobFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): iterable + public static function getFormData(): array { self::bootKernel(); $jobs = self::getContainer()->get(EntityManagerInterface::class) ->createQuery('SELECT j FROM '.UserJob::class.' j') ->setMaxResults(1) ->getResult(); - yield [ 'jobs' => new ArrayCollection($jobs), 'date_calc' => new RollingDate(RollingDate::T_TODAY), ]; - yield [ 'jobs' => $jobs, 'date_calc' => new RollingDate(RollingDate::T_TODAY), ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserScopeFilterTest.php index 844622623..1cdb296d2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserScopeFilterTest.php @@ -40,7 +40,7 @@ final class UserScopeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $scopes = self::getContainer()->get(EntityManagerInterface::class) @@ -60,10 +60,9 @@ final class UserScopeFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php index 77f131c98..a98d0c78e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php @@ -40,7 +40,7 @@ class ByDateFilterTest extends AbstractFilterTest return new ByDateFilter($this->rollingDateConverter); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -50,11 +50,10 @@ class ByDateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index 77ff35ad6..4d38d0a1e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -37,7 +37,7 @@ class ByStepFilterTest extends AbstractFilterTest return new ByStepFilter($translator); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -49,16 +49,14 @@ class ByStepFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') ->join('acpstephistory.period', 'acp'); - return [ $qb, ]; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/EvaluationTypeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/EvaluationTypeFilterTest.php index 591069949..415d2219e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/EvaluationTypeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/EvaluationTypeFilterTest.php @@ -38,20 +38,17 @@ final class EvaluationTypeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(Evaluation::class, 'e') ->select('e') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $r) { $data[] = [ 'accepted_evaluationtype' => $r, @@ -61,10 +58,9 @@ final class EvaluationTypeFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/MaxDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/MaxDateFilterTest.php index a2cf0f566..42adf71c0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/MaxDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilters/MaxDateFilterTest.php @@ -37,7 +37,7 @@ final class MaxDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['maxdate' => false], @@ -45,10 +45,9 @@ final class MaxDateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/HouseholdFilters/CompositionFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/HouseholdFilters/CompositionFilterTest.php index a6b55cca6..d3ab4e2de 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/HouseholdFilters/CompositionFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/HouseholdFilters/CompositionFilterTest.php @@ -39,20 +39,17 @@ final class CompositionFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(HouseholdCompositionType::class, 'r') ->select('r') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $r) { $data[] = [ 'accepted_composition' => $r, @@ -63,10 +60,9 @@ final class CompositionFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): iterable + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); $qb = $em->createQueryBuilder(); $qb @@ -78,11 +74,9 @@ final class CompositionFilterTest extends AbstractFilterTest ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') ->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)') ->setParameter('count_household_at_date', new \DateTimeImmutable('today')); - $qb ->select('COUNT(DISTINCT household.id) AS household_export_result') ->addSelect('COUNT(DISTINCT acp.id) AS acp_export_result'); - yield $qb; } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AgeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AgeFilterTest.php index 4c7a3d681..e7c12bd1b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AgeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AgeFilterTest.php @@ -38,7 +38,7 @@ final class AgeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -49,10 +49,9 @@ final class AgeFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdateFilterTest.php index 256f6e0a8..51d40c9c3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdateFilterTest.php @@ -38,7 +38,7 @@ final class BirthdateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class BirthdateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeadOrAliveFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeadOrAliveFilterTest.php index 186edc335..044524ff0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeadOrAliveFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeadOrAliveFilterTest.php @@ -38,7 +38,7 @@ final class DeadOrAliveFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -52,10 +52,9 @@ final class DeadOrAliveFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeathdateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeathdateFilterTest.php index e196c33f2..419f8d6bd 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeathdateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/DeathdateFilterTest.php @@ -38,7 +38,7 @@ final class DeathdateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class DeathdateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php index d31969b5f..2d67987d4 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php @@ -37,7 +37,7 @@ final class GenderFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -52,10 +52,9 @@ final class GenderFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/MaritalStatusFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/MaritalStatusFilterTest.php index fdd11732e..6c51b08d3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/MaritalStatusFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/MaritalStatusFilterTest.php @@ -38,20 +38,17 @@ final class MaritalStatusFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(MaritalStatus::class, 'm') ->select('m') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $m) { $data[] = [ 'maritalStatus' => $m, @@ -61,10 +58,9 @@ final class MaritalStatusFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/NationalityFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/NationalityFilterTest.php index e04b3ce90..b8d71a62d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/NationalityFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/NationalityFilterTest.php @@ -38,15 +38,12 @@ final class NationalityFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $countries = array_slice($em->getRepository(Country::class)->findAll(), 0, 1); - $data = []; - foreach ($countries as $c) { $data[] = [ 'nationalities' => $c, @@ -56,10 +53,9 @@ final class NationalityFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilterTest.php index 32ba578a5..ed5138511 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilterTest.php @@ -41,20 +41,17 @@ final class ResidentialAddressAtThirdpartyFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $array = $em->createQueryBuilder() ->from(ThirdPartyCategory::class, 'tpc') ->select('tpc') ->getQuery() ->setMaxResults(1) ->getResult(); - $data = []; - foreach ($array as $r) { $data[] = [ 'thirdparty_cat' => [$r], @@ -65,10 +62,9 @@ final class ResidentialAddressAtThirdpartyFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtUserFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtUserFilterTest.php index 2effbd835..bbb31febe 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtUserFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/ResidentialAddressAtUserFilterTest.php @@ -39,17 +39,16 @@ final class ResidentialAddressAtUserFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ ['date_calc' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php index 6951ce0bd..d9b86c81b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php @@ -38,7 +38,7 @@ final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorFilterTest.php index e3126b8a2..e7c4ee8e6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorFilterTest.php @@ -38,12 +38,10 @@ class CreatorFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - $creators = $em->createQuery('SELECT u FROM '.User::class.' u') ->setMaxResults(1) ->getResult(); @@ -55,10 +53,9 @@ class CreatorFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorJobFilterTest.php index bef52826a..19d6631e8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorJobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorJobFilterTest.php @@ -39,11 +39,10 @@ class CreatorJobFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $jobs = $em->createQuery('SELECT j FROM '.UserJob::class.' j') ->setMaxResults(1) ->getResult(); @@ -55,10 +54,9 @@ class CreatorJobFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorScopeFilterTest.php index a158eac31..3e1f98d3e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/CreatorScopeFilterTest.php @@ -38,11 +38,10 @@ class CreatorScopeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $scopes = $em->createQuery('SELECT s FROM '.Scope::class.' s') ->setMaxResults(1) ->getResult(); @@ -54,10 +53,9 @@ class CreatorScopeFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/HandlingThirdPartyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/HandlingThirdPartyFilterTest.php index c2585cc24..46a1a95e1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/HandlingThirdPartyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/HandlingThirdPartyFilterTest.php @@ -39,12 +39,10 @@ class HandlingThirdPartyFilterTest extends AbstractFilterTest return new HandlingThirdPartyFilter($this->thirdPartyRender); } - public function getFormData() + public static function getFormData(): array { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - $thirdParties = $em->createQuery('SELECT tp FROM '.ThirdParty::class.' tp') ->setMaxResults(2) ->getResult(); @@ -56,10 +54,9 @@ class HandlingThirdPartyFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php index be490bf63..fbe232941 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php @@ -39,11 +39,10 @@ final class JobFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $jobs = $em->createQuery('SELECT j FROM '.UserJob::class.' j') ->setMaxResults(1) ->getResult(); @@ -55,10 +54,9 @@ final class JobFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ReferrerFilterTest.php index 8ed86da97..d185ac499 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ReferrerFilterTest.php @@ -39,15 +39,12 @@ final class ReferrerFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $users = array_slice($em->getRepository(User::class)->findAll(), 0, 1); - $data = []; - foreach ($users as $u) { $data[] = [ 'accepted_agents' => $u, // some saved export does not have the parameter "agent_at" @@ -62,10 +59,9 @@ final class ReferrerFilterTest extends AbstractFilterTest return $data; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php index 77b8db28b..cc47a598f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php @@ -38,11 +38,10 @@ final class ScopeFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $scopes = $em->createQuery('SELECT s FROM '.Scope::class.' s') ->setMaxResults(1) ->getResult(); @@ -54,10 +53,9 @@ final class ScopeFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillReportBundle/Tests/Export/Filter/ReportDateFilterTest.php b/src/Bundle/ChillReportBundle/Tests/Export/Filter/ReportDateFilterTest.php index 9d6dc8ac7..9b1040fb8 100644 --- a/src/Bundle/ChillReportBundle/Tests/Export/Filter/ReportDateFilterTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Export/Filter/ReportDateFilterTest.php @@ -38,7 +38,7 @@ final class ReportDateFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -48,10 +48,9 @@ final class ReportDateFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ From 11f6b78b26eb95329c7e0301eb1e8654adfc1af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 16 Feb 2024 19:16:07 +0100 Subject: [PATCH 064/251] Make static some methods in AbstractAggregatorTest.php + rector rule to adapt existing --- .../Test/Export/AbstractAggregatorTest.php | 38 ++++---- ...rStaticForAbstractAggregatorTestRector.php | 94 +++++++++++++++++++ ...viderStaticForAbstractFilterTestRector.php | 6 +- ...ticForAbstractAggregatorTestRectorTest.php | 40 ++++++++ .../Fixture/not-a-filter.php.inc | 5 + .../Fixture/not-an-extends-class.php.inc | 5 + .../config/config.php | 14 +++ .../Fixture/not-a-filter.php.inc | 5 + .../Fixture/not-an-extends-class.php.inc | 5 + .../config/config.php | 2 +- 10 files changed, 193 insertions(+), 21 deletions(-) create mode 100644 utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-an-extends-class.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/config/config.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/not-a-filter.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/not-an-extends-class.php.inc diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index ddfc7e135..2d2d6d60e 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -35,19 +35,19 @@ abstract class AbstractAggregatorTest extends KernelTestCase /** * provide data for `testAliasDidNotDisappears`. */ - public function dataProviderAliasDidNotDisappears() + public static function dataProviderAliasDidNotDisappears() { - $datas = $this->getFormData(); + $datas = static::getFormData(); if (!\is_array($datas)) { $datas = iterator_to_array($datas); } - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { - foreach ($this->getFormData() as $data) { + foreach (static::getFormData() as $data) { yield [clone $qb, $data]; } } @@ -57,38 +57,38 @@ abstract class AbstractAggregatorTest extends KernelTestCase /** * provide data for `testAlterQuery`. */ - public function dataProviderAlterQuery() + public static function dataProviderAlterQuery() { - $datas = $this->getFormData(); + $datas = static::getFormData(); if (!\is_array($datas)) { $datas = iterator_to_array($datas); } - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { - foreach ($this->getFormData() as $data) { + foreach (static::getFormData() as $data) { yield [clone $qb, $data]; } } } } - public function dataProviderQueryExecution(): iterable + public static function dataProviderQueryExecution(): iterable { - $datas = $this->getFormData(); + $datas = static::getFormData(); if (!\is_array($datas)) { $datas = iterator_to_array($datas); } - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { - foreach ($this->getFormData() as $data) { + foreach (static::getFormData() as $data) { yield [clone $qb, $data]; } } @@ -98,9 +98,9 @@ abstract class AbstractAggregatorTest extends KernelTestCase /** * prepare data for `testGetQueryKeys`. */ - public function dataProviderGetQueryKeys() + public static function dataProviderGetQueryKeys() { - $datas = $this->getFormData(); + $datas = static::getFormData(); if (!\is_array($datas)) { $datas = iterator_to_array($datas); @@ -114,15 +114,15 @@ abstract class AbstractAggregatorTest extends KernelTestCase /** * prepare date for method `testGetResultsAndLabels`. */ - public function dataProviderGetResultsAndLabels() + public static function dataProviderGetResultsAndLabels() { - $datas = $this->getFormData(); + $datas = static::getFormData(); if (!\is_array($datas)) { $datas = iterator_to_array($datas); } - foreach ($this->getQueryBuilders() as $qb) { + foreach (static::getQueryBuilders() as $qb) { if ([] === $datas) { yield [clone $qb, []]; } else { @@ -151,7 +151,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase * * @return array an array of data. Example : `array( array(), array('fields' => array(1,2,3), ...)` where an empty array and `array(1,2,3)` are possible values */ - abstract public function getFormData(); + abstract public static function getFormData(); /** * get an array of query builders that the aggregator will use. @@ -163,7 +163,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase * * @return QueryBuilder[] */ - abstract public function getQueryBuilders(); + abstract public static function getQueryBuilders(); /** * Compare aliases array before and after that aggregator alter query. diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php new file mode 100644 index 000000000..1dd0cfa50 --- /dev/null +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php @@ -0,0 +1,94 @@ +extends) { + return null; + } + + if (AbstractAggregatorTest::class !== $node->extends->toString()) { + return null; + } + + $new = []; + $matched = false; + + foreach ($node->stmts as $k => $stmt) { + if (!$stmt instanceof Node\Stmt\ClassMethod) { + $new[] = $stmt; + continue; + } + + if ('getFormData' === $stmt->name->name || 'getQueryBuilders' === $stmt->name->name) { + if ($stmt->isStatic()) { + $new[] = $stmt; + continue; + } + + $matched = true; + $method = new Node\Stmt\ClassMethod($stmt->name->name); + $method->flags = Node\Stmt\Class_::MODIFIER_PUBLIC | Node\Stmt\Class_::MODIFIER_STATIC; + $method->returnType = match ($stmt->name->name) { + 'getFormData' => new Node\Identifier('array'), + 'getQueryBuilders' => new Node\Identifier('iterable'), + default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) + }; + + foreach ($stmt->getStmts() as $s) { + $method->stmts[] = $s; + } + + $new[] = $method; + } else { + $new[] = $stmt; + } + } + + if (!$matched) { + return null; + } + + $node->stmts = $new; + + return $node; + } +} diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php index ddd149c1e..82176cec1 100644 --- a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php @@ -41,8 +41,12 @@ final class ChillBundleMakeDataProviderStaticForAbstractFilterTestRector extends return null; } + if (null === $node->extends) { + return null; + } + if (AbstractFilterTest::class !== $node->extends->toString()) { - return; + return null; } $new = []; diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest.php b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest.php new file mode 100644 index 000000000..cb2d7d4ce --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest.php @@ -0,0 +1,40 @@ +doTestFile($file); + } + + public static function provideData(): \Iterator + { + return self::yieldFilesFromDirectory(__DIR__.'/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__.'/config/config.php'; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc new file mode 100644 index 000000000..85df5e07d --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc @@ -0,0 +1,5 @@ +rule(Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector::class); +}; diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/not-a-filter.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/not-a-filter.php.inc new file mode 100644 index 000000000..85df5e07d --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractFilterTest/Fixture/not-a-filter.php.inc @@ -0,0 +1,5 @@ +rule(Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTesting::class); + $rectorConfig->rule(Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTestRector::class); }; From 94725bc92fcc87029d43933e2b3404ec94327507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 16 Feb 2024 19:17:10 +0100 Subject: [PATCH 065/251] fixup! Update test methods to static in AbstractFilterTest --- .../NotAssociatedWithAReferenceAddressFilterTest.php | 1 + .../AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php index 8978cdfa1..4b4b17609 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php @@ -55,6 +55,7 @@ class NotAssociatedWithAReferenceAddressFilterTest extends AbstractFilterTest { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); + return [ $em->createQueryBuilder() ->select('acp.id') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index 4d38d0a1e..03bfa8435 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -57,6 +57,7 @@ class ByStepFilterTest extends AbstractFilterTest ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') ->join('acpstephistory.period', 'acp'); + return [ $qb, ]; From b9ae8787918b7d01fb822d135a26257ddb86dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 16 Feb 2024 21:33:57 +0100 Subject: [PATCH 066/251] Aggregators: Update test methods to static and return array Modified aggregator test methods throughout the Chill project to be now static methods. Also updated yield construction to array returns for more standardised code. --- rector.php | 6 ++++-- .../ByActivityTypeAggregatorTest.php | 5 ++--- .../BySocialActionAggregatorTest.php | 5 ++--- .../ACPAggregators/BySocialIssueAggregatorTest.php | 5 ++--- .../Aggregator/ActivityPresenceAggregatorTest.php | 5 ++--- .../Aggregator/ActivityReasonAggregatorTest.php | 5 ++--- .../Aggregator/ActivityTypeAggregatorTest.php | 5 ++--- .../Aggregator/ActivityUserAggregatorTest.php | 5 ++--- .../Aggregator/ByThirdpartyAggregatorTest.php | 5 ++--- .../Export/Aggregator/ByUserAggregatorTest.php | 5 ++--- .../Export/Aggregator/CreatorJobAggregatorTest.php | 5 ++--- .../Aggregator/CreatorScopeAggregatorTest.php | 5 ++--- .../Tests/Export/Aggregator/DateAggregatorTest.php | 5 ++--- .../Aggregator/LocationTypeAggregatorTest.php | 5 ++--- .../PersonAggregators/PersonAggregatorTest.php | 5 ++--- .../Export/Aggregator/PersonsAggregatorTest.php | 5 ++--- .../Export/Aggregator/AgentAggregatorTest.php | 5 ++--- .../Aggregator/CancelReasonAggregatorTest.php | 5 ++--- .../Tests/Export/Aggregator/JobAggregatorTest.php | 5 ++--- .../Export/Aggregator/LocationAggregatorTest.php | 5 ++--- .../Aggregator/LocationTypeAggregatorTest.php | 5 ++--- .../Export/Aggregator/MonthYearAggregatorTest.php | 5 ++--- .../Export/Aggregator/ScopeAggregatorTest.php | 5 ++--- .../Tests/Export/Filter/AgentFilterTest.php | 4 +++- .../AdministrativeLocationAggregatorTest.php | 5 ++--- .../ClosingDateAggregatorTest.php | 14 +++++++------- .../ClosingMotiveAggregatorTest.php | 5 ++--- .../ConfidentialAggregatorTest.php | 5 ++--- .../DurationAggregatorTest.php | 5 ++--- .../EmergencyAggregatorTest.php | 5 ++--- .../EvaluationAggregatorTest.php | 5 ++--- .../GeographicalUnitStatAggregatorTest.php | 5 ++--- .../IntensityAggregatorTest.php | 5 ++--- .../OpeningDateAggregatorTest.php | 12 +++++------- .../OriginAggregatorTest.php | 5 ++--- .../PersonParticipatingAggregatorTest.php | 5 ++--- .../ReferrerAggregatorTest.php | 5 ++--- .../ReferrerScopeAggregatorTest.php | 5 ++--- .../RequestorAggregatorTest.php | 5 ++--- .../ScopeAggregatorTest.php | 5 ++--- .../SocialActionAggregatorTest.php | 5 ++--- .../SocialIssueAggregatorTest.php | 5 ++--- .../StepAggregatorTest.php | 5 ++--- .../UserJobAggregatorTest.php | 5 ++--- .../ByClosingMotiveAggregatorTest.php | 5 ++--- .../ByDateAggregatorTest.php | 5 ++--- .../ByStepAggregatorTest.php | 5 ++--- .../EvaluationTypeAggregatorTest.php | 5 ++--- .../ChildrenNumberAggregatorTest.php | 5 ++--- .../CompositionAggregatorTest.php | 5 ++--- .../PersonAggregators/AgeAggregatorTest.php | 5 ++--- .../CountryOfBirthAggregatorTest.php | 5 ++--- .../PersonAggregators/GenderAggregatorTest.php | 5 ++--- .../HouseholdPositionAggregatorTest.php | 5 ++--- .../MaritalStatusAggregatorTest.php | 5 ++--- .../NationalityAggregatorTest.php | 5 ++--- .../PersonAggregators/PostalCodeAggregatorTest.php | 5 ++--- .../ActionTypeAggregatorTest.php | 5 ++--- .../CreatorAggregatorTest.php | 5 ++--- .../CreatorJobAggregatorTest.php | 5 ++--- .../CreatorScopeAggregatorTest.php | 5 ++--- .../SocialWorkAggregators/GoalAggregatorTest.php | 5 ++--- .../GoalResultAggregatorTest.php | 5 ++--- .../HandlingThirdPartyAggregatorTest.php | 5 ++--- .../SocialWorkAggregators/JobAggregatorTest.php | 5 ++--- .../ReferrerAggregatorTest.php | 5 ++--- .../SocialWorkAggregators/ResultAggregatorTest.php | 5 ++--- .../SocialWorkAggregators/ScopeAggregatorTest.php | 5 ++--- .../SocialIssueFilterTest.php | 7 +++++-- .../AccompanyingCourseFilters/StepFilterTest.php | 6 +++++- .../UserJobFilterTest.php | 7 +++++-- 71 files changed, 162 insertions(+), 214 deletions(-) diff --git a/rector.php b/rector.php index 4133bb7c4..a358e8661 100644 --- a/rector.php +++ b/rector.php @@ -51,8 +51,10 @@ return static function (RectorConfig $rectorConfig): void { // $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class); // chill rules - //$rectorConfig->rule(\Chill\Utils\Rector\Rector\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector::class); - $rectorConfig->rule(\Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTestRector::class); + $rectorConfig->rules([ + \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTestRector::class, + \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector::class, + ]); // skip some path... $rectorConfig->skip([ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/ByActivityTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/ByActivityTypeAggregatorTest.php index 83718733e..bc0651b1f 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/ByActivityTypeAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/ByActivityTypeAggregatorTest.php @@ -50,7 +50,7 @@ class ByActivityTypeAggregatorTest extends AbstractAggregatorTest ); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -72,10 +72,9 @@ class ByActivityTypeAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialActionAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialActionAggregatorTest.php index 7a986f6ea..1d7578bf0 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialActionAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialActionAggregatorTest.php @@ -37,17 +37,16 @@ final class BySocialActionAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialIssueAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialIssueAggregatorTest.php index 3a42efe0e..a3b69eaef 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialIssueAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ACPAggregators/BySocialIssueAggregatorTest.php @@ -37,17 +37,16 @@ final class BySocialIssueAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php index 719bbe37e..db26d4dd4 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php @@ -40,17 +40,16 @@ class ActivityPresenceAggregatorTest extends AbstractAggregatorTest return new ActivityPresenceAggregator($this->activityPresenceRepository, $this->translatableStringHelper); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php index f7b9fe9a8..41c7213c0 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php @@ -49,7 +49,7 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ ['level' => 'reasons'], @@ -57,10 +57,9 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php index 16c26d194..0768060f2 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php @@ -50,17 +50,16 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php index 8708f8151..186dc093b 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php @@ -50,17 +50,16 @@ final class ActivityUserAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByThirdpartyAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByThirdpartyAggregatorTest.php index 20f311d9b..50d0f760e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByThirdpartyAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByThirdpartyAggregatorTest.php @@ -37,17 +37,16 @@ final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByUserAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByUserAggregatorTest.php index 6ef724077..b45d78be1 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByUserAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ByUserAggregatorTest.php @@ -37,17 +37,16 @@ final class ByUserAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorJobAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorJobAggregatorTest.php index 8084a5a45..763ab1a52 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorJobAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorJobAggregatorTest.php @@ -37,17 +37,16 @@ final class CreatorJobAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorScopeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorScopeAggregatorTest.php index 5c053e2ec..1c0b9fe28 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorScopeAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/CreatorScopeAggregatorTest.php @@ -37,17 +37,16 @@ final class CreatorScopeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/DateAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/DateAggregatorTest.php index 952725a30..7fb3b42c4 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/DateAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/DateAggregatorTest.php @@ -37,7 +37,7 @@ final class DateAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -52,10 +52,9 @@ final class DateAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php index d49412fe5..4eebe9dc2 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php @@ -37,17 +37,16 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php index 026dc6cf4..208d7971b 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php @@ -37,15 +37,14 @@ class PersonAggregatorTest extends AbstractAggregatorTest return new PersonAggregator($this->labelPersonHelper); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonsAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonsAggregatorTest.php index 4bdfbb262..bf9a683c3 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonsAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonsAggregatorTest.php @@ -38,17 +38,16 @@ class PersonsAggregatorTest extends AbstractAggregatorTest return new PersonsAggregator($this->labelPersonHelper); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php index 6ceab2d67..0a69efa83 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php @@ -44,17 +44,16 @@ final class AgentAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php index 25a6f9c9b..8257425ce 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php @@ -44,17 +44,16 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php index 4f4eda4a6..064939cf0 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php @@ -44,17 +44,16 @@ final class JobAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php index 92c31b88d..7fa4045fd 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php @@ -44,17 +44,16 @@ final class LocationAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php index 9eb2e7d8c..341b1df9d 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php @@ -44,17 +44,16 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php index 533e4c19a..6a3cd36b3 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php @@ -44,17 +44,16 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php index c6109a7e9..05d68356d 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php @@ -44,17 +44,16 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php index d0d07acfd..755526b6d 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php @@ -62,11 +62,13 @@ final class AgentFilterTest extends AbstractFilterTest ->getResult(); $data = []; foreach ($array as $a) { - yield [ + $data[] = [ 'accepted_agents' => $a, ]; } self::ensureKernelShutdown(); + + return $data; } public static function getQueryBuilders(): iterable diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregatorTest.php index 2213738e8..94284efb6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregatorTest.php @@ -37,17 +37,16 @@ final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregatorTest.php index 5338219c8..ed459fbfd 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregatorTest.php @@ -41,24 +41,24 @@ class ClosingDateAggregatorTest extends AbstractAggregatorTest return self::$closingDateAggregator; } - public function getFormData() + public static function getFormData(): array { - yield ['frequency' => 'YYYY']; - yield ['frequency' => 'YYYY-MM']; - yield ['frequency' => 'YYYY-IV']; + return [ + ['frequency' => 'YYYY'], + ['frequency' => 'YYYY-MM'], + ['frequency' => 'YYYY-IV'], + ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); - $data = [ self::$entityManager->createQueryBuilder() ->select('count(acp.id)') ->from(AccompanyingPeriod::class, 'acp'), ]; - self::ensureKernelShutdown(); return $data; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregatorTest.php index 00560a7a9..4b4978d3c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregatorTest.php @@ -37,17 +37,16 @@ final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregatorTest.php index af759f91c..752b6ba0b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregatorTest.php @@ -37,17 +37,16 @@ final class ConfidentialAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregatorTest.php index 8a25c131f..8cb9031c6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregatorTest.php @@ -37,7 +37,7 @@ final class DurationAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ ['precision' => 'day'], @@ -46,10 +46,9 @@ final class DurationAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregatorTest.php index 04815b5ea..e63564664 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregatorTest.php @@ -37,17 +37,16 @@ final class EmergencyAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregatorTest.php index 3ba43fe99..1a322a998 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregatorTest.php @@ -37,17 +37,16 @@ final class EvaluationAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregatorTest.php index 5c41abf8d..85a61ac14 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregatorTest.php @@ -39,7 +39,7 @@ final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { self::bootKernel(); $repository = self::getContainer()->get(GeographicalUnitLayerLayerRepository::class); @@ -50,12 +50,11 @@ final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { if (null === self::$kernel) { self::bootKernel(); } - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregatorTest.php index 013b5fe0e..483f9a330 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregatorTest.php @@ -37,17 +37,16 @@ final class IntensityAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregatorTest.php index 00bb16675..48e937106 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregatorTest.php @@ -41,24 +41,22 @@ class OpeningDateAggregatorTest extends AbstractAggregatorTest return self::$openingDateAggregator; } - public function getFormData() + public static function getFormData(): array { - yield ['frequency' => 'YYYY']; - yield ['frequency' => 'YYYY-MM']; - yield ['frequency' => 'YYYY-IV']; + return [['frequency' => 'YYYY'], + ['frequency' => 'YYYY-MM'], + ['frequency' => 'YYYY-IV']]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); - $data = [ self::$entityManager->createQueryBuilder() ->select('count(acp.id)') ->from(AccompanyingPeriod::class, 'acp'), ]; - self::ensureKernelShutdown(); return $data; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregatorTest.php index 38ae61a85..ab8e4b4bb 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregatorTest.php @@ -37,17 +37,16 @@ final class OriginAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php index 6b83fa952..813575749 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php @@ -37,15 +37,14 @@ final class PersonParticipatingAggregatorTest extends AbstractAggregatorTest return new PersonParticipatingAggregator($this->labelPersonHelper); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregatorTest.php index 1b35cc38f..fc7fe0244 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregatorTest.php @@ -38,17 +38,16 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ ['date_calc' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregatorTest.php index 85d75aa63..489d042a3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregatorTest.php @@ -52,7 +52,7 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest ); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -61,10 +61,9 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregatorTest.php index 576050a9a..785809c38 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregatorTest.php @@ -37,17 +37,16 @@ final class RequestorAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregatorTest.php index 064d046e4..939966c78 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregatorTest.php @@ -37,17 +37,16 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregatorTest.php index ca2db8d89..f76452fd8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregatorTest.php @@ -37,17 +37,16 @@ final class SocialActionAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregatorTest.php index 86dc9bf48..bad9cec20 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregatorTest.php @@ -37,17 +37,16 @@ final class SocialIssueAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/StepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/StepAggregatorTest.php index 11c0acc3b..f4a34e271 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/StepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/StepAggregatorTest.php @@ -38,7 +38,7 @@ final class StepAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -47,10 +47,9 @@ final class StepAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregatorTest.php index ab459297a..645470e83 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregatorTest.php @@ -38,7 +38,7 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -47,10 +47,9 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php index 475a67470..c816799b8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php @@ -44,18 +44,17 @@ class ByClosingMotiveAggregatorTest extends AbstractAggregatorTest ); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php index 687a07e97..1fee0d997 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php @@ -29,7 +29,7 @@ class ByDateAggregatorTest extends AbstractAggregatorTest return new ByDateAggregator(); } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -44,11 +44,10 @@ class ByDateAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php index 4e15b5286..58e3e5f61 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -36,16 +36,15 @@ class ByStepAggregatorTest extends AbstractAggregatorTest return new ByStepAggregator($translator); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $qb = $em->createQueryBuilder() ->select('COUNT(DISTINCT acpstephistory.id) As export_result') ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregatorTest.php index 15c458409..b275be336 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregatorTest.php @@ -37,17 +37,16 @@ final class EvaluationTypeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregatorTest.php index 88b1510c9..50b3f5b1f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregatorTest.php @@ -38,7 +38,7 @@ final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -47,10 +47,9 @@ final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/CompositionAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/CompositionAggregatorTest.php index afc9c564d..2bfbb83a6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/CompositionAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/HouseholdAggregators/CompositionAggregatorTest.php @@ -38,7 +38,7 @@ final class CompositionAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -47,10 +47,9 @@ final class CompositionAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php index 12a1e3e99..39240dc83 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php @@ -38,7 +38,7 @@ final class AgeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -47,10 +47,9 @@ final class AgeAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/CountryOfBirthAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/CountryOfBirthAggregatorTest.php index 949e821e9..499484587 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/CountryOfBirthAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/CountryOfBirthAggregatorTest.php @@ -37,7 +37,7 @@ final class CountryOfBirthAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ ['group_by_level' => 'continent'], @@ -45,10 +45,9 @@ final class CountryOfBirthAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php index ed67fd2df..7b6978279 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php @@ -37,17 +37,16 @@ final class GenderAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/HouseholdPositionAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/HouseholdPositionAggregatorTest.php index 91d196594..951932126 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/HouseholdPositionAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/HouseholdPositionAggregatorTest.php @@ -40,7 +40,7 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [ @@ -49,10 +49,9 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/MaritalStatusAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/MaritalStatusAggregatorTest.php index 7f407ae9e..6c19379d2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/MaritalStatusAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/MaritalStatusAggregatorTest.php @@ -37,17 +37,16 @@ final class MaritalStatusAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php index 8822ece6c..73a060f9c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php @@ -37,7 +37,7 @@ final class NationalityAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ ['group_by_level' => 'country'], @@ -45,10 +45,9 @@ final class NationalityAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/PostalCodeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/PostalCodeAggregatorTest.php index 53202abe1..98e7f1ba7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/PostalCodeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/PostalCodeAggregatorTest.php @@ -38,17 +38,16 @@ class PostalCodeAggregatorTest extends AbstractAggregatorTest return new PostalCodeAggregator($this->rollingDateConverter); } - public function getFormData() + public static function getFormData(): array { return [ ['calc_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php index 1cd012c70..c3841fd1e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php @@ -37,17 +37,16 @@ final class ActionTypeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorAggregatorTest.php index b850244c0..7238000df 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorAggregatorTest.php @@ -37,17 +37,16 @@ class CreatorAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregatorTest.php index 6fce8d706..3bff92a58 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregatorTest.php @@ -37,17 +37,16 @@ class CreatorJobAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregatorTest.php index 8e8d9276f..26b1298c5 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregatorTest.php @@ -37,17 +37,16 @@ class CreatorScopeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php index 6061a511c..df3307b86 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php @@ -37,17 +37,16 @@ final class GoalAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalResultAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalResultAggregatorTest.php index 60abafb49..0098d9b9c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalResultAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalResultAggregatorTest.php @@ -37,17 +37,16 @@ final class GoalResultAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregatorTest.php index b4101261b..eef2f8840 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregatorTest.php @@ -37,17 +37,16 @@ class HandlingThirdPartyAggregatorTest extends AbstractAggregatorTest return self::$handlingThirdPartyAggregator; } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders() + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/JobAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/JobAggregatorTest.php index b885c3177..8b4ae0dc7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/JobAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/JobAggregatorTest.php @@ -37,17 +37,16 @@ final class JobAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php index 2882c79f0..fd1f0ffc5 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php @@ -38,7 +38,7 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], // there are previous saved export which does not contains any data @@ -48,10 +48,9 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php index 1960027b4..28f970dd0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php @@ -37,17 +37,16 @@ final class ResultAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer() ->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ScopeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ScopeAggregatorTest.php index 54d01528a..26aeb6690 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ScopeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ScopeAggregatorTest.php @@ -37,17 +37,16 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest return $this->aggregator; } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getQueryBuilders(): array + public static function getQueryBuilders(): iterable { self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); return [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php index b18e12010..8fba85161 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php @@ -49,8 +49,11 @@ final class SocialIssueFilterTest extends AbstractFilterTest ->getQuery() ->setMaxResults(1) ->getResult(); - yield ['accepted_socialissues' => new ArrayCollection($array)]; - yield ['accepted_socialissues' => $array]; + + return [ + ['accepted_socialissues' => new ArrayCollection($array)], + ['accepted_socialissues' => $array], + ]; } public static function getQueryBuilders(): iterable diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php index d78f66b4d..c0c2ec249 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php @@ -40,6 +40,8 @@ final class StepFilterTest extends AbstractFilterTest public static function getFormData(): array { + $data = []; + foreach ([ ['accepted_steps_multi' => [AccompanyingPeriod::STEP_DRAFT]], ['accepted_steps_multi' => [AccompanyingPeriod::STEP_CONFIRMED]], @@ -47,8 +49,10 @@ final class StepFilterTest extends AbstractFilterTest ['accepted_steps_multi' => [AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT]], ['accepted_steps_multi' => [AccompanyingPeriod::STEP_CLOSED]], ] as $d) { - yield ['calc_date' => new RollingDate(RollingDate::T_TODAY), ...$d]; + $data[] = ['calc_date' => new RollingDate(RollingDate::T_TODAY), ...$d]; } + + return $data; } public static function getQueryBuilders(): iterable diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php index e6ae76ce7..1e365b323 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/UserJobFilterTest.php @@ -47,14 +47,17 @@ final class UserJobFilterTest extends AbstractFilterTest ->createQuery('SELECT j FROM '.UserJob::class.' j') ->setMaxResults(1) ->getResult(); - yield [ + $data = []; + $data[] = [ 'jobs' => new ArrayCollection($jobs), 'date_calc' => new RollingDate(RollingDate::T_TODAY), ]; - yield [ + $data[] = [ 'jobs' => $jobs, 'date_calc' => new RollingDate(RollingDate::T_TODAY), ]; + + return $data; } public static function getQueryBuilders(): iterable From 07f03ab7157efd292eb79c90ee88df910431efd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 16 Feb 2024 21:49:27 +0100 Subject: [PATCH 067/251] Make data providers static on AbstractExportTest.php and Write a rector rule to adapt existing --- .../Test/Export/AbstractExportTest.php | 22 ++-- ...viderStaticForAbstractExportTestRector.php | 94 +++++++++++++++ ...act-aggregator-test-already-static.php.inc | 54 +++++++++ ...act-aggregator-test-to-make-static.php.inc | 112 ++++++++++++++++++ ...lter.php.inc => not-an-aggregator.php.inc} | 0 ...rStaticForAbstractExportTestRectorTest.php | 40 +++++++ ...bstract-export-test-already-static.php.inc | 51 ++++++++ .../export-test-to-make-static.php.inc | 103 ++++++++++++++++ .../Fixture/not-an-export.php.inc | 5 + .../Fixture/not-an-extends-class.php.inc | 5 + .../config/config.php | 14 +++ 11 files changed, 489 insertions(+), 11 deletions(-) create mode 100644 utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-already-static.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-to-make-static.php.inc rename utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/{not-a-filter.php.inc => not-an-aggregator.php.inc} (100%) create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest.php create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/abstract-export-test-already-static.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/export-test-to-make-static.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/not-an-export.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/not-an-extends-class.php.inc create mode 100644 utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/config/config.php diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index bb4cdc6f7..51403f51c 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -31,9 +31,9 @@ abstract class AbstractExportTest extends WebTestCase { use PrepareClientTrait; - public function dataProviderGetQueryKeys() + public static function dataProviderGetQueryKeys() { - foreach ($this->getFormData() as $data) { + foreach (static::getFormData() as $data) { yield [$data]; } } @@ -41,12 +41,12 @@ abstract class AbstractExportTest extends WebTestCase /** * create data for `ìnitiateQuery` method. */ - public function dataProviderInitiateQuery() + public static function dataProviderInitiateQuery() { - $acl = $this->getAcl(); + $acl = static::getAcl(); - foreach ($this->getModifiersCombination() as $modifiers) { - foreach ($this->getFormData() as $data) { + foreach (static::getModifiersCombination() as $modifiers) { + foreach (static::getFormData() as $data) { yield [$modifiers, $acl, $data]; } } @@ -67,13 +67,13 @@ abstract class AbstractExportTest extends WebTestCase * ); * ``` */ - public function getACL() + public static function getACL() { if (null === static::$kernel) { static::bootKernel(); } - $em = static::$container->get(EntityManagerInterface::class); + $em = static::getContainer()->get(EntityManagerInterface::class); $centers = $em->getRepository(\Chill\MainBundle\Entity\Center::class) ->findAll(); @@ -109,16 +109,16 @@ abstract class AbstractExportTest extends WebTestCase * * @return array an array of data. Example : `array( array(), array('fields' => array(1,2,3), ...)` where an empty array and `array(1,2,3)` are possible values */ - abstract public function getFormData(); + abstract public static function getFormData(): array; /** * get the possible modifiers which could apply in combination to this * export. * . * - * @return array of string[] an array which contains an array of possible modifiers. Example : `array( array('modifier_1', 'modifier_2'), array('modifier_1'), ...)` + * @return list> of string[] an array which contains an array of possible modifiers. Example : `array( array('modifier_1', 'modifier_2'), array('modifier_1'), ...)` */ - abstract public function getModifiersCombination(); + abstract public static function getModifiersCombination(): array; protected function getParameters(bool $filterStatsByCenter): ParameterBagInterface { diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php new file mode 100644 index 000000000..95a7c6b43 --- /dev/null +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php @@ -0,0 +1,94 @@ +extends) { + return null; + } + + if (AbstractExportTest::class !== $node->extends->toString()) { + return null; + } + + $new = []; + $matched = false; + + foreach ($node->stmts as $k => $stmt) { + if (!$stmt instanceof Node\Stmt\ClassMethod) { + $new[] = $stmt; + continue; + } + + if ('getFormData' === $stmt->name->name || 'getModifiersCombination' === $stmt->name->name) { + if ($stmt->isStatic()) { + $new[] = $stmt; + continue; + } + + $matched = true; + $method = new Node\Stmt\ClassMethod($stmt->name->name); + $method->flags = Node\Stmt\Class_::MODIFIER_PUBLIC | Node\Stmt\Class_::MODIFIER_STATIC; + $method->returnType = match ($stmt->name->name) { + 'getFormData' => new Node\Identifier('array'), + 'getModifiersCombination' => new Node\Identifier('array'), + default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) + }; + + foreach ($stmt->getStmts() as $s) { + $method->stmts[] = $s; + } + + $new[] = $method; + } else { + $new[] = $stmt; + } + } + + if (!$matched) { + return null; + } + + $node->stmts = $new; + + return $node; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-already-static.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-already-static.php.inc new file mode 100644 index 000000000..cfe39799b --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-already-static.php.inc @@ -0,0 +1,54 @@ +get(ClosingDateAggregator::class); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + } + + public function getAggregator() + { + return self::$closingDateAggregator; + } + + public static function getFormData(): array + { + yield ['frequency' => 'YYYY']; + yield ['frequency' => 'YYYY-MM']; + yield ['frequency' => 'YYYY-IV']; + } + + public static function getQueryBuilders(): iterable + { + self::bootKernel(); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + $data = [ + self::$entityManager->createQueryBuilder() + ->select('count(acp.id)') + ->from(AccompanyingPeriod::class, 'acp'), + ]; + self::ensureKernelShutdown(); + return $data; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-to-make-static.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-to-make-static.php.inc new file mode 100644 index 000000000..dc58d9474 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/abstract-aggregator-test-to-make-static.php.inc @@ -0,0 +1,112 @@ +get(ClosingDateAggregator::class); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + } + + public function getAggregator() + { + return self::$closingDateAggregator; + } + + public function getFormData() + { + yield ['frequency' => 'YYYY']; + yield ['frequency' => 'YYYY-MM']; + yield ['frequency' => 'YYYY-IV']; + } + + public function getQueryBuilders() + { + self::bootKernel(); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + + $data = [ + self::$entityManager->createQueryBuilder() + ->select('count(acp.id)') + ->from(AccompanyingPeriod::class, 'acp'), + ]; + + self::ensureKernelShutdown(); + + return $data; + } +} +----- +get(ClosingDateAggregator::class); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + } + + public function getAggregator() + { + return self::$closingDateAggregator; + } + + public static function getFormData(): array + { + yield ['frequency' => 'YYYY']; + yield ['frequency' => 'YYYY-MM']; + yield ['frequency' => 'YYYY-IV']; + } + + public static function getQueryBuilders(): iterable + { + self::bootKernel(); + self::$entityManager = self::getContainer()->get(EntityManagerInterface::class); + $data = [ + self::$entityManager->createQueryBuilder() + ->select('count(acp.id)') + ->from(AccompanyingPeriod::class, 'acp'), + ]; + self::ensureKernelShutdown(); + return $data; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-an-aggregator.php.inc similarity index 100% rename from utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-a-filter.php.inc rename to utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRectorTest/Fixture/not-an-aggregator.php.inc diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest.php b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest.php new file mode 100644 index 000000000..f849d3188 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest.php @@ -0,0 +1,40 @@ +doTestFile($file); + } + + public static function provideData(): \Iterator + { + return self::yieldFilesFromDirectory(__DIR__.'/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__.'/config/config.php'; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/abstract-export-test-already-static.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/abstract-export-test-already-static.php.inc new file mode 100644 index 000000000..ba171d545 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/abstract-export-test-already-static.php.inc @@ -0,0 +1,51 @@ +get(PersonRepository::class); + + yield new CountPerson($personRepository, $this->getParameters(true)); + yield new CountPerson($personRepository, $this->getParameters(false)); + } + + public static function getFormData(): array + { + return [ + [], + ]; + } + + public static function getModifiersCombination(): array + { + return [['person']]; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/export-test-to-make-static.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/export-test-to-make-static.php.inc new file mode 100644 index 000000000..2a6a81800 --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/export-test-to-make-static.php.inc @@ -0,0 +1,103 @@ +get(PersonRepository::class); + + yield new CountPerson($personRepository, $this->getParameters(true)); + yield new CountPerson($personRepository, $this->getParameters(false)); + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getModifiersCombination() + { + return [['person']]; + } +} +----- +get(PersonRepository::class); + + yield new CountPerson($personRepository, $this->getParameters(true)); + yield new CountPerson($personRepository, $this->getParameters(false)); + } + + public static function getFormData(): array + { + return [ + [], + ]; + } + + public static function getModifiersCombination(): array + { + return [['person']]; + } +} diff --git a/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/not-an-export.php.inc b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/not-an-export.php.inc new file mode 100644 index 000000000..85df5e07d --- /dev/null +++ b/utils/rector/tests/ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest/Fixture/not-an-export.php.inc @@ -0,0 +1,5 @@ +rule(Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractExportTestRector::class); +}; From bb4b7e973539e70aec7d411e8db347012c863e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 16 Feb 2024 21:52:47 +0100 Subject: [PATCH 068/251] Make all existing export test data provider static --- rector.php | 3 +-- .../Export/Export/LinkedToACP/AvgActivityDurationTest.php | 4 ++-- .../Export/LinkedToACP/AvgActivityVisitDurationTest.php | 4 ++-- .../Tests/Export/Export/LinkedToACP/CountActivityTest.php | 4 ++-- .../Export/LinkedToACP/CountHouseholdOnActivityTest.php | 4 ++-- .../Export/Export/LinkedToACP/CountPersonsOnActivityTest.php | 4 ++-- .../Export/Export/LinkedToACP/SumActivityDurationTest.php | 4 ++-- .../Export/LinkedToACP/SumActivityVisitDurationTest.php | 4 ++-- .../Tests/Export/Export/LinkedToPerson/CountActivityTest.php | 4 ++-- .../Export/LinkedToPerson/CountHouseholdOnActivityTest.php | 4 ++-- .../Tests/Export/Export/LinkedToPerson/ListActivityTest.php | 4 ++-- .../Export/Export/LinkedToPerson/StatActivityDurationTest.php | 4 ++-- ...DurationAPWorkPersonAssociatedOnAccompanyingPeriodTest.php | 4 ++-- .../Export/AvgDurationAPWorkPersonAssociatedOnWorkTest.php | 4 ++-- .../Export/Export/CountAccompanyingCourseStepHistoryTest.php | 4 ++-- .../Tests/Export/Export/CountAccompanyingCourseTest.php | 4 ++-- ...nyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php | 4 ++-- .../CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php | 4 ++-- .../Tests/Export/Export/CountHouseholdInPeriodTest.php | 4 ++-- ...ersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest.php | 4 ++-- .../ChillPersonBundle/Tests/Export/Export/CountPersonTest.php | 4 ++-- .../Export/Export/CountPersonWithAccompanyingCourseTest.php | 4 ++-- .../Tests/Export/Export/ListAccompanyingPeriodTest.php | 4 ++-- ...nyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php | 4 ++-- .../ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php | 4 ++-- .../Tests/Export/Export/ListEvaluationTest.php | 4 ++-- .../Tests/Export/Export/ListHouseholdInPeriodTest.php | 4 ++-- .../Export/Export/ListPersonHavingAccompanyingPeriodTest.php | 4 ++-- .../ChillPersonBundle/Tests/Export/Export/ListPersonTest.php | 4 ++-- .../Export/ListPersonWithAccompanyingPeriodDetailsTest.php | 4 ++-- .../Export/Export/StatAccompanyingCourseDurationTest.php | 4 ++-- 31 files changed, 61 insertions(+), 62 deletions(-) diff --git a/rector.php b/rector.php index a358e8661..836202495 100644 --- a/rector.php +++ b/rector.php @@ -52,8 +52,7 @@ return static function (RectorConfig $rectorConfig): void { // chill rules $rectorConfig->rules([ - \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractFilterTestRector::class, - \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector::class, + \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractExportTestRector::class, ]); // skip some path... diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityDurationTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityDurationTest.php index fc9a4cdd2..6231673c2 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityDurationTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityDurationTest.php @@ -35,14 +35,14 @@ final class AvgActivityDurationTest extends AbstractExportTest yield new AvgActivityDuration($activityRepository, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityVisitDurationTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityVisitDurationTest.php index 427e19e95..76ce0070f 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityVisitDurationTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/AvgActivityVisitDurationTest.php @@ -35,14 +35,14 @@ final class AvgActivityVisitDurationTest extends AbstractExportTest yield new AvgActivityVisitDuration($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountActivityTest.php index efcb54adf..9035807c3 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountActivityTest.php @@ -35,14 +35,14 @@ final class CountActivityTest extends AbstractExportTest yield new CountActivity($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php index a13f44ec6..e7c7b7909 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php @@ -38,14 +38,14 @@ class CountHouseholdOnActivityTest extends AbstractExportTest yield new CountHouseholdOnActivity($this->entityManager, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php index 4b8f2ed69..fcfb9b12e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php @@ -37,12 +37,12 @@ class CountPersonsOnActivityTest extends AbstractExportTest yield new CountPersonsOnActivity($em, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[ Declarations::ACTIVITY, diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityDurationTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityDurationTest.php index ccd43f128..319d9408e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityDurationTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityDurationTest.php @@ -35,14 +35,14 @@ final class SumActivityDurationTest extends AbstractExportTest yield new SumActivityDuration($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityVisitDurationTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityVisitDurationTest.php index 42d263f0c..a92a49cbb 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityVisitDurationTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/SumActivityVisitDurationTest.php @@ -39,14 +39,14 @@ final class SumActivityVisitDurationTest extends AbstractExportTest yield new SumActivityVisitDuration($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountActivityTest.php index e9df683f4..569a66a0c 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountActivityTest.php @@ -35,14 +35,14 @@ final class CountActivityTest extends AbstractExportTest yield new CountActivity($activityRepository, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php index a2b4e6207..7e222d8e1 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php @@ -38,14 +38,14 @@ class CountHouseholdOnActivityTest extends AbstractExportTest yield new CountHouseholdOnActivity($this->activityRepository, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [ diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/ListActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/ListActivityTest.php index 6d2c85344..91a532b74 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/ListActivityTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/ListActivityTest.php @@ -67,7 +67,7 @@ final class ListActivityTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [ ['fields' => [ @@ -89,7 +89,7 @@ final class ListActivityTest extends AbstractExportTest ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/StatActivityDurationTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/StatActivityDurationTest.php index 3166e0a3c..31225eb8e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/StatActivityDurationTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/StatActivityDurationTest.php @@ -38,14 +38,14 @@ final class StatActivityDurationTest extends AbstractExportTest yield new StatActivityDuration($activityRepository, $this->getParameters(false), 'sum'); } - public function getFormData(): array + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['activity'], diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriodTest.php index 37357aa0a..d0b05aeaf 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriodTest.php @@ -36,14 +36,14 @@ class AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriodTest extends Abstract yield new AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod($this->getParameters(false), $repository); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnWorkTest.php index 5666747b0..6aa2bb4df 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/AvgDurationAPWorkPersonAssociatedOnWorkTest.php @@ -36,12 +36,12 @@ class AvgDurationAPWorkPersonAssociatedOnWorkTest extends AbstractExportTest yield new AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod($this->getParameters(false), $repository); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php index 6d3a30a4e..202562ed2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php @@ -36,12 +36,12 @@ final class CountAccompanyingCourseStepHistoryTest extends AbstractExportTest yield new CountAccompanyingCourseStepHistory($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE], [Declarations::ACP_TYPE, Declarations::ACP_STEP_HISTORY]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php index 57eb8a4b5..fa7c2cf60 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php @@ -36,12 +36,12 @@ final class CountAccompanyingCourseTest extends AbstractExportTest yield new CountAccompanyingCourse($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php index fce135e2d..4f20c5f75 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php @@ -36,12 +36,12 @@ final class CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest e yield new CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::SOCIAL_WORK_ACTION_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php index fe2641794..046bf2308 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -36,12 +36,12 @@ final class CountAccompanyingPeriodWorkAssociatePersonOnWorkTest extends Abstrac yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::SOCIAL_WORK_ACTION_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountHouseholdInPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountHouseholdInPeriodTest.php index 45f1da9c5..989779dce 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountHouseholdInPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountHouseholdInPeriodTest.php @@ -39,14 +39,14 @@ class CountHouseholdInPeriodTest extends AbstractExportTest yield new CountHouseholdInPeriod($em, $rollingDate, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [ ['calc_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest.php index 242346ab5..2530458c1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -36,12 +36,12 @@ class CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWorkTest extends Abstr yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [Declarations::SOCIAL_WORK_ACTION_TYPE, Declarations::PERSON_TYPE, Declarations::ACP_TYPE], diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php index 3e4c58897..ba171d545 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php @@ -37,14 +37,14 @@ final class CountPersonTest extends AbstractExportTest yield new CountPerson($personRepository, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [ [], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [['person']]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonWithAccompanyingCourseTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonWithAccompanyingCourseTest.php index d50640089..acdc475bc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonWithAccompanyingCourseTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonWithAccompanyingCourseTest.php @@ -36,12 +36,12 @@ class CountPersonWithAccompanyingCourseTest extends AbstractExportTest yield new CountPersonWithAccompanyingCourse($em, $this->getParameters(false)); } - public function getFormData() + public static function getFormData(): array { return [[]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodTest.php index dcf916252..220ba0ad7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodTest.php @@ -100,14 +100,14 @@ class ListAccompanyingPeriodTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [ ['calc_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php index b1d7830fa..bdad9ed4f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest.php @@ -78,14 +78,14 @@ class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest extends ); } - public function getFormData() + public static function getFormData(): array { return [ ['calc_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php index 118347282..bb4ebb5a1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -78,14 +78,14 @@ class ListAccompanyingPeriodWorkAssociatePersonOnWorkTest extends AbstractExport ); } - public function getFormData() + public static function getFormData(): array { return [ ['calc_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListEvaluationTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListEvaluationTest.php index 116c072ef..74420c841 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListEvaluationTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListEvaluationTest.php @@ -80,12 +80,12 @@ class ListEvaluationTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [['calc_date' => new RollingDate(RollingDate::T_TODAY)]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListHouseholdInPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListHouseholdInPeriodTest.php index a1b78e5e9..ea0d9524d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListHouseholdInPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListHouseholdInPeriodTest.php @@ -60,12 +60,12 @@ class ListHouseholdInPeriodTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [['calc_date' => new RollingDate(RollingDate::T_TODAY)]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::PERSON_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonHavingAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonHavingAccompanyingPeriodTest.php index 98bc70ae1..e4edaaf9a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonHavingAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonHavingAccompanyingPeriodTest.php @@ -57,12 +57,12 @@ class ListPersonHavingAccompanyingPeriodTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [['address_date_rolling' => new RollingDate(RollingDate::T_TODAY), 'fields' => ListPersonHelper::FIELDS]]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::PERSON_TYPE, Declarations::ACP_TYPE]]; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php index a89a28c5f..27fc2c71a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php @@ -75,7 +75,7 @@ final class ListPersonTest extends AbstractExportTest ); } - public function getFormData(): iterable + public static function getFormData(): array { foreach ([ ['fields' => ['id', 'firstName', 'lastName']], @@ -88,7 +88,7 @@ final class ListPersonTest extends AbstractExportTest } } - public function getModifiersCombination(): array + public static function getModifiersCombination(): array { return [ ['person'], diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonWithAccompanyingPeriodDetailsTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonWithAccompanyingPeriodDetailsTest.php index cc5605edb..dd30bcdd0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonWithAccompanyingPeriodDetailsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonWithAccompanyingPeriodDetailsTest.php @@ -54,14 +54,14 @@ class ListPersonWithAccompanyingPeriodDetailsTest extends AbstractExportTest ); } - public function getFormData() + public static function getFormData(): array { return [ ['address_date' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [ [Declarations::PERSON_TYPE, Declarations::ACP_TYPE], diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php index 436061c97..f62cd2be4 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php @@ -43,14 +43,14 @@ final class StatAccompanyingCourseDurationTest extends AbstractExportTest yield new StatAccompanyingCourseDuration($em, $rollingDateconverter, $this->getParameters(false)); } - public function getFormData(): array + public static function getFormData(): array { return [ ['closingdate_rolling' => new RollingDate(RollingDate::T_TODAY)], ]; } - public function getModifiersCombination() + public static function getModifiersCombination(): array { return [[Declarations::ACP_TYPE]]; } From d135b2ba0a7ee8fd564b3975b3f18051882731ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 18 Feb 2024 23:06:54 +0100 Subject: [PATCH 069/251] Refactor rector rules to simplify code and fix rule definition --- ...oviderStaticForAbstractAggregatorTestRector.php | 10 ++++++---- ...taProviderStaticForAbstractExportTestRector.php | 14 ++++++++++---- ...taProviderStaticForAbstractFilterTestRector.php | 10 ++++++---- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php index 1dd0cfa50..bac7d66a0 100644 --- a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector.php @@ -12,13 +12,14 @@ declare(strict_types=1); namespace Chill\Utils\Rector\Rector; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; -use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractFilterTest\ChillBundleMakeDataProviderStaticForAbstractFilterTestTest; +use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractFilterTest\ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest; use PhpParser\Node; use Rector\Rector\AbstractRector; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see ChillBundleMakeDataProviderStaticForAbstractFilterTestTest + * @see ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest */ final class ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector extends AbstractRector { @@ -26,7 +27,9 @@ final class ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector ext { return new RuleDefinition( 'Make static each method which provide data on AbstractAggregatorTest', - [''] + [ + new CodeSample('', ''), + ] ); } @@ -70,7 +73,6 @@ final class ChillBundleMakeDataProviderStaticForAbstractAggregatorTestRector ext $method->returnType = match ($stmt->name->name) { 'getFormData' => new Node\Identifier('array'), 'getQueryBuilders' => new Node\Identifier('iterable'), - default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) }; foreach ($stmt->getStmts() as $s) { diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php index 95a7c6b43..fc2f7a3f4 100644 --- a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractExportTestRector.php @@ -12,13 +12,18 @@ declare(strict_types=1); namespace Chill\Utils\Rector\Rector; use Chill\MainBundle\Test\Export\AbstractExportTest; -use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractFilterTest\ChillBundleMakeDataProviderStaticForAbstractFilterTestTest; +use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest\ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest; use PhpParser\Node; use Rector\Rector\AbstractRector; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see ChillBundleMakeDataProviderStaticForAbstractFilterTestTest + * Class ChillBundleMakeDataProviderStaticForAbstractExportTestRector. + * + * This class is responsible for making each method that provides data on AbstractExportTest static. + * + * @see ChillBundleMakeDataProviderStaticForAbstractExportTestRectorTest for testing */ final class ChillBundleMakeDataProviderStaticForAbstractExportTestRector extends AbstractRector { @@ -26,7 +31,9 @@ final class ChillBundleMakeDataProviderStaticForAbstractExportTestRector extends { return new RuleDefinition( 'Make static each method which provide data on AbstractExportTest', - [''] + [ + new CodeSample('', ''), + ] ); } @@ -70,7 +77,6 @@ final class ChillBundleMakeDataProviderStaticForAbstractExportTestRector extends $method->returnType = match ($stmt->name->name) { 'getFormData' => new Node\Identifier('array'), 'getModifiersCombination' => new Node\Identifier('array'), - default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) }; foreach ($stmt->getStmts() as $s) { diff --git a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php index 82176cec1..053b9e5c0 100644 --- a/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php +++ b/utils/rector/src/Rector/ChillBundleMakeDataProviderStaticForAbstractFilterTestRector.php @@ -12,13 +12,14 @@ declare(strict_types=1); namespace Chill\Utils\Rector\Rector; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractFilterTest\ChillBundleMakeDataProviderStaticForAbstractFilterTestTest; +use Chill\Utils\Rector\Tests\ChillBundleMakeDataProviderStaticForAbstractFilterTest\ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest; use PhpParser\Node; use Rector\Rector\AbstractRector; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see ChillBundleMakeDataProviderStaticForAbstractFilterTestTest + * @see ChillBundleMakeDataProviderStaticForAbstractFilterTestRectorTest */ final class ChillBundleMakeDataProviderStaticForAbstractFilterTestRector extends AbstractRector { @@ -26,7 +27,9 @@ final class ChillBundleMakeDataProviderStaticForAbstractFilterTestRector extends { return new RuleDefinition( 'Make static each method which provide data', - [''] + [ + new CodeSample('', ''), + ] ); } @@ -70,7 +73,6 @@ final class ChillBundleMakeDataProviderStaticForAbstractFilterTestRector extends $method->returnType = match ($stmt->name->name) { 'getFormData' => new Node\Identifier('array'), 'getQueryBuilders' => new Node\Identifier('iterable'), - default => throw new \UnexpectedValueException('this name is not supported: '.$stmt->name->name) }; foreach ($stmt->getStmts() as $s) { From d0f23eb6b1f84c7520ffee802f449cba0d6cd777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 18 Feb 2024 23:17:33 +0100 Subject: [PATCH 070/251] fixup! Make all existing export test data provider static --- .../ChillPersonBundle/Tests/Export/Export/ListPersonTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php index 27fc2c71a..88b192f51 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php @@ -77,6 +77,7 @@ final class ListPersonTest extends AbstractExportTest public static function getFormData(): array { + $data = []; foreach ([ ['fields' => ['id', 'firstName', 'lastName']], ['fields' => ['id', 'birthdate', 'gender', 'memo', 'email', 'phonenumber']], @@ -84,8 +85,10 @@ final class ListPersonTest extends AbstractExportTest ['fields' => ['id', 'nationality']], ['fields' => ['id', 'countryOfBirth']], ] as $base) { - yield [...$base, 'address_date' => new \DateTimeImmutable('today')]; + $data[] = [...$base, 'address_date' => new \DateTimeImmutable('today')]; } + + return $data; } public static function getModifiersCombination(): array From 0081146a7865a076fad9cb95ffa60b76f8a74cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 19 Feb 2024 15:38:28 +0100 Subject: [PATCH 071/251] Change non-static class-level variables and methods to static in tests's data providers The update modifies several test classes within the "chill-project" to change non-static class-level variables and methods to static ones. This change has been made to improve readability, performance, and to eliminate unnecessary instantiation of class objects in test scenarios. Also, flush and clear actions on the entity manager are moved to individual data providers. --- .../PersonDocumentACLAwareRepositoryTest.php | 7 +-- .../Test/PrepareCenterTrait.php | 2 +- .../Test/PrepareScopeTrait.php | 2 +- .../ChillMainBundle/Test/PrepareUserTrait.php | 2 +- .../NotificationApiControllerTest.php | 12 +++-- .../Tests/Controller/UserControllerTest.php | 22 +-------- .../Authorization/AuthorizationHelperTest.php | 32 ++++++------- .../Tests/Action/Remove/PersonMoveTest.php | 45 ++++++++++--------- .../Controller/HouseholdApiControllerTest.php | 10 ++--- .../RelationshipApiControllerTest.php | 16 +++---- .../SocialWorkEvaluationApiControllerTest.php | 23 +++++----- 11 files changed, 81 insertions(+), 92 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php index c1db6ad3e..a6c8e591a 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php @@ -123,11 +123,12 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase self::assertIsInt($nb, 'test that the query could be executed'); } - public function provideDateForFetchQueryForAccompanyingPeriod(): iterable + public static function provideDateForFetchQueryForAccompanyingPeriod(): iterable { - $this->setUp(); + self::bootKernel(); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); - if (null === $period = $this->entityManager->createQuery( + if (null === $period = $entityManager->createQuery( 'SELECT p FROM '.AccompanyingPeriod::class.' p WHERE SIZE(p.participations) > 0' ) ->setMaxResults(1)->getSingleResult()) { diff --git a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php index 00045e889..a8a91ba19 100644 --- a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php +++ b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php @@ -28,7 +28,7 @@ trait PrepareCenterTrait /** * prepare a mocked center, with and id and name given. */ - protected function prepareCenter(int $id, string $name): Center + protected static function prepareCenter(int $id, string $name): Center { $center = new Center(); $center->setName($name); diff --git a/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php index dbd1825d8..7bf8a41a0 100644 --- a/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php +++ b/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php @@ -28,7 +28,7 @@ trait PrepareScopeTrait * * The name will be present in both lang `fr` and `en`. */ - protected function prepareScope(int $id, string $name): Scope + protected static function prepareScope(int $id, string $name): Scope { $scope = new Scope(); // set the name diff --git a/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php index 044d17400..fedc46fa1 100644 --- a/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php +++ b/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php @@ -50,7 +50,7 @@ trait PrepareUserTrait * * @throws \LogicException if the trait is not set up */ - protected function prepareUser(array $permissions) + protected static function prepareUser(array $permissions) { $user = new User(); diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NotificationApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NotificationApiControllerTest.php index bfd5ea684..1c19a1466 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NotificationApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NotificationApiControllerTest.php @@ -28,21 +28,23 @@ final class NotificationApiControllerTest extends WebTestCase { use PrepareClientTrait; - private array $toDelete = []; + private static array $toDelete = []; protected function tearDown(): void { $em = self::getContainer()->get(EntityManagerInterface::class); - foreach ($this->toDelete as [$className, $id]) { + foreach (self::$toDelete as [$className, $id]) { $object = $em->find($className, $id); $em->remove($object); } $em->flush(); + + self::$toDelete = []; } - public function generateDataMarkAsRead() + public static function generateDataMarkAsRead() { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -62,7 +64,9 @@ final class NotificationApiControllerTest extends WebTestCase $em->refresh($notification); $em->flush(); - $this->toDelete[] = [Notification::class, $notification->getId()]; + self::$toDelete[] = [Notification::class, $notification->getId()]; + + self::ensureKernelShutdown(); yield [$notification->getId()]; } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php index 6e5d362e0..4108566ad 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php @@ -27,23 +27,7 @@ final class UserControllerTest extends WebTestCase { use PrepareClientTrait; - private array $toDelete = []; - - protected function tearDown(): void - { - self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - - foreach ($this->toDelete as [$class, $id]) { - $obj = $em->getRepository($class)->find($id); - $em->remove($obj); - } - - $em->flush(); - self::ensureKernelShutdown(); - } - - public function dataGenerateUserId() + public static function dataGenerateUserId() { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -58,11 +42,9 @@ final class UserControllerTest extends WebTestCase $em->persist($user); $em->flush(); - $this->toDelete[] = [User::class, $user->getId()]; + self::ensureKernelShutdown(); yield [$user->getId(), $user->getUsername()]; - - self::ensureKernelShutdown(); } public function testList() diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php index c445a0014..1ebe9610d 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php @@ -45,17 +45,17 @@ final class AuthorizationHelperTest extends KernelTestCase self::bootKernel(); } - public function dataProvider_getReachableCenters() + public static function dataProvider_getReachableCenters() { self::bootKernel(); - $centerA = $this->prepareCenter(1, 'center A'); - $centerB = $this->prepareCenter(2, 'center B'); - $scopeA = $this->prepareScope(1, 'scope default'); - $scopeB = $this->prepareScope(2, 'scope B'); - $scopeC = $this->prepareScope(3, 'scope C'); + $centerA = self::prepareCenter(1, 'center A'); + $centerB = self::prepareCenter(2, 'center B'); + $scopeA = self::prepareScope(1, 'scope default'); + $scopeB = self::prepareScope(2, 'scope B'); + $scopeC = self::prepareScope(3, 'scope C'); - $userA = $this->prepareUser([ + $userA = self::prepareUser([ [ 'center' => $centerA, 'permissionsGroup' => [ @@ -72,7 +72,7 @@ final class AuthorizationHelperTest extends KernelTestCase ], ]); - $ah = $this->getAuthorizationHelper(); + $ah = self::getAuthorizationHelper(); return [ // without scopes @@ -143,15 +143,15 @@ final class AuthorizationHelperTest extends KernelTestCase ]; } - public function dataProvider_getReachableScopes() + public static function dataProvider_getReachableScopes() { - $centerA = $this->prepareCenter(1, 'center A'); - $centerB = $this->prepareCenter(2, 'center B'); - $scopeA = $this->prepareScope(1, 'scope default'); - $scopeB = $this->prepareScope(2, 'scope B'); - $scopeC = $this->prepareScope(3, 'scope C'); + $centerA = self::prepareCenter(1, 'center A'); + $centerB = self::prepareCenter(2, 'center B'); + $scopeA = self::prepareScope(1, 'scope default'); + $scopeB = self::prepareScope(2, 'scope B'); + $scopeC = self::prepareScope(3, 'scope C'); - $userA = $this->prepareUser([ + $userA = self::prepareUser([ [ 'center' => $centerA, 'permissionsGroup' => [ @@ -579,7 +579,7 @@ final class AuthorizationHelperTest extends KernelTestCase /** * @return AuthorizationHelper */ - private function getAuthorizationHelper() + private static function getAuthorizationHelper() { return self::getContainer() ->get(AuthorizationHelper::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Action/Remove/PersonMoveTest.php b/src/Bundle/ChillPersonBundle/Tests/Action/Remove/PersonMoveTest.php index b48a3ec4e..b64b2cdeb 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Action/Remove/PersonMoveTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Action/Remove/PersonMoveTest.php @@ -174,15 +174,16 @@ class PersonMoveTest extends KernelTestCase self::$entitiesToDelete[] = [Person\PersonCenterHistory::class, $personCenterHistoryBSecond]; } - public function dataProviderMovePerson(): iterable + public static function dataProviderMovePerson(): iterable { - $this->setUp(); + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); $personA = new Person(); $personB = new Person(); - $this->em->persist($personA); - $this->em->persist($personB); + $em->persist($personA); + $em->persist($personB); self::$entitiesToDelete[] = [Person::class, $personA]; self::$entitiesToDelete[] = [Person::class, $personB]; @@ -197,9 +198,9 @@ class PersonMoveTest extends KernelTestCase $activity->addPerson($personA); $activity->addPerson($personB); - $this->em->persist($personA); - $this->em->persist($personB); - $this->em->persist($activity); + $em->persist($personA); + $em->persist($personB); + $em->persist($activity); self::$entitiesToDelete[] = [Person::class, $personA]; self::$entitiesToDelete[] = [Person::class, $personB]; @@ -219,11 +220,11 @@ class PersonMoveTest extends KernelTestCase ->setStartDate(new \DateTimeImmutable('2023-01-01')) ); - $this->em->persist($personA); - $this->em->persist($personB); - $this->em->persist($household); - $this->em->persist($memberA); - $this->em->persist($memberB); + $em->persist($personA); + $em->persist($personB); + $em->persist($household); + $em->persist($memberA); + $em->persist($memberB); self::$entitiesToDelete[] = [HouseholdMember::class, $memberA]; self::$entitiesToDelete[] = [HouseholdMember::class, $memberB]; @@ -240,9 +241,9 @@ class PersonMoveTest extends KernelTestCase $parcours->addPerson($personA); $parcours->addPerson($personB); - $this->em->persist($personA); - $this->em->persist($personB); - $this->em->persist($parcours); + $em->persist($personA); + $em->persist($personB); + $em->persist($parcours); self::$entitiesToDelete[] = [Person::class, $personA]; self::$entitiesToDelete[] = [Person::class, $personB]; @@ -262,11 +263,11 @@ class PersonMoveTest extends KernelTestCase $relationship->setReverse(false); $relationship->setCreatedBy($user); - $this->em->persist($personA); - $this->em->persist($personB); - $this->em->persist($relation); - $this->em->persist($user); - $this->em->persist($relationship); + $em->persist($personA); + $em->persist($personB); + $em->persist($relation); + $em->persist($user); + $em->persist($relationship); self::$entitiesToDelete[] = [Person::class, $personA]; self::$entitiesToDelete[] = [Person::class, $personB]; @@ -276,7 +277,7 @@ class PersonMoveTest extends KernelTestCase yield [$personA, $personB, 'move 2 people with a relationship']; - $this->em->flush(); - $this->em->clear(); + $em->flush(); + $em->clear(); } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php index fc73123cb..03b5a5576 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -31,7 +31,7 @@ final class HouseholdApiControllerTest extends WebTestCase { use PrepareClientTrait; - private array $toDelete = []; + private static array $toDelete = []; protected function tearDown(): void { @@ -39,17 +39,17 @@ final class HouseholdApiControllerTest extends WebTestCase $em = self::getContainer()->get(EntityManagerInterface::class); - foreach ($this->toDelete as [$class, $id]) { + foreach (self::$toDelete as [$class, $id]) { $obj = $em->getRepository($class)->find($id); $em->remove($obj); } $em->flush(); - + self::$toDelete = []; self::ensureKernelShutdown(); } - public function generateHouseholdAssociatedWithAddressReference() + public static function generateHouseholdAssociatedWithAddressReference() { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -80,7 +80,7 @@ final class HouseholdApiControllerTest extends WebTestCase $em->flush(); - $this->toDelete += [ + self::$toDelete += [ [HouseholdMember::class, $m->getId()], [User::class, $p->getId()], [Household::class, $h->getId()], diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php index 0de5e8b12..206314939 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php @@ -31,9 +31,9 @@ final class RelationshipApiControllerTest extends WebTestCase /** * A cache for all relations. * - * @var array|Relation[]|null + * @var array|null */ - private ?array $relations = null; + private static ?array $relations = null; protected function tearDown(): void { @@ -75,7 +75,7 @@ final class RelationshipApiControllerTest extends WebTestCase ]; } - public function relationProvider(): array + public static function relationProvider(): array { self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); @@ -94,7 +94,7 @@ final class RelationshipApiControllerTest extends WebTestCase self::ensureKernelShutdown(); return [ - [$personIdWithoutRelations[0]['id'], $personIdWithoutRelations[1]['id'], $this->getRandomRelation($em)->getId(), true], + [$personIdWithoutRelations[0]['id'], $personIdWithoutRelations[1]['id'], self::getRandomRelation($em)->getId(), true], ]; } @@ -137,13 +137,13 @@ final class RelationshipApiControllerTest extends WebTestCase $this->assertEquals(200, $response->getStatusCode()); } - private function getRandomRelation(EntityManagerInterface $em): Relation + private static function getRandomRelation(EntityManagerInterface $em): Relation { - if (null === $this->relations) { - $this->relations = $em->getRepository(Relation::class) + if (null === self::$relations) { + self::$relations = $em->getRepository(Relation::class) ->findAll(); } - return $this->relations[\array_rand($this->relations)]; + return self::$relations[\array_rand(self::$relations)]; } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/SocialWorkEvaluationApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/SocialWorkEvaluationApiControllerTest.php index 85ca7aad1..ad41af989 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/SocialWorkEvaluationApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/SocialWorkEvaluationApiControllerTest.php @@ -28,43 +28,44 @@ final class SocialWorkEvaluationApiControllerTest extends WebTestCase private EntityManagerInterface $em; - private ?Evaluation $evaluationToReset = null; + private static ?Evaluation $evaluationToReset = null; protected function tearDown(): void { - if (null === $this->evaluationToReset) { + if (null === self::$evaluationToReset) { return; } self::bootKernel(); $em = self::getContainer()->get(EntityManagerInterface::class); - $evaluation = $em->find(Evaluation::class, $this->evaluationToReset->getId()); + $evaluation = $em->find(Evaluation::class, self::$evaluationToReset->getId()); $evaluation->setActive(true); $em->flush(); } - public function dataGenerateSocialActionWithEvaluations(): iterable + public static function dataGenerateSocialActionWithEvaluations(): iterable { self::bootKernel(); - - $this->em = self::getContainer()->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); /** @var SocialAction $socialAction */ - $socialAction = $this->em->createQuery( + $socialAction = $em->createQuery( 'SELECT s FROM '.SocialAction::class.' s WHERE SIZE(s.evaluations) >= 2' ) ->setMaxResults(1) ->getSingleResult(); // set the first evaluation as inactive and save - $this->evaluationToReset = $socialAction->getEvaluations()->first(); - $this->evaluationToReset->setActive(false); + self::$evaluationToReset = $socialAction->getEvaluations()->first(); + self::$evaluationToReset->setActive(false); - $this->em->flush(); + $em->flush(); - yield [$socialAction, $this->evaluationToReset]; + self::ensureKernelShutdown(); + + yield [$socialAction, self::$evaluationToReset]; } /** From 0737838dd6cb671630b069f3cd5a256273306c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 26 Mar 2024 22:08:01 +0100 Subject: [PATCH 072/251] Fix layout in admin document generation A layout issue in the admin document generation has been fixed, particularly in the ChillDocGeneratorBundle. Unnecessary elements such as table headers and multiple entity data rows in DocGeneratorTemplate have been removed, simplifying the view page and improving its performance. --- .../unreleased/Fixed-20240326-220740.yaml | 5 +++ .../DocGeneratorTemplate/index.html.twig | 33 ------------------- 2 files changed, 5 insertions(+), 33 deletions(-) create mode 100644 .changes/unreleased/Fixed-20240326-220740.yaml diff --git a/.changes/unreleased/Fixed-20240326-220740.yaml b/.changes/unreleased/Fixed-20240326-220740.yaml new file mode 100644 index 000000000..078631037 --- /dev/null +++ b/.changes/unreleased/Fixed-20240326-220740.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: Fix layout issue in document generation for admin (minor) +time: 2024-03-26T22:07:40.044924041+01:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig b/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig index cfe071986..ee167bcf7 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig @@ -14,11 +14,6 @@ {% block admin_content %} {% embed '@ChillMain/CRUD/_index.html.twig' %} {% block table_entities_thead_tr %} - - {{ 'Title'|trans }} - {{ 'docgen.Context'|trans }} - {{ 'docgen.test generate'|trans }} - {{ 'Edit'|trans }} {% endblock %} {% block table_entities_tbody %} @@ -62,34 +57,6 @@ {% endif %} - - {% for entity in entities %} - - {{ entity.id }} - {{ entity.name|localize_translatable_string}} - {{ contextManager.getContextByKey(entity.context).name|trans }} - -
    - - - - - - -
    - - -
      -
    • - {{ entity.file|chill_document_button_group('Template file', true, {small: true}) }} -
    • -
    • - -
    • -
    - - - {% endfor %} {% endblock %} {% block actions_before %} From ab9d5439c1ced58929d544f74903545ab4d3ca19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 26 Mar 2024 22:08:30 +0100 Subject: [PATCH 073/251] Release 2.18.1 --- .changes/unreleased/Fixed-20240326-220740.yaml | 5 ----- .changes/v2.18.1.md | 3 +++ CHANGELOG.md | 4 ++++ 3 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 .changes/unreleased/Fixed-20240326-220740.yaml create mode 100644 .changes/v2.18.1.md diff --git a/.changes/unreleased/Fixed-20240326-220740.yaml b/.changes/unreleased/Fixed-20240326-220740.yaml deleted file mode 100644 index 078631037..000000000 --- a/.changes/unreleased/Fixed-20240326-220740.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: Fix layout issue in document generation for admin (minor) -time: 2024-03-26T22:07:40.044924041+01:00 -custom: - Issue: "" diff --git a/.changes/v2.18.1.md b/.changes/v2.18.1.md new file mode 100644 index 000000000..f0d68925d --- /dev/null +++ b/.changes/v2.18.1.md @@ -0,0 +1,3 @@ +## v2.18.1 - 2024-03-26 +### Fixed +* Fix layout issue in document generation for admin (minor) diff --git a/CHANGELOG.md b/CHANGELOG.md index a022a870d..8c0a6b008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.18.1 - 2024-03-26 +### Fixed +* Fix layout issue in document generation for admin (minor) + ## v2.18.0 - 2024-03-26 ### Feature * ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation From d6a6cc257235283c00b511dbf2ceb820fe11001c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 3 Apr 2024 17:14:02 +0200 Subject: [PATCH 074/251] Rename `chill.role` tag to `chill_main.provide_role` and optimize role provider The `chill.role` tag has been renamed to `chill_main.provide_role` to prevent any confusion and make the namespaces more consistent. During this process, the class RoleProvidersCompilerPass was deleted, simplifying the role provision process by injecting tagged services directly into the RoleProvider. The change is also reflected in multiple YAML service configurations and explained in the MIGRATION.md file. --- MIGRATION.md | 7 ++++ .../src/config/services/security.yaml | 1 - .../config/services/security.yaml | 1 - .../ChillDocStoreBundle/config/services.yaml | 2 - .../config/services/authorization.yaml | 4 +- .../ChillMainBundle/ChillMainBundle.php | 5 +-- .../RoleProvidersCompilerPass.php | 41 ------------------- .../Security/ProvideRoleInterface.php | 4 +- .../ChillMainBundle/Security/RoleProvider.php | 17 +++----- .../config/services/security.yaml | 2 + .../config/services/security.yaml | 2 - .../config/services/security.yaml | 2 - .../config/services/security.yaml | 1 - 13 files changed, 21 insertions(+), 68 deletions(-) create mode 100644 MIGRATION.md delete mode 100644 src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 000000000..deab7b449 --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,7 @@ + +# Switch to symfony 5.0 + +- the tag `chill.role` is now renamed to `chill_main.provide_role`. + + **Note**: It is not necessary to apply this tag on service definition: the tag is automatically applyied if the + service implements `\Chill\MainBundle\Security\ProvideRoleInterface`. diff --git a/src/Bundle/ChillAsideActivityBundle/src/config/services/security.yaml b/src/Bundle/ChillAsideActivityBundle/src/config/services/security.yaml index eb3327959..05bf9ebd9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/config/services/security.yaml +++ b/src/Bundle/ChillAsideActivityBundle/src/config/services/security.yaml @@ -4,4 +4,3 @@ services: autoconfigure: true tags: - { name: security.voter } - - { name: chill.role } \ No newline at end of file diff --git a/src/Bundle/ChillBudgetBundle/config/services/security.yaml b/src/Bundle/ChillBudgetBundle/config/services/security.yaml index c8f9e5cae..fec4e8f19 100644 --- a/src/Bundle/ChillBudgetBundle/config/services/security.yaml +++ b/src/Bundle/ChillBudgetBundle/config/services/security.yaml @@ -2,5 +2,4 @@ services: Chill\BudgetBundle\Security\Authorization\BudgetElementVoter: autowire: true tags: - - { name: chill.role } - { name: security.voter } diff --git a/src/Bundle/ChillDocStoreBundle/config/services.yaml b/src/Bundle/ChillDocStoreBundle/config/services.yaml index 55163abb3..667114679 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services.yaml @@ -11,8 +11,6 @@ services: Chill\DocStoreBundle\Security\Authorization\: resource: "./../Security/Authorization" - tags: - - { name: chill.role } Chill\DocStoreBundle\Workflow\: resource: './../Workflow/' diff --git a/src/Bundle/ChillEventBundle/config/services/authorization.yaml b/src/Bundle/ChillEventBundle/config/services/authorization.yaml index ca1eb789b..6f382b72e 100644 --- a/src/Bundle/ChillEventBundle/config/services/authorization.yaml +++ b/src/Bundle/ChillEventBundle/config/services/authorization.yaml @@ -6,9 +6,8 @@ services: - "@chill.main.security.authorization.helper" - "@logger" tags: - - { name: chill.role } - { name: security.voter } - + chill_event.event_participation: class: Chill\EventBundle\Security\Authorization\ParticipationVoter arguments: @@ -16,5 +15,4 @@ services: - "@chill.main.security.authorization.helper" - "@logger" tags: - - { name: chill.role } - { name: security.voter } diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index b7cf4e289..2305114f4 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -44,8 +44,6 @@ class ChillMainBundle extends Bundle $container->registerForAutoconfiguration(LocalMenuBuilderInterface::class) ->addTag('chill.menu_builder'); - $container->registerForAutoconfiguration(ProvideRoleInterface::class) - ->addTag('chill.role'); $container->registerForAutoconfiguration(CenterResolverInterface::class) ->addTag('chill_main.center_resolver'); $container->registerForAutoconfiguration(ScopeResolverInterface::class) @@ -64,11 +62,12 @@ class ChillMainBundle extends Bundle ->addTag('chill_main.cron_job'); $container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class) ->addTag('chill_main.entity_info_provider'); + $container->registerForAutoconfiguration(ProvideRoleInterface::class) + ->addTag('chill_main.provide_role'); $container->addCompilerPass(new SearchableServicesCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new ConfigConsistencyCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new TimelineCompilerClass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); - $container->addCompilerPass(new RoleProvidersCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new ExportsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new WidgetsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new NotificationCounterCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php deleted file mode 100644 index c4bbc846d..000000000 --- a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php +++ /dev/null @@ -1,41 +0,0 @@ -hasDefinition('chill.main.role_provider')) { - throw new \LogicException('service chill.main.role_provider is not defined. It is required by RoleProviderCompilerPass'); - } - - $definition = $container->getDefinition( - 'chill.main.role_provider' - ); - - $taggedServices = $container->findTaggedServiceIds( - 'chill.role' - ); - - foreach ($taggedServices as $id => $tagAttributes) { - $definition->addMethodCall( - 'addProvider', - [new Reference($id)] - ); - } - } -} diff --git a/src/Bundle/ChillMainBundle/Security/ProvideRoleInterface.php b/src/Bundle/ChillMainBundle/Security/ProvideRoleInterface.php index 204329f60..d34ea4f33 100644 --- a/src/Bundle/ChillMainBundle/Security/ProvideRoleInterface.php +++ b/src/Bundle/ChillMainBundle/Security/ProvideRoleInterface.php @@ -22,8 +22,10 @@ namespace Chill\MainBundle\Security; * my_role_declaration: * # ... * tags: - * - { name: chill.role } + * - { name: chill_main.provide_role } * + * + * This tag is also automatically added using dependency injection autoconfiguration. */ interface ProvideRoleInterface { diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php index 95e4a666f..073c5bae8 100644 --- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php +++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php @@ -13,10 +13,6 @@ namespace Chill\MainBundle\Security; class RoleProvider { - /** - * @var ProvideRoleInterface[] - */ - private array $providers = []; /** * an array where keys are the role, and value is the title @@ -26,14 +22,13 @@ class RoleProvider */ private ?array $rolesTitlesCache = null; - /** - * Add a role provider. - * - * @internal This function is called by the dependency injector: it inject provider - */ - public function addProvider(ProvideRoleInterface $provider) + public function __construct( + /** + * @var iterable + */ + private iterable $providers + ) { - $this->providers[] = $provider; } public function getRoles(): array diff --git a/src/Bundle/ChillMainBundle/config/services/security.yaml b/src/Bundle/ChillMainBundle/config/services/security.yaml index 38089becf..6c3f1afc6 100644 --- a/src/Bundle/ChillMainBundle/config/services/security.yaml +++ b/src/Bundle/ChillMainBundle/config/services/security.yaml @@ -44,6 +44,8 @@ services: chill.main.role_provider: class: Chill\MainBundle\Security\RoleProvider + arguments: + $providers: !tagged_iterator chill_main.provide_role Chill\MainBundle\Security\RoleProvider: '@chill.main.role_provider' chill.main.user_provider: diff --git a/src/Bundle/ChillPersonBundle/config/services/security.yaml b/src/Bundle/ChillPersonBundle/config/services/security.yaml index 4cdc16e74..f1b907bc6 100644 --- a/src/Bundle/ChillPersonBundle/config/services/security.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/security.yaml @@ -11,14 +11,12 @@ services: class: Chill\PersonBundle\Security\Authorization\PersonVoter tags: - { name: security.voter } - - { name: chill.role } Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter: autowire: true autoconfigure: true tags: - { name: security.voter } - - { name: chill.role } Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter: autowire: true diff --git a/src/Bundle/ChillTaskBundle/config/services/security.yaml b/src/Bundle/ChillTaskBundle/config/services/security.yaml index c1d176637..b7c0c3aa2 100644 --- a/src/Bundle/ChillTaskBundle/config/services/security.yaml +++ b/src/Bundle/ChillTaskBundle/config/services/security.yaml @@ -3,5 +3,3 @@ services: class: Chill\TaskBundle\Security\Authorization\TaskVoter autowire: true autoconfigure: true - tags: - - { name: chill.role } diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/security.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/security.yaml index ccc47fcd2..8e3d9d4d4 100644 --- a/src/Bundle/ChillThirdPartyBundle/config/services/security.yaml +++ b/src/Bundle/ChillThirdPartyBundle/config/services/security.yaml @@ -4,4 +4,3 @@ services: $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' tags: - { name: security.voter } - - { name: chill.role } From 828304d983531c915ddeabe70a8fb0149c1d829e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:12:49 +0200 Subject: [PATCH 075/251] Replace getUsername with getUserIdentifier in activity checks Updated activity checks in ListActivitiesByAccompanyingPeriodContext to use getUserIdentifier method instead of getUsername. This change corresponds to check for both activity users and work referrers. The getUserIdentifier method grants a more reliable way to identify users. --- .../ListActivitiesByAccompanyingPeriodContext.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index 9298983c2..a2fa996a6 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -122,13 +122,13 @@ class ListActivitiesByAccompanyingPeriodContext implements function ($activity) use ($user) { $u = $activity['user']; - if (null !== $u && $u['username'] === $user->getUsername()) { + if (null !== $u && $u['username'] === $user->getUserIdentifier()) { return true; } $activityUsernames = array_map(static fn ($user) => $user['username'], $activity['users'] ?? []); - return \in_array($user->getUsername(), $activityUsernames, true); + return \in_array($user->getUserIdentifier(), $activityUsernames, true); } ) ); @@ -143,9 +143,9 @@ class ListActivitiesByAccompanyingPeriodContext implements array_filter( $works, function ($work) use ($user) { - $workUsernames = array_map(static fn ($user) => $user['username'], $work['referrers'] ?? []); + $workUsernames = array_map(static fn (User $user) => $user['username'], $work['referrers'] ?? []); - return \in_array($user->getUsername(), $workUsernames, true); + return \in_array($user->getUserIdentifier(), $workUsernames, true); } ) ); From 409a5710108a3e951ca4c2105a09e589b29668c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:17:51 +0200 Subject: [PATCH 076/251] fix upgrade in document generation request --- .../Controller/DocGeneratorTemplateController.php | 6 ++---- .../Service/Messenger/RequestGenerationHandler.php | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 1a716f17e..3b2bd5a42 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -46,7 +46,6 @@ final class DocGeneratorTemplateController extends AbstractController public function __construct( private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager, @@ -276,12 +275,11 @@ final class DocGeneratorTemplateController extends AbstractController $sendResultTo = ($form ?? null)?->get('send_result_to')?->getData() ?? null; $dumpOnly = ($form ?? null)?->get('dump_only')?->getData() ?? false; } else { - $creator = $this->security->getUser(); - - if (!$creator instanceof User) { + if (!$this->isGranted('ROLE_USER')) { throw new AccessDeniedHttpException('only authenticated user can request a generation'); } + $creator = $this->security->getUser(); $sendResultTo = null; $dumpOnly = false; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index c20971f27..aba61fb9f 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -11,10 +11,10 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Messenger; -use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository; use Chill\DocGeneratorBundle\Service\Generator\Generator; use Chill\DocGeneratorBundle\Service\Generator\GeneratorException; +use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Exception\StoredObjectManagerException; use Chill\DocStoreBundle\Repository\StoredObjectRepository; @@ -125,7 +125,7 @@ class RequestGenerationHandler implements MessageHandlerInterface { $url = $this->tempUrlGenerator->generate('GET', $destinationStoredObject->getFilename(), 3600); $parts = []; - parse_str(parse_url((string) $url->url)['query'], $parts); + parse_str(parse_url($url->url)['query'], $parts); $validity = \DateTimeImmutable::createFromFormat('U', $parts['temp_url_expires']); $email = (new TemplatedEmail()) From 92800f5dd0cbb05623bd50f574f555da80cc60f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:19:56 +0200 Subject: [PATCH 077/251] fix cs --- .../ChillActivityBundle/Export/Filter/UsersJobFilter.php | 3 +-- src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php | 3 +-- src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php | 3 +-- .../Controller/DocGeneratorTemplateController.php | 2 -- .../ChillDocGeneratorBundle/Service/Generator/Generator.php | 3 +-- .../OnAfterMessageHandledClearStoredObjectCache.php | 3 +-- .../Service/Messenger/OnGenerationFails.php | 3 +-- .../Service/Messenger/RequestGenerationHandler.php | 3 +-- .../Repository/StoredObjectRepositoryInterface.php | 4 +--- src/Bundle/ChillMainBundle/ChillMainBundle.php | 1 - .../ChillMainBundle/Controller/DashboardApiController.php | 3 +-- .../ChillMainBundle/Controller/NewsItemApiController.php | 3 +-- .../ChillMainBundle/Controller/NewsItemHistoryController.php | 3 +-- .../Routing/MenuBuilder/AdminNewsMenuBuilder.php | 4 +--- src/Bundle/ChillMainBundle/Security/RoleProvider.php | 5 +---- ...ccompanyingPeriodWorkWithEvaluationBetweenDatesFilter.php | 3 +-- .../Export/Filter/SocialWorkFilters/JobFilter.php | 3 +-- .../Export/Filter/SocialWorkFilters/ScopeFilter.php | 3 +-- .../Export/Helper/ListAccompanyingPeriodHelper.php | 3 +-- .../ChillPersonBundle/Export/Helper/ListPersonHelper.php | 3 +-- 20 files changed, 18 insertions(+), 43 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index 0987e7ae9..f6d23ea78 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -30,8 +30,7 @@ class UsersJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index b2b5e6a12..5543a453b 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -29,8 +29,7 @@ final readonly class JobFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 179258e41..2f46db892 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -31,8 +31,7 @@ class ScopeFilter implements FilterInterface protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly ScopeRepositoryInterface $scopeRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 3b2bd5a42..08470778a 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -18,7 +18,6 @@ use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository; use Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage; use Chill\DocStoreBundle\Entity\StoredObject; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Security\ChillSecurity; @@ -36,7 +35,6 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 702d7f114..127d135bb 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -34,8 +34,7 @@ class Generator implements GeneratorInterface private readonly ManagerRegistry $objectManagerRegistry, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager - ) { - } + ) {} public function generateDataDump( DocGeneratorTemplate $template, diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnAfterMessageHandledClearStoredObjectCache.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnAfterMessageHandledClearStoredObjectCache.php index a558f5fde..0256f8a8a 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnAfterMessageHandledClearStoredObjectCache.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnAfterMessageHandledClearStoredObjectCache.php @@ -26,8 +26,7 @@ final readonly class OnAfterMessageHandledClearStoredObjectCache implements Even public function __construct( private StoredObjectManagerInterface $storedObjectManager, private LoggerInterface $logger, - ) { - } + ) {} public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php index e1bd20ac8..e3491f339 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php @@ -40,8 +40,7 @@ final readonly class OnGenerationFails implements EventSubscriberInterface private StoredObjectRepositoryInterface $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository - ) { - } + ) {} public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index aba61fb9f..dbd45fde0 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -46,8 +46,7 @@ class RequestGenerationHandler implements MessageHandlerInterface private readonly MailerInterface $mailer, private readonly TempUrlGeneratorInterface $tempUrlGenerator, private readonly TranslatorInterface $translator, - ) { - } + ) {} public function __invoke(RequestGenerationMessage $message) { diff --git a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepositoryInterface.php b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepositoryInterface.php index df2202b4f..c694f1e09 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepositoryInterface.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepositoryInterface.php @@ -17,6 +17,4 @@ use Doctrine\Persistence\ObjectRepository; /** * @extends ObjectRepository */ -interface StoredObjectRepositoryInterface extends ObjectRepository -{ -} +interface StoredObjectRepositoryInterface extends ObjectRepository {} diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index 2305114f4..ff721784a 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -22,7 +22,6 @@ use Chill\MainBundle\DependencyInjection\CompilerPass\ShortMessageCompilerPass; use Chill\MainBundle\DependencyInjection\CompilerPass\TimelineCompilerClass; use Chill\MainBundle\DependencyInjection\CompilerPass\WidgetsCompilerPass; use Chill\MainBundle\DependencyInjection\ConfigConsistencyCompilerPass; -use Chill\MainBundle\DependencyInjection\RoleProvidersCompilerPass; use Chill\MainBundle\Notification\NotificationHandlerInterface; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Search\SearchApiInterface; diff --git a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php index 8a6027ff3..c9b5435ce 100644 --- a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php @@ -20,8 +20,7 @@ final readonly class DashboardApiController { public function __construct( private NewsItemRepository $newsItemRepository, - ) { - } + ) {} /** * Get user dashboard config (not yet based on user id and still hardcoded for now). diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index 786a7e0f1..c4476a041 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -25,8 +25,7 @@ class NewsItemApiController private readonly NewsItemRepository $newsItemRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory - ) { - } + ) {} /** * Get list of news items filtered on start and end date. diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php index cf1f4922b..b79812464 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php @@ -28,8 +28,7 @@ final readonly class NewsItemHistoryController private readonly PaginatorFactory $paginatorFactory, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly Environment $environment, - ) { - } + ) {} /** * @Route("/{_locale}/news-items/history", name="chill_main_news_items_history") diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php index 0ce6a9824..08e72884f 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php @@ -17,9 +17,7 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; class AdminNewsMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly AuthorizationCheckerInterface $authorizationChecker) - { - } + public function __construct(private readonly AuthorizationCheckerInterface $authorizationChecker) {} public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php index 073c5bae8..d17b282f3 100644 --- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php +++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php @@ -13,7 +13,6 @@ namespace Chill\MainBundle\Security; class RoleProvider { - /** * an array where keys are the role, and value is the title * for the given role. @@ -27,9 +26,7 @@ class RoleProvider * @var iterable */ private iterable $providers - ) - { - } + ) {} public function getRoles(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter.php index 439cb47ca..e0c4da1e9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter.php @@ -24,8 +24,7 @@ final readonly class AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter impl { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) { - } + ) {} public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index bb54f288b..25e762a9c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -31,8 +31,7 @@ class JobFilter implements FilterInterface protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository, - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 9a0847cfa..e22c84696 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -31,8 +31,7 @@ class ScopeFilter implements FilterInterface protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly ScopeRepositoryInterface $scopeRepository - ) { - } + ) {} public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index ba14d4e2c..87ed9eec0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -88,8 +88,7 @@ final readonly class ListAccompanyingPeriodHelper private UserHelper $userHelper, private LabelPersonHelper $labelPersonHelper, private CenterRepository $centerRepository - ) { - } + ) {} public function getQueryKeys($data) { diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 2ffc3940f..393d246ea 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -84,8 +84,7 @@ final readonly class ListPersonHelper * @var iterable */ private iterable $customPersonHelpers, - ) { - } + ) {} /** * Those keys are the "direct" keys, which are created when we decide to use to list all the keys. From 553fb271e42948b6fc4b7b9d8dcdafc7fbceaec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:26:42 +0200 Subject: [PATCH 078/251] fix container operations within tests --- .../ListActivitiesByAccompanyingPeriodContextTest.php | 8 ++++---- src/Bundle/ChillMainBundle/Security/RoleProvider.php | 2 +- .../Tests/Controller/NewsItemControllerTest.php | 4 ++-- .../Tests/Controller/NewsItemsHistoryControllerTest.php | 4 ++-- .../Tests/Repository/NewsItemRepositoryTest.php | 2 +- .../WithEvaluationBetweenDatesFilterTest.php | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Tests/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContextTest.php b/src/Bundle/ChillActivityBundle/Tests/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContextTest.php index ff9f30c30..eadb8710c 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContextTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContextTest.php @@ -35,9 +35,9 @@ class ListActivitiesByAccompanyingPeriodContextTest extends KernelTestCase protected function setUp(): void { self::bootKernel(); - $this->listActivitiesByAccompanyingPeriodContext = self::$container->get(ListActivitiesByAccompanyingPeriodContext::class); - $this->accompanyingPeriodRepository = self::$container->get(AccompanyingPeriodRepository::class); - $this->userRepository = self::$container->get(UserRepositoryInterface::class); + $this->listActivitiesByAccompanyingPeriodContext = self::getContainer()->get(ListActivitiesByAccompanyingPeriodContext::class); + $this->accompanyingPeriodRepository = self::getContainer()->get(AccompanyingPeriodRepository::class); + $this->userRepository = self::getContainer()->get(UserRepositoryInterface::class); } /** @@ -101,7 +101,7 @@ class ListActivitiesByAccompanyingPeriodContextTest extends KernelTestCase public static function provideAccompanyingPeriod(): array { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); if (null === $period = $em->createQuery('SELECT a FROM '.AccompanyingPeriod::class.' a') ->setMaxResults(1) diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php index d17b282f3..ff3b8f411 100644 --- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php +++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php @@ -25,7 +25,7 @@ class RoleProvider /** * @var iterable */ - private iterable $providers + private readonly iterable $providers ) {} public function getRoles(): array diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php index 5aa515fd1..3881188e9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php @@ -42,7 +42,7 @@ class NewsItemControllerTest extends WebTestCase public static function tearDownAfterClass(): void { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); foreach (self::$entitiesToDelete as [$class, $id]) { $entity = $em->find($class, $id); @@ -58,7 +58,7 @@ class NewsItemControllerTest extends WebTestCase public static function generateNewsItemIds(): iterable { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $newsItem = new NewsItem(); $newsItem->setTitle('Lorem Ipsum'); diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php index 19da9ac18..d36fca40c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php @@ -33,7 +33,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase public static function tearDownAfterClass(): void { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); foreach (static::$toDelete as [$class, $entity]) { $query = $em->createQuery(sprintf('DELETE FROM %s e WHERE e.id = :id', $class)) @@ -54,7 +54,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase public static function generateNewsItemIds(): iterable { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); $news = new NewsItem(); diff --git a/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php b/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php index 7aab97e48..068a7e6fb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php @@ -35,7 +35,7 @@ class NewsItemRepositoryTest extends KernelTestCase protected function setUp(): void { self::bootKernel(); - $this->entityManager = self::$container->get(EntityManagerInterface::class); + $this->entityManager = self::getContainer()->get(EntityManagerInterface::class); } protected function tearDown(): void diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php index 680eb4cc9..e8d13eb1e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php @@ -30,7 +30,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest { self::bootKernel(); - $this->filter = self::$container->get(AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter::class); + $this->filter = self::getContainer()->get(AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter::class); } public function getFilter() @@ -52,7 +52,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest { self::bootKernel(); - $em = self::$container->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() From a497c3ffcae819c9d5a962948342937793712146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:37:44 +0200 Subject: [PATCH 079/251] fix return type of getFormData --- .../ChillPersonBundle/Tests/Export/Export/ListPersonTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php index 624bbf3cc..9c0eb538c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/ListPersonTest.php @@ -73,7 +73,7 @@ final class ListPersonTest extends AbstractExportTest public static function getFormData(): array { - yield ['address_date' => new \DateTimeImmutable('today')]; + return [['address_date' => new \DateTimeImmutable('today')]]; } public static function getModifiersCombination(): array From 3e676c235e752e4836a4cc414688d1aafe3e4222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:37:56 +0200 Subject: [PATCH 080/251] remove option in phpunit.xml.dist --- phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 869e35d5b..336877a0c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ - + From e5e9ba6d31fd750fbe731aed6f2906cc7c13fb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 22:46:13 +0200 Subject: [PATCH 081/251] make static required method in AbstractExportTests --- .../WithEvaluationBetweenDatesFilterTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php index e8d13eb1e..b2dc7c217 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/WithEvaluationBetweenDatesFilterTest.php @@ -38,7 +38,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public static function getFormData(): array { return [ [ @@ -48,7 +48,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public static function getQueryBuilders() { self::bootKernel(); From 1ee3b9e2f0f23f01e163a70832892f0195cd9c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 23:00:27 +0200 Subject: [PATCH 082/251] Remove the tearDown method, because we are not able to delete entities linked with materialized views --- .../Controller/HouseholdApiControllerTest.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php index 03b5a5576..acc2a09e9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Controller; use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\AddressReference; use Chill\MainBundle\Entity\Center; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Test\PrepareClientTrait; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\HouseholdMember; @@ -33,22 +34,6 @@ final class HouseholdApiControllerTest extends WebTestCase private static array $toDelete = []; - protected function tearDown(): void - { - self::bootKernel(); - - $em = self::getContainer()->get(EntityManagerInterface::class); - - foreach (self::$toDelete as [$class, $id]) { - $obj = $em->getRepository($class)->find($id); - $em->remove($obj); - } - - $em->flush(); - self::$toDelete = []; - self::ensureKernelShutdown(); - } - public static function generateHouseholdAssociatedWithAddressReference() { self::bootKernel(); From 579bd829f86bafae8fb10cbffc92d31e4a3cb86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 23:30:25 +0200 Subject: [PATCH 083/251] Apply rector rules: symfony up to 54 --- rector.php | 9 +- .../Controller/ActivityController.php | 21 +-- .../ActivityReasonCategoryController.php | 18 +- .../Controller/ActivityReasonController.php | 18 +- .../Controller/AdminController.php | 10 +- .../ChillActivityBundle/Entity/Activity.php | 70 +++----- .../Entity/ActivityPresence.php | 6 +- .../Entity/ActivityType.php | 22 +-- .../src/Controller/AdminController.php | 4 +- .../src/Entity/AsideActivity.php | 3 +- .../src/Entity/AsideActivityCategory.php | 4 +- .../Controller/Admin/AdminController.php | 4 +- .../Controller/ChargeController.php | 15 +- .../Controller/ElementController.php | 8 +- .../Controller/ResourceController.php | 18 +- .../Entity/AbstractElement.php | 19 +-- .../ChillBudgetBundle/Entity/ChargeKind.php | 9 +- .../ChillBudgetBundle/Entity/ResourceKind.php | 11 +- .../AzureGrantAdminConsentAndAcquireToken.php | 4 +- .../MapAndSubscribeUserCalendarCommand.php | 5 +- .../SendShortMessageOnEligibleCalendar.php | 2 +- .../SendTestShortMessageOnCalendarCommand.php | 9 +- .../Controller/AdminController.php | 3 +- .../Controller/CalendarAPIController.php | 7 +- .../Controller/CalendarController.php | 26 +-- .../Controller/CalendarDocController.php | 12 +- .../Controller/CalendarRangeAPIController.php | 7 +- .../Controller/InviteApiController.php | 3 +- .../RemoteCalendarConnectAzureController.php | 8 +- .../RemoteCalendarMSGraphSyncController.php | 5 +- .../RemoteCalendarProxyController.php | 4 +- .../ChillCalendarBundle/Entity/Calendar.php | 72 +++----- .../CalendarDoc/CalendarDocCreateDTO.php | 14 +- .../Entity/CalendarDoc/CalendarDocEditDTO.php | 11 +- .../Entity/CalendarRange.php | 27 +-- .../ChillCalendarBundle/Entity/Invite.php | 9 +- .../RemoteCalendar/Model/RemoteEvent.php | 20 +-- .../Command/CreateFieldsOnGroupCommand.php | 4 +- .../Controller/AdminController.php | 4 +- .../Controller/CustomFieldController.php | 12 +- .../CustomFieldsGroupController.php | 21 +-- .../AdminDocGeneratorTemplateController.php | 4 +- .../DocGeneratorTemplateController.php | 27 +-- .../Entity/DocGeneratorTemplate.php | 14 +- .../Normalizer/DocGenObjectNormalizerTest.php | 27 +-- ...ConfigureOpenstackObjectStorageCommand.php | 5 +- .../AsyncUpload/SignedUrl.php | 13 +- .../AsyncUpload/SignedUrlPost.php | 30 +--- .../Controller/AdminController.php | 6 +- .../Controller/AsyncUploadController.php | 5 +- .../DocumentAccompanyingCourseController.php | 20 +-- .../Controller/DocumentCategoryController.php | 25 +-- .../Controller/DocumentPersonController.php | 21 +-- ...ericDocForAccompanyingPeriodController.php | 3 +- .../Controller/GenericDocForPerson.php | 3 +- .../Controller/StoredObjectApiController.php | 4 +- .../ChillDocStoreBundle/Entity/Document.php | 13 +- .../Entity/StoredObject.php | 37 ++--- .../Controller/AdminController.php | 3 +- .../Controller/EventController.php | 22 +-- .../Controller/EventListController.php | 4 +- .../Controller/EventTypeController.php | 21 +-- .../Controller/ParticipationController.php | 22 +-- .../Controller/RoleController.php | 21 +-- .../Controller/StatusController.php | 21 +-- src/Bundle/ChillEventBundle/Entity/Event.php | 9 +- .../ChillEventBundle/Entity/Participation.php | 11 +- .../Command/ChillImportUsersCommand.php | 9 +- .../ChillUserSendRenewPasswordCodeCommand.php | 4 +- .../Command/ExecuteCronJobCommand.php | 7 +- .../LoadAddressesBEFromBestAddressCommand.php | 7 +- .../LoadAddressesFRFromBANOCommand.php | 7 +- .../Command/LoadAndUpdateLanguagesCommand.php | 4 +- .../Command/LoadCountriesCommand.php | 6 +- .../Command/LoadPostalCodeFR.php | 7 +- .../Command/LoadPostalCodesCommand.php | 5 +- .../Command/SetPasswordCommand.php | 8 +- .../SynchronizeEntityInfoViewsCommand.php | 10 +- .../Controller/AbsenceController.php | 16 +- .../Controller/AddressApiController.php | 4 +- .../AddressReferenceAPIController.php | 4 +- .../AddressToReferenceMatcherController.php | 11 +- .../Controller/AdminController.php | 20 +-- .../Controller/DashboardApiController.php | 3 +- .../Controller/DefaultController.php | 8 +- .../Controller/ExportController.php | 23 +-- ...GeographicalUnitByAddressApiController.php | 4 +- .../Controller/LoginController.php | 2 + .../Controller/NewsItemApiController.php | 3 +- .../Controller/NewsItemHistoryController.php | 8 +- .../Controller/NotificationApiController.php | 16 +- .../Controller/NotificationController.php | 28 +--- .../Controller/PasswordController.php | 22 +-- .../Controller/PermissionApiController.php | 3 +- .../Controller/PermissionsGroupController.php | 25 +-- .../Controller/PostalCodeAPIController.php | 4 +- .../Controller/PostalCodeController.php | 5 +- .../Controller/SavedExportController.php | 12 +- .../Controller/ScopeController.php | 12 +- .../Controller/SearchController.php | 16 +- .../Controller/TimelineCenterController.php | 7 +- .../Controller/UserApiController.php | 20 +-- .../Controller/UserController.php | 23 +-- .../Controller/UserExportController.php | 6 +- .../UserJobScopeHistoriesController.php | 4 +- .../Controller/UserProfileController.php | 3 +- .../Controller/WorkflowApiController.php | 14 +- .../Controller/WorkflowController.php | 34 +--- .../DataFixtures/ORM/LoadUsers.php | 3 +- .../Doctrine/Model/TrackCreationTrait.php | 6 +- .../Doctrine/Model/TrackUpdateTrait.php | 6 +- src/Bundle/ChillMainBundle/Entity/Address.php | 54 ++---- .../Entity/AddressReference.php | 33 ++-- src/Bundle/ChillMainBundle/Entity/Center.php | 6 +- .../ChillMainBundle/Entity/Civility.php | 15 +- src/Bundle/ChillMainBundle/Entity/Country.php | 9 +- .../Entity/DashboardConfigItem.php | 18 +- .../SimpleGeographicalUnitDTO.php | 12 +- .../Entity/GeographicalUnitLayer.php | 9 +- .../ChillMainBundle/Entity/Language.php | 6 +- .../ChillMainBundle/Entity/Location.php | 44 ++--- .../ChillMainBundle/Entity/LocationType.php | 32 ++-- .../ChillMainBundle/Entity/NewsItem.php | 33 ++-- .../ChillMainBundle/Entity/Notification.php | 6 +- .../Entity/NotificationComment.php | 3 +- .../ChillMainBundle/Entity/PostalCode.php | 24 +-- .../ChillMainBundle/Entity/SavedExport.php | 6 +- src/Bundle/ChillMainBundle/Entity/Scope.php | 11 +- src/Bundle/ChillMainBundle/Entity/User.php | 5 +- src/Bundle/ChillMainBundle/Entity/UserJob.php | 11 +- .../Entity/Workflow/EntityWorkflow.php | 8 +- .../Entity/Workflow/EntityWorkflowStep.php | 4 +- .../Form/DataMapper/AddressDataMapper.php | 4 +- .../DataMapper/ExportPickCenterDataMapper.php | 4 +- .../DataMapper/PrivateCommentDataMapper.php | 4 +- .../Form/DataMapper/RollingDateDataMapper.php | 4 +- .../Form/DataMapper/ScopePickerDataMapper.php | 4 +- .../ChillMainBundle/Form/UserPasswordType.php | 5 +- .../Search/SearchApiResult.php | 8 +- .../Security/UserProvider/UserProvider.php | 5 +- .../Tests/Controller/UserControllerTest.php | 7 +- .../Command/ChillPersonMoveCommand.php | 5 +- .../Command/ImportSocialWorkMetadata.php | 1 - ...emoveOldDraftAccompanyingPeriodCommand.php | 5 +- .../AccompanyingCourseApiController.php | 16 +- .../AccompanyingCourseCommentController.php | 17 +- .../AccompanyingCourseController.php | 27 +-- .../AccompanyingCourseWorkApiController.php | 4 +- .../AccompanyingCourseWorkController.php | 41 +---- ...CourseWorkEvaluationDocumentController.php | 8 +- .../AccompanyingPeriodController.php | 23 +-- ...mpanyingPeriodRegulationListController.php | 4 +- ...nyingPeriodWorkEvaluationApiController.php | 9 +- .../Controller/AdminController.php | 19 +-- .../Controller/HouseholdApiController.php | 16 +- .../HouseholdCompositionController.php | 12 +- .../Controller/HouseholdController.php | 60 +------ .../Controller/HouseholdMemberController.php | 20 +-- .../Controller/PersonAddressController.php | 20 +-- .../Controller/PersonApiController.php | 23 +-- .../Controller/PersonController.php | 20 +-- .../Controller/PersonDuplicateController.php | 20 +-- .../Controller/PersonResourceController.php | 16 +- .../ReassignAccompanyingPeriodController.php | 4 +- .../ResidentialAddressController.php | 16 +- .../SocialWorkEvaluationApiController.php | 8 +- .../Controller/TimelinePersonController.php | 4 +- .../UserAccompanyingPeriodController.php | 8 +- .../Entity/AccompanyingPeriod.php | 154 ++++++------------ .../AccompanyingPeriodWork.php | 91 +++-------- .../AccompanyingPeriodWorkEvaluation.php | 69 ++------ ...companyingPeriodWorkEvaluationDocument.php | 31 +--- .../AccompanyingPeriodWorkGoal.php | 23 +-- .../AccompanyingPeriod/ClosingMotive.php | 6 +- .../Entity/AccompanyingPeriod/Comment.php | 29 +--- .../Entity/AccompanyingPeriod/Origin.php | 16 +- .../Entity/AccompanyingPeriod/Resource.php | 25 ++- .../AccompanyingPeriodParticipation.php | 25 +-- .../Entity/Household/Household.php | 53 ++---- .../Entity/Household/HouseholdComposition.php | 32 ++-- .../Household/HouseholdCompositionType.php | 11 +- .../Entity/Household/HouseholdMember.php | 47 ++---- .../Entity/Household/Position.php | 20 +-- .../ChillPersonBundle/Entity/Person.php | 63 +++---- .../Entity/Person/PersonResource.php | 34 ++-- .../Entity/Person/PersonResourceKind.php | 6 +- .../Entity/Person/ResidentialAddress.php | 15 +- .../Entity/PersonAltName.php | 6 +- .../Entity/Relationships/Relation.php | 17 +- .../Entity/Relationships/Relationship.php | 35 ++-- .../Entity/SocialWork/Evaluation.php | 20 +-- .../Entity/SocialWork/Goal.php | 14 +- .../Entity/SocialWork/Result.php | 14 +- .../Entity/SocialWork/SocialAction.php | 8 +- .../Entity/SocialWork/SocialIssue.php | 8 +- .../DataMapper/PersonAltNameDataMapper.php | 4 +- .../Controller/SingleTaskController.php | 58 +------ .../Controller/TaskController.php | 6 +- .../ChillTaskBundle/Entity/AbstractTask.php | 32 ++-- .../ChillTaskBundle/Entity/SingleTask.php | 38 ++--- .../Controller/AdminController.php | 3 +- .../Entity/ThirdParty.php | 70 +++----- .../Entity/ThirdPartyCategory.php | 6 +- .../Entity/ThirdPartyProfession.php | 13 +- 204 files changed, 974 insertions(+), 2346 deletions(-) diff --git a/rector.php b/rector.php index 836202495..ec3020ddf 100644 --- a/rector.php +++ b/rector.php @@ -35,10 +35,13 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_82, - \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_50, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_50, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_51, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_52, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_53, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_54, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, - \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, ]); // migrate for phpunit diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 7098f283e..2248c54d3 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -73,9 +73,8 @@ final class ActivityController extends AbstractController /** * Deletes a Activity entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/delete", name="chill_activity_activity_delete", methods={"GET", "POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/delete', name: 'chill_activity_activity_delete', methods: ['GET', 'POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $view = null; @@ -143,9 +142,8 @@ final class ActivityController extends AbstractController /** * Displays a form to edit an existing Activity entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/edit", name="chill_activity_activity_edit", methods={"GET", "POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/edit', name: 'chill_activity_activity_edit', methods: ['GET', 'POST', 'PUT'])] public function editAction(int $id, Request $request): Response { $view = null; @@ -238,9 +236,8 @@ final class ActivityController extends AbstractController /** * Lists all Activity entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/", name="chill_activity_activity_list") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/', name: 'chill_activity_activity_list')] public function listAction(Request $request): Response { $view = null; @@ -344,9 +341,7 @@ final class ActivityController extends AbstractController return $filterBuilder->build(); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/new", name="chill_activity_activity_new", methods={"POST", "GET"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/new', name: 'chill_activity_activity_new', methods: ['POST', 'GET'])] public function newAction(Request $request): Response { $view = null; @@ -527,9 +522,7 @@ final class ActivityController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/select-type", name="chill_activity_activity_select_type") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/select-type', name: 'chill_activity_activity_select_type')] public function selectTypeAction(Request $request): Response { $view = null; @@ -574,9 +567,7 @@ final class ActivityController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/show", name="chill_activity_activity_show") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/show', name: 'chill_activity_activity_show')] public function showAction(Request $request, int $id): Response { $entity = $this->activityRepository->find($id); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 67f65d994..0d337416b 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -26,9 +26,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Creates a new ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/create", name="chill_activity_activityreasoncategory_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/create', name: 'chill_activity_activityreasoncategory_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new ActivityReasonCategory(); @@ -51,9 +50,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Displays a form to edit an existing ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/edit", name="chill_activity_activityreasoncategory_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/edit', name: 'chill_activity_activityreasoncategory_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -74,9 +72,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Lists all ActivityReasonCategory entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/", name="chill_activity_activityreasoncategory") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/', name: 'chill_activity_activityreasoncategory')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -90,9 +87,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Displays a form to create a new ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/new", name="chill_activity_activityreasoncategory_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/new', name: 'chill_activity_activityreasoncategory_new')] public function newAction() { $entity = new ActivityReasonCategory(); @@ -106,9 +102,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Finds and displays a ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/show", name="chill_activity_activityreasoncategory_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/show', name: 'chill_activity_activityreasoncategory_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -126,9 +121,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Edits an existing ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/update", name="chill_activity_activityreasoncategory_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index cb6514656..37d04d367 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -28,9 +28,8 @@ class ActivityReasonController extends AbstractController /** * Creates a new ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/create", name="chill_activity_activityreason_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/create', name: 'chill_activity_activityreason_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new ActivityReason(); @@ -53,9 +52,8 @@ class ActivityReasonController extends AbstractController /** * Displays a form to edit an existing ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/edit", name="chill_activity_activityreason_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/edit', name: 'chill_activity_activityreason_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -76,9 +74,8 @@ class ActivityReasonController extends AbstractController /** * Lists all ActivityReason entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/", name="chill_activity_activityreason") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/', name: 'chill_activity_activityreason')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -92,9 +89,8 @@ class ActivityReasonController extends AbstractController /** * Displays a form to create a new ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/new", name="chill_activity_activityreason_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/new', name: 'chill_activity_activityreason_new')] public function newAction() { $entity = new ActivityReason(); @@ -108,9 +104,8 @@ class ActivityReasonController extends AbstractController /** * Finds and displays a ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/show", name="chill_activity_activityreason_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/show', name: 'chill_activity_activityreason_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -128,9 +123,8 @@ class ActivityReasonController extends AbstractController /** * Edits an existing ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/update", name="chill_activity_activityreason_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminController.php b/src/Bundle/ChillActivityBundle/Controller/AdminController.php index deca96bd7..39438eb8d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminController.php @@ -18,18 +18,14 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; */ class AdminController extends AbstractController { - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity", name="chill_activity_admin_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity', name: 'chill_activity_admin_index')] public function indexActivityAction() { return $this->render('@ChillActivity/Admin/layout_activity.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_aside_activity_redirect_to_admin_index", options={null}) - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_activity_redirect_to_admin_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_aside_activity_redirect_to_admin_index', options: [null])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_activity_redirect_to_admin_index')] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 9407aecbe..ec1ae23e2 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -50,10 +50,6 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\HasLifecycleCallbacks * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "activity": Activity::class - * }) - * * @ActivityValidator\ActivityValidity * * TODO see if necessary @@ -62,6 +58,7 @@ use Symfony\Component\Validator\Constraints as Assert; * getUserFunction="getUser", * path="scope") */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])] class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -74,50 +71,43 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") * - * @Groups({"read", "docgen:read"}) - * - * @SerializedName("activityType") - * * @ORM\JoinColumn(name="type_id") */ + #[Groups(['read', 'docgen:read'])] + #[SerializedName('activityType')] private ActivityType $activityType; /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?ActivityPresence $attendee = null; /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private CommentEmbeddable $comment; /** * @ORM\Column(type="datetime") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private \DateTime $date; /** * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"}) * - * @Assert\Valid(traverse=true) - * * @var Collection */ + #[Assert\Valid(traverse: true)] private Collection $documents; /** @@ -127,9 +117,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private bool $emergency = false; /** @@ -138,16 +127,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?Location $location = null; /** @@ -158,10 +145,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $persons; /** @@ -172,24 +158,21 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") * - * @Groups({"docgen:read"}) - * * @var Collection */ + #[Groups(['docgen:read'])] private Collection $reasons; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?Scope $scope = null; /** * @ORM\Column(type="string", options={"default": ""}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private string $sentReceived = ''; /** @@ -197,10 +180,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $socialActions; /** @@ -208,19 +190,17 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $socialIssues; /** * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $thirdParties; /** @@ -230,18 +210,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?User $user = null; /** * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $users; public function __construct() @@ -385,9 +363,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->documents; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getDurationMinute(): int { if (null === $this->durationTime) { @@ -515,9 +491,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->travelTime; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getTravelTimeMinute(): int { if (null === $this->travelTime) { diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index c181b7c6b..0a558c51b 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -36,18 +36,16 @@ class ActivityPresence * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 96c369b39..404cda36c 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -50,9 +50,8 @@ class ActivityType /** * @ORM\Column(type="boolean") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private bool $active = true; /** @@ -126,9 +125,8 @@ class ActivityType * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?int $id = null; /** @@ -144,10 +142,9 @@ class ActivityType /** * @ORM\Column(type="json") * - * @Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; /** @@ -167,9 +164,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $personsVisible = self::FIELD_OPTIONAL; /** @@ -248,9 +244,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $thirdPartiesVisible = self::FIELD_INVISIBLE; /** @@ -275,9 +270,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $usersVisible = self::FIELD_OPTIONAL; /** @@ -285,9 +279,7 @@ class ActivityType */ private int $userVisible = self::FIELD_REQUIRED; - /** - * @Assert\Callback - */ + #[Assert\Callback] public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php index cbf0ba9ec..08af67639 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php @@ -19,9 +19,7 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/aside-activity", name="chill_aside_activity_admin") - */ + #[Route(path: '/{_locale}/admin/aside-activity', name: 'chill_aside_activity_admin')] public function indexAdminAction() { return $this->render('@ChillAsideActivity/Admin/index.html.twig'); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index f43a0fdfb..02da401bc 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -29,9 +29,8 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private User $agent; /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index be71d73f9..e5eb044d9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -117,9 +117,7 @@ class AsideActivityCategory return null !== $this->parent; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload) { if (!$this->hasParent()) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php index 998775fbe..3bb696757 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php @@ -16,9 +16,7 @@ use Symfony\Component\Routing\Annotation\Route; class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/budget", name="chill_admin_budget") - */ + #[Route(path: '/{_locale}/admin/budget', name: 'chill_admin_budget')] public function indexAdminAction() { return $this->render('@ChillBudget/Admin/index.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php index 39e96d4a8..480e2c645 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php @@ -21,9 +21,8 @@ class ChargeController extends AbstractElementController { /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/delete", name="chill_budget_charge_delete") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/delete', name: 'chill_budget_charge_delete')] public function deleteAction(Request $request, Charge $charge) { return $this->_delete( @@ -36,9 +35,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/edit", name="chill_budget_charge_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/edit', name: 'chill_budget_charge_edit')] public function editAction(Request $request, Charge $charge) { return $this->_edit( @@ -51,9 +49,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-person/{id}/new", name="chill_budget_charge_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-person/{id}/new', name: 'chill_budget_charge_new')] public function newAction(Request $request, Person $person) { return $this->_new( @@ -66,9 +63,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-household/{id}/new", name="chill_budget_charge_household_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-household/{id}/new', name: 'chill_budget_charge_household_new')] public function newHouseholdAction(Request $request, Household $household) { return $this->_new( @@ -81,9 +77,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/view", name="chill_budget_charge_view") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/view', name: 'chill_budget_charge_view')] public function viewAction(Charge $charge) { return $this->_view($charge, '@ChillBudget/Charge/view.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index 26acbf8a5..48f86dedd 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -23,9 +23,7 @@ class ElementController extends AbstractController { public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {} - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-person/{id}', name: 'chill_budget_elements_index')] public function indexAction(Person $person) { $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $person); @@ -47,9 +45,7 @@ class ElementController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-household/{id}", name="chill_budget_elements_household_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-household/{id}', name: 'chill_budget_elements_household_index')] public function indexHouseholdAction(Household $household) { $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php index f67d92a43..fd9dc9f63 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php @@ -20,9 +20,7 @@ use Symfony\Component\HttpFoundation\Response; class ResourceController extends AbstractElementController { - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/delete", name="chill_budget_resource_delete") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/delete', name: 'chill_budget_resource_delete')] public function deleteAction(Request $request, Resource $resource) { return $this->_delete( @@ -33,9 +31,7 @@ class ResourceController extends AbstractElementController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/edit", name="chill_budget_resource_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/edit', name: 'chill_budget_resource_edit')] public function editAction(Request $request, Resource $resource): Response { return $this->_edit( @@ -48,9 +44,8 @@ class ResourceController extends AbstractElementController /** * Create a new budget element for a person. - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-person/{id}/new", name="chill_budget_resource_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-person/{id}/new', name: 'chill_budget_resource_new')] public function newAction(Request $request, Person $person): Response { return $this->_new( @@ -63,9 +58,8 @@ class ResourceController extends AbstractElementController /** * Create new budget element for a household. - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-household/{id}/new", name="chill_budget_resource_household_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-household/{id}/new', name: 'chill_budget_resource_household_new')] public function newHouseholdAction(Request $request, Household $household): Response { return $this->_new( @@ -76,9 +70,7 @@ class ResourceController extends AbstractElementController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/view", name="chill_budget_resource_view") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/view', name: 'chill_budget_resource_view')] public function viewAction(Resource $resource): Response { return $this->_view($resource, '@ChillBudget/Resource/view.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php index 85420e670..e57438f0f 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php +++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php @@ -27,15 +27,9 @@ abstract class AbstractElement { /** * @ORM\Column(name="amount", type="decimal", precision=10, scale=2) - * - * @Assert\GreaterThan( - * value=0 - * ) - * - * @Assert\NotNull( - * message="The amount cannot be empty" - * ) */ + #[Assert\GreaterThan(value: 0)] + #[Assert\NotNull(message: 'The amount cannot be empty')] private string $amount; /** @@ -45,12 +39,8 @@ abstract class AbstractElement /** * @ORM\Column(name="endDate", type="datetime_immutable", nullable=true) - * - * @Assert\GreaterThan( - * propertyPath="startDate", - * message="The budget element's end date must be after the start date" - * ) */ + #[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")] private ?\DateTimeImmutable $endDate = null; /** @@ -69,9 +59,8 @@ abstract class AbstractElement /** * @ORM\Column(name="startDate", type="datetime_immutable") - * - * @Assert\Date */ + #[Assert\Date] private \DateTimeImmutable $startDate; /** diff --git a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php index 2196a0e99..4150d09cc 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php @@ -23,9 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert; * ) * * @ORM\Entity - * - * @UniqueEntity(fields={"kind"}) */ +#[UniqueEntity(fields: ['kind'])] class ChargeKind { /** @@ -44,11 +43,9 @@ class ChargeKind /** * @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false) - * - * @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric") - * - * @Assert\Length(min=3) */ + #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] + #[Assert\Length(min: 3)] private string $kind = ''; /** diff --git a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php index 78e0e6a32..2e0e360d9 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php @@ -22,11 +22,12 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) * }) + * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) + * }) * * @ORM\Entity - * - * @UniqueEntity(fields={"kind"}) */ +#[UniqueEntity(fields: ['kind'])] class ResourceKind { /** @@ -45,11 +46,9 @@ class ResourceKind /** * @ORM\Column(type="string", length=255, nullable=false, options={"default": ""}) - * - * @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric") - * - * @Assert\Length(min=3) */ + #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] + #[Assert\Length(min: 3)] private string $kind = ''; /** diff --git a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php index c9bf020b1..f98ca2418 100644 --- a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php +++ b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php @@ -56,7 +56,7 @@ class AzureGrantAdminConsentAndAcquireToken extends Command $messages = ['No problem, we will wait for you', 'Grant access and come back here']; $output->writeln($formatter->formatBlock($messages, 'warning')); - return 0; + return Command::SUCCESS; } $token = $this->machineTokenStorage->getToken(); @@ -69,6 +69,6 @@ class AzureGrantAdminConsentAndAcquireToken extends Command $output->writeln('Expires at: '.$token->getExpires()); $output->writeln('To inspect the token content, go to https://jwt.ms/#access_token='.urlencode($token->getToken())); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 4964f0064..41830cd44 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -32,6 +32,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class MapAndSubscribeUserCalendarCommand extends Command { + protected static $defaultDescription = 'MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence'; + public function __construct( private readonly EntityManagerInterface $em, private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, @@ -154,7 +156,7 @@ final class MapAndSubscribeUserCalendarCommand extends Command $output->writeln('users synchronized'); - return 0; + return Command::SUCCESS; } protected function configure() @@ -162,7 +164,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command parent::configure(); $this - ->setDescription('MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence') ->addOption( 'renew-before-end-interval', 'r', diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index 6c1b31b9e..7d0426a24 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -34,6 +34,6 @@ class SendShortMessageOnEligibleCalendar extends Command { $this->messageSender->sendBulkMessageToEligibleCalendars(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php index 225b540df..1b76f25fa 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php @@ -39,6 +39,8 @@ use Symfony\Component\Console\Question\Question; class SendTestShortMessageOnCalendarCommand extends Command { + protected static $defaultDescription = 'Test sending a SMS for a dummy calendar appointment'; + public function __construct( private readonly PersonRepository $personRepository, private readonly PhoneNumberUtil $phoneNumberUtil, @@ -50,10 +52,7 @@ class SendTestShortMessageOnCalendarCommand extends Command parent::__construct('chill:calendar:test-send-short-message'); } - protected function configure() - { - $this->setDescription('Test sending a SMS for a dummy calendar appointment'); - } + protected function configure() {} protected function execute(InputInterface $input, OutputInterface $output): int { @@ -174,6 +173,6 @@ class SendTestShortMessageOnCalendarCommand extends Command } } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Controller/AdminController.php b/src/Bundle/ChillCalendarBundle/Controller/AdminController.php index fceddf45a..0ba21c94f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/AdminController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/AdminController.php @@ -18,9 +18,8 @@ class AdminController extends AbstractController { /** * Calendar admin. - * - * @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index") */ + #[Route(path: '/{_locale}/admin/calendar', name: 'chill_calendar_admin_index')] public function indexAdminAction() { return $this->render('@ChillCalendar/Admin/index.html.twig'); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index 1729c215b..eb5812b4d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -25,12 +25,7 @@ class CalendarAPIController extends ApiController { public function __construct(private readonly CalendarRepository $calendarRepository) {} - /** - * @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}", - * name="chill_api_single_calendar_list_by-user", - * requirements={"_format": "json"} - * ) - */ + #[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])] public function listByUser(User $user, Request $request, string $_format): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 0797f2f56..328b8788f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -64,9 +64,8 @@ class CalendarController extends AbstractController /** * Delete a calendar item. - * - * @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete") */ + #[Route(path: '/{_locale}/calendar/{id}/delete', name: 'chill_calendar_calendar_delete')] public function deleteAction(Request $request, Calendar $entity) { $em = $this->managerRegistry->getManager(); @@ -114,9 +113,8 @@ class CalendarController extends AbstractController /** * Edit a calendar item. - * - * @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit") */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/edit', name: 'chill_calendar_calendar_edit')] public function editAction(Calendar $entity, Request $request): Response { $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity); @@ -194,9 +192,8 @@ class CalendarController extends AbstractController /** * Lists all Calendar entities. - * - * @Route("/{_locale}/calendar/calendar/by-period/{id}", name="chill_calendar_calendar_list_by_period") */ + #[Route(path: '/{_locale}/calendar/calendar/by-period/{id}', name: 'chill_calendar_calendar_list_by_period')] public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod); @@ -228,9 +225,8 @@ class CalendarController extends AbstractController /** * Lists all Calendar entities on a person. - * - * @Route("/{_locale}/calendar/calendar/by-person/{id}", name="chill_calendar_calendar_list_by_person") */ + #[Route(path: '/{_locale}/calendar/calendar/by-person/{id}', name: 'chill_calendar_calendar_list_by_person')] public function listActionByPerson(Person $person): Response { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $person); @@ -260,9 +256,7 @@ class CalendarController extends AbstractController ]); } - /** - * @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my") - */ + #[Route(path: '/{_locale}/calendar/calendar/my', name: 'chill_calendar_calendar_list_my')] public function myCalendar(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -284,9 +278,8 @@ class CalendarController extends AbstractController /** * Create a new calendar item. - * - * @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new") */ + #[Route(path: '/{_locale}/calendar/calendar/new', name: 'chill_calendar_calendar_new')] public function newAction(Request $request): Response { if (!$this->remoteCalendarConnector->isReady()) { @@ -385,9 +378,8 @@ class CalendarController extends AbstractController /** * Show a calendar item. - * - * @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show") */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/show', name: 'chill_calendar_calendar_show')] public function showAction(Request $request, int $id): Response { throw new \Exception('not implemented'); @@ -455,9 +447,7 @@ class CalendarController extends AbstractController ]); } - /** - * @Route("/{_locale}/calendar/calendar/{id}/to-activity", name="chill_calendar_calendar_to_activity") - */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/to-activity', name: 'chill_calendar_calendar_to_activity')] public function toActivity(Request $request, Calendar $calendar): RedirectResponse { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index d0f5e623d..3afe0915d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -37,9 +37,7 @@ final readonly class CalendarDocController private UrlGeneratorInterface $urlGenerator, ) {} - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/new', name: 'chill_calendar_calendardoc_new')] public function create(Calendar $calendar, Request $request): Response { $calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar); @@ -96,9 +94,7 @@ final readonly class CalendarDocController ); } - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/delete', name: 'chill_calendar_calendardoc_delete')] public function delete(CalendarDoc $calendarDoc, Request $request): Response { if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) { @@ -156,9 +152,7 @@ final readonly class CalendarDocController ); } - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/edit', name: 'chill_calendar_calendardoc_edit')] public function edit(CalendarDoc $calendarDoc, Request $request): Response { if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) { diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 459d8f6aa..3774f4226 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -25,12 +25,7 @@ class CalendarRangeAPIController extends ApiController { public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {} - /** - * @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}", - * name="chill_api_single_calendar_range_available", - * requirements={"_format": "json"} - * ) - */ + #[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])] public function availableRanges(User $user, Request $request, string $_format): JsonResponse { // return new JsonResponse(['ok' => true], 200, [], false); diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 784a6f6ce..8b0337e14 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -38,9 +38,8 @@ class InviteApiController /** * Give an answer to a calendar invite. - * - * @Route("/api/1.0/calendar/calendar/{id}/answer/{answer}.json", methods={"post"}) */ + #[Route(path: '/api/1.0/calendar/calendar/{id}/answer/{answer}.json', methods: ['post'])] public function answer(Calendar $calendar, string $answer): Response { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index 75b417e93..8790617ed 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -32,9 +32,7 @@ class RemoteCalendarConnectAzureController { public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {} - /** - * @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure") - */ + #[Route(path: '/{_locale}/connect/azure', name: 'chill_calendar_remote_connect_azure')] public function connectAzure(Request $request): Response { $request->getSession()->set('azure_return_path', $request->query->get('returnPath', '/')); @@ -44,9 +42,7 @@ class RemoteCalendarConnectAzureController ->redirect(['https://graph.microsoft.com/.default', 'offline_access'], []); } - /** - * @Route("/connect/azure/check", name="chill_calendar_remote_connect_azure_check") - */ + #[Route(path: '/connect/azure/check', name: 'chill_calendar_remote_connect_azure_check')] public function connectAzureCheck(Request $request): Response { /** @var Azure $client */ diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index e7d423abd..3faefeb00 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -29,10 +29,7 @@ class RemoteCalendarMSGraphSyncController { public function __construct(private readonly MessageBusInterface $messageBus) {} - /** - * @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events", - * methods={"POST"}) - */ + #[Route(path: '/public/incoming-hook/calendar/msgraph/events/{userId}', name: 'chill_calendar_remote_msgraph_incoming_webhook_events', methods: ['POST'])] public function webhookCalendarReceiver(int $userId, Request $request): Response { if ($request->query->has('validationToken')) { diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index 673912c0a..647c6e444 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -36,9 +36,7 @@ class RemoteCalendarProxyController { public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {} - /** - * @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events") - */ + #[Route(path: 'api/1.0/calendar/proxy/calendar/by-user/{id}/events')] public function listEventForCalendar(User $user, Request $request): Response { if (!$request->query->has('dateFrom')) { diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 32308a50c..38a7e29f0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -43,11 +43,8 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; * ) * * @ORM\Entity - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "chill_calendar_calendar": Calendar::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])] class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface { use RemoteCalendarTrait; @@ -91,9 +88,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars") - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** @@ -103,9 +99,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar") - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] private ?CalendarRange $calendarRange = null; /** @@ -115,9 +110,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") - * - * @Serializer\Groups({"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])] private CommentEmbeddable $comment; /** @@ -134,11 +128,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * - * @Assert\NotNull(message="calendar.An end date is required") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.An end date is required')] private ?\DateTimeImmutable $endDate = null; /** @@ -147,9 +139,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] private ?int $id = null; /** @@ -162,30 +153,25 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_invites") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @var Collection&Selectable */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection&Selectable $invites; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\NotNull(message="calendar.A location is required") */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A location is required')] private ?Location $location = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) - * - * @Assert\NotNull(message="calendar.A main user is mandatory") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A main user is mandatory')] private ?User $mainUser = null; /** @@ -200,21 +186,18 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * - * @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.") - * * @var Collection */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')] private Collection $persons; /** * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_") - * - * @Serializer\Groups({"calendar:read"}) */ + #[Serializer\Groups(['calendar:read'])] private PrivateCommentEmbeddable $privateComment; /** @@ -224,17 +207,15 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] private Collection $professionals; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?bool $sendSMS = false; /** @@ -245,28 +226,24 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Column(type="datetime_immutable", nullable=false) * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) - * - * @Assert\NotNull(message="calendar.A start date is required") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A start date is required')] private ?\DateTimeImmutable $startDate = null; /** * @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"}) * - * @Serializer\Groups({"calendar:read", "read", "calendar:light"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])] private string $status = self::STATUS_VALID; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?bool $urgent = false; public function __construct() @@ -394,9 +371,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente return $this->documents; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getDuration(): ?\DateInterval { if (null === $this->getStartDate() || null === $this->getEndDate()) { @@ -541,9 +516,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @return ReadableCollection<(int|string), User> - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] public function getUsers(): ReadableCollection { return $this->getInvites()->map(static fn (Invite $i) => $i->getUser()); diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php index ff4e10402..16c0e9105 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php @@ -16,17 +16,11 @@ use Symfony\Component\Validator\Constraints as Assert; class CalendarDocCreateDTO { - /** - * @Assert\NotNull - * - * @Assert\Valid - */ + #[Assert\NotNull] + #[Assert\Valid] public ?StoredObject $doc = null; - /** - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Assert\NotBlank] + #[Assert\NotNull] public ?string $title = ''; } diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php index 2e8970db6..38276b0f3 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php @@ -17,16 +17,11 @@ use Symfony\Component\Validator\Constraints as Assert; class CalendarDocEditDTO { - /** - * @Assert\Valid - */ + #[Assert\Valid] public ?StoredObject $doc = null; - /** - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Assert\NotBlank] + #[Assert\NotNull] public ?string $title = ''; public function __construct(CalendarDoc $calendarDoc) diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index 0c46db57c..3e2cf1eb0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -44,11 +44,9 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?\DateTimeImmutable $endDate = null; /** @@ -57,38 +55,31 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Location::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?Location $location = null; /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?\DateTimeImmutable $startDate = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php index 48fe865b0..40024c52d 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php @@ -69,25 +69,22 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups(groups={"calendar:read", "read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read'])] private ?int $id = null; /** * @ORM\Column(type="text", nullable=false, options={"default": "pending"}) - * - * @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] private string $status = self::PENDING; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php index 40d1d1435..8da4e74d7 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php @@ -23,26 +23,16 @@ use Symfony\Component\Serializer\Annotation as Serializer; class RemoteEvent { public function __construct( - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $id, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $title, public string $description, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public \DateTimeImmutable $startDate, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public \DateTimeImmutable $endDate, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public bool $isAllDay = false ) {} } diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index de3f0cf5b..24c531860 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -31,6 +31,7 @@ use Symfony\Component\Yaml\Parser; */ class CreateFieldsOnGroupCommand extends Command { + protected static $defaultDescription = 'Create custom fields from a yml file'; final public const ARG_DELETE = 'delete'; final public const ARG_PATH = 'path'; @@ -51,7 +52,6 @@ class CreateFieldsOnGroupCommand extends Command protected function configure() { $this->setName('chill:custom_fields:populate_group') - ->setDescription('Create custom fields from a yml file') ->addArgument( self::ARG_PATH, InputOption::VALUE_REQUIRED, @@ -130,7 +130,7 @@ class CreateFieldsOnGroupCommand extends Command $fields = $this->_addFields($customFieldsGroup, $fieldsInput, $output); - return 0; + return Command::SUCCESS; } private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output) diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php index eda55bb87..525df57ee 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php @@ -21,9 +21,7 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/customfield/", name="customfield_section") - */ + #[Route(path: '/{_locale}/admin/customfield/', name: 'customfield_section')] public function indexAction(): Response { return $this->render('@ChillCustomFields/Admin/layout.html.twig'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index 85b5d9261..39d9821a9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -33,9 +33,8 @@ class CustomFieldController extends AbstractController /** * Creates a new CustomField entity. - * - * @Route("/{_locale}/admin/customfield/new", name="customfield_create") */ + #[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_create')] public function createAction(Request $request) { $entity = new CustomField(); @@ -64,9 +63,8 @@ class CustomFieldController extends AbstractController /** * Displays a form to edit an existing CustomField entity. - * - * @Route("/{_locale}/admin/customfield/edit", name="customfield_edit") */ + #[Route(path: '/{_locale}/admin/customfield/edit', name: 'customfield_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -87,9 +85,8 @@ class CustomFieldController extends AbstractController /** * Displays a form to create a new CustomField entity. - * - * @Route("/{_locale}/admin/customfield/new", name="customfield_new") */ + #[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_new')] public function newAction(Request $request) { $entity = new CustomField(); @@ -118,9 +115,8 @@ class CustomFieldController extends AbstractController /** * Edits an existing CustomField entity. - * - * @Route("/{_locale}/admin/customfield/update", name="customfield_update") */ + #[Route(path: '/{_locale}/admin/customfield/update', name: 'customfield_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 92a13eb0f..5d16269e6 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -44,9 +44,8 @@ class CustomFieldsGroupController extends AbstractController /** * Creates a new CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/create", name="customfieldsgroup_create") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/create', name: 'customfieldsgroup_create')] public function createAction(Request $request) { $entity = new CustomFieldsGroup(); @@ -75,9 +74,8 @@ class CustomFieldsGroupController extends AbstractController /** * Displays a form to edit an existing CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/edit", name="customfieldsgroup_edit") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/edit', name: 'customfieldsgroup_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -98,9 +96,8 @@ class CustomFieldsGroupController extends AbstractController /** * Lists all CustomFieldsGroup entities. - * - * @Route("/{_locale}/admin/customfieldsgroup/", name="customfieldsgroup") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/', name: 'customfieldsgroup')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -125,9 +122,8 @@ class CustomFieldsGroupController extends AbstractController /** * Set the CustomField Group with id $cFGroupId as default. - * - * @Route("/{_locale}/admin/customfieldsgroup/makedefault", name="customfieldsgroup_makedefault") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/makedefault', name: 'customfieldsgroup_makedefault')] public function makeDefaultAction(Request $request) { $form = $this->createMakeDefaultForm(null); @@ -170,9 +166,8 @@ class CustomFieldsGroupController extends AbstractController /** * Displays a form to create a new CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/new", name="customfieldsgroup_new") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/new', name: 'customfieldsgroup_new')] public function newAction() { $entity = new CustomFieldsGroup(); @@ -235,9 +230,8 @@ class CustomFieldsGroupController extends AbstractController /** * Finds and displays a CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup_show") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/show', name: 'customfieldsgroup_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -259,9 +253,8 @@ class CustomFieldsGroupController extends AbstractController /** * Edits an existing CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup_update") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/update', name: 'customfieldsgroup_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index ecb896080..04fa9ce07 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -58,9 +58,7 @@ class AdminDocGeneratorTemplateController extends CRUDController return parent::new($request); } - /** - * @Route("{_locale}/admin/docgen/template/pick-context", name="chill_docgen_admin_template_pick-context") - */ + #[Route(path: '{_locale}/admin/docgen/template/pick-context', name: 'chill_docgen_admin_template_pick-context')] public function pickContext(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 08470778a..dfb70d1c8 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -51,12 +51,7 @@ final class DocGeneratorTemplateController extends AbstractController private readonly ChillSecurity $security ) {} - /** - * @Route( - * "{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}", - * name="chill_docgenerator_test_generate_from_template" - * ) - */ + #[Route(path: '{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_test_generate_from_template')] public function adminTestGenerateDocFromTemplateAction( DocGeneratorTemplate $template, string $entityClassName, @@ -71,12 +66,7 @@ final class DocGeneratorTemplateController extends AbstractController ); } - /** - * @Route( - * "{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}", - * name="chill_docgenerator_generate_from_template" - * ) - */ + #[Route(path: '{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_generate_from_template')] public function generateDocFromTemplateAction( DocGeneratorTemplate $template, string $entityClassName, @@ -91,12 +81,7 @@ final class DocGeneratorTemplateController extends AbstractController ); } - /** - * @Route( - * "/api/1.0/docgen/templates/by-entity/{entityClassName}", - * name="chill_docgenerator_templates_for_entity_api" - * ) - */ + #[Route(path: '/api/1.0/docgen/templates/by-entity/{entityClassName}', name: 'chill_docgenerator_templates_for_entity_api')] public function listTemplateApiAction(string $entityClassName): Response { $nb = $this->docGeneratorTemplateRepository->countByEntity($entityClassName); @@ -116,13 +101,9 @@ final class DocGeneratorTemplateController extends AbstractController } /** - * @Route( - * "{_locale}/admin/doc/gen/generate/test/redirect", - * name="chill_docgenerator_test_generate_redirect" - * ) - * * @return void */ + #[Route(path: '{_locale}/admin/doc/gen/generate/test/redirect', name: 'chill_docgenerator_test_generate_redirect')] public function redirectToTestGenerate(Request $request): RedirectResponse { $template = $request->query->getInt('template'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php index e2524e5ba..857b0f5b5 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php +++ b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php @@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_docgen_template") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "docgen_template": DocGeneratorTemplate::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])] class DocGeneratorTemplate { /** @@ -43,9 +40,8 @@ class DocGeneratorTemplate /** * @ORM\Column(type="text", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $description = null; /** @@ -66,16 +62,14 @@ class DocGeneratorTemplate * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $name = []; /** diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php index 542e44973..ad438ba2b 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php @@ -238,10 +238,9 @@ final class DocGenObjectNormalizerTest extends KernelTestCase class TestableParentClass { /** - * @Serializer\Groups("docgen:read") - * * @Serializer\Context(normalizationContext={"groups": "docgen:read:foo"}, groups={"docgen:read"}) */ + #[Serializer\Groups('docgen:read')] public ?TestableChildClass $child; public function __construct() @@ -252,27 +251,19 @@ class TestableParentClass class TestableChildClass { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public string $baz = 'bloup'; - /** - * @Serializer\Groups("docgen:read:foo") - */ + #[Serializer\Groups('docgen:read:foo')] public string $foo = 'bar'; } class TestableClassWithBool { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public bool $foo; - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public function getThing(): bool { return true; @@ -281,9 +272,7 @@ class TestableClassWithBool class TestableWithIntersectionReadableCollection { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public ReadableCollection&Selectable $collection; public function __construct() @@ -294,9 +283,7 @@ class TestableWithIntersectionReadableCollection class TestableWithCollection { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public Collection&Selectable $collection; public function __construct() diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php index de6690faf..fd1b41481 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php @@ -21,6 +21,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class ConfigureOpenstackObjectStorageCommand extends Command { + protected static $defaultDescription = 'Configure openstack container to store documents'; private readonly string $basePath; private readonly string $tempUrlKey; @@ -37,7 +38,7 @@ class ConfigureOpenstackObjectStorageCommand extends Command protected function configure() { - $this->setDescription('Configure openstack container to store documents') + $this ->setName('chill:doc-store:configure-openstack') ->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token') ->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name') @@ -85,6 +86,6 @@ class ConfigureOpenstackObjectStorageCommand extends Command } } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php index 9003a69ea..aba289652 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php @@ -16,21 +16,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; readonly class SignedUrl { public function __construct( - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $method, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $url, public \DateTimeImmutable $expires, ) {} - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getExpires(): int { return $this->expires->getTimestamp(); diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php index 4a5b4e0fb..9d37771d1 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php @@ -18,35 +18,17 @@ readonly class SignedUrlPost extends SignedUrl public function __construct( string $url, \DateTimeImmutable $expires, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $max_file_size, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $max_file_count, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $submit_delay, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $redirect, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $prefix, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $signature, ) { parent::__construct('POST', $url, $expires); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php index 31c80158e..1ad892891 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php @@ -20,9 +20,8 @@ class AdminController extends AbstractController { /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document", name="chill_docstore_admin", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document', name: 'chill_docstore_admin', options: [null])] public function indexAction() { return $this->render('@ChillDocStore/Admin/layout.html.twig'); @@ -30,9 +29,8 @@ class AdminController extends AbstractController /** * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document_redirect_to_main", name="chill_docstore_admin_redirect_to_admin_index", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document_redirect_to_main', name: 'chill_docstore_admin_redirect_to_admin_index', options: [null])] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php index decfde596..75be20d34 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php @@ -33,10 +33,7 @@ final readonly class AsyncUploadController private LoggerInterface $logger, ) {} - /** - * @Route("/asyncupload/temp_url/generate/{method}", - * name="async_upload.generate_url") - */ + #[Route(path: '/asyncupload/temp_url/generate/{method}', name: 'async_upload.generate_url')] public function getSignedUrl(string $method, Request $request): JsonResponse { try { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index c7f6e1920..a281fc663 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -25,9 +25,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/{_locale}/parcours/{course}/document") - */ +#[Route(path: '/{_locale}/parcours/{course}/document')] class DocumentAccompanyingCourseController extends AbstractController { /** @@ -40,9 +38,7 @@ class DocumentAccompanyingCourseController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete") - */ + #[Route(path: '/{id}/delete', name: 'chill_docstore_accompanying_course_document_delete')] public function delete(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::DELETE, $document); @@ -75,9 +71,7 @@ class DocumentAccompanyingCourseController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="accompanying_course_document_edit", methods="GET|POST") - */ + #[Route(path: '/{id}/edit', name: 'accompanying_course_document_edit', methods: 'GET|POST')] public function edit(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::UPDATE, $document); @@ -116,9 +110,7 @@ class DocumentAccompanyingCourseController extends AbstractController ); } - /** - * @Route("/new", name="accompanying_course_document_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'accompanying_course_document_new', methods: 'GET|POST')] public function new(Request $request, AccompanyingPeriod $course): Response { if (null === $course) { @@ -162,9 +154,7 @@ class DocumentAccompanyingCourseController extends AbstractController ]); } - /** - * @Route("/{id}", name="accompanying_course_document_show", methods="GET") - */ + #[Route(path: '/{id}', name: 'accompanying_course_document_show', methods: 'GET')] public function show(AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE_DETAILS, $document); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php index 7803f24e4..e67ac9751 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php @@ -20,16 +20,12 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/{_locale}/admin/document/category") - */ +#[Route(path: '/{_locale}/admin/document/category')] class DocumentCategoryController extends AbstractController { public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_delete', methods: 'DELETE')] public function delete(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); @@ -47,9 +43,7 @@ class DocumentCategoryController extends AbstractController return $this->redirectToRoute('document_category_index'); } - /** - * @Route("/{bundleId}/{idInsideBundle}/edit", name="document_category_edit", methods="GET|POST") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}/edit', name: 'document_category_edit', methods: 'GET|POST')] public function edit(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); @@ -76,9 +70,8 @@ class DocumentCategoryController extends AbstractController ]); } - /** - * @Route("/", name="document_category_index", methods="GET") - * @Route("/", name="chill_docstore_category_admin", methods="GET") */ + #[Route(path: '/', name: 'document_category_index', methods: 'GET')] + #[Route(path: '/', name: 'chill_docstore_category_admin', methods: 'GET')] public function index(): Response { $em = $this->managerRegistry->getManager(); @@ -92,9 +85,7 @@ class DocumentCategoryController extends AbstractController ); } - /** - * @Route("/new", name="document_category_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'document_category_new', methods: 'GET|POST')] public function new(Request $request): Response { $em = $this->managerRegistry->getManager(); @@ -130,9 +121,7 @@ class DocumentCategoryController extends AbstractController ]); } - /** - * @Route("/{bundleId}/{idInsideBundle}", name="document_category_show", methods="GET") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_show', methods: 'GET')] public function show(mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 3c93acf5c..ad58b6e0c 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Class DocumentPersonController. - * - * @Route("/{_locale}/person/{person}/document") - * - * TODO faire un controller abstrait ? */ +#[Route(path: '/{_locale}/person/{person}/document')] // TODO faire un controller abstrait ? class DocumentPersonController extends AbstractController { /** @@ -46,9 +43,7 @@ class DocumentPersonController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route("/{id}/delete", name="chill_docstore_person_document_delete") - */ + #[Route(path: '/{id}/delete', name: 'chill_docstore_person_document_delete')] public function delete(Request $request, Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted(PersonDocumentVoter::DELETE, $document); @@ -81,9 +76,7 @@ class DocumentPersonController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="person_document_edit", methods="GET|POST") - */ + #[Route(path: '/{id}/edit', name: 'person_document_edit', methods: 'GET|POST')] public function edit(Request $request, Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); @@ -140,9 +133,7 @@ class DocumentPersonController extends AbstractController ); } - /** - * @Route("/new", name="person_document_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'person_document_new', methods: 'GET|POST')] public function new(Request $request, Person $person): Response { if (null === $person) { @@ -188,9 +179,7 @@ class DocumentPersonController extends AbstractController ]); } - /** - * @Route("/{id}", name="person_document_show", methods="GET") - */ + #[Route(path: '/{id}', name: 'person_document_show', methods: 'GET')] public function show(Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php index e615c3b00..f68158552 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php @@ -33,9 +33,8 @@ final readonly class GenericDocForAccompanyingPeriodController /** * @throws \Doctrine\DBAL\Exception - * - * @Route("/{_locale}/doc-store/generic-doc/by-period/{id}/index", name="chill_docstore_generic-doc_by-period_index") */ + #[Route(path: '/{_locale}/doc-store/generic-doc/by-period/{id}/index', name: 'chill_docstore_generic-doc_by-period_index')] public function list(AccompanyingPeriod $accompanyingPeriod): Response { if (!$this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod)) { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php index f6fecae04..c47b2c02a 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php @@ -33,9 +33,8 @@ final readonly class GenericDocForPerson /** * @throws \Doctrine\DBAL\Exception - * - * @Route("/{_locale}/doc-store/generic-doc/by-person/{id}/index", name="chill_docstore_generic-doc_by-person_index") */ + #[Route(path: '/{_locale}/doc-store/generic-doc/by-person/{id}/index', name: 'chill_docstore_generic-doc_by-person_index')] public function list(Person $person): Response { if (!$this->security->isGranted(PersonDocumentVoter::SEE, $person)) { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index 5a4b90474..38856b779 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -22,9 +22,7 @@ class StoredObjectApiController { public function __construct(private readonly Security $security) {} - /** - * @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready") - */ + #[Route(path: '/api/1.0/doc-store/stored-object/{uuid}/is-ready')] public function isDocumentReady(StoredObject $storedObject): Response { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php index a56b6b800..2ffe06122 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php @@ -54,13 +54,9 @@ class Document implements TrackCreationInterface, TrackUpdateInterface * targetEntity="Chill\DocStoreBundle\Entity\StoredObject", * cascade={"persist"} * ) - * - * @Assert\Valid - * - * @Assert\NotNull( - * message="Upload a document" - * ) */ + #[Assert\Valid] + #[Assert\NotNull(message: 'Upload a document')] private ?StoredObject $object = null; /** @@ -70,11 +66,8 @@ class Document implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text") - * - * @Assert\Length( - * min=2, max=250 - * ) */ + #[Assert\Length(min: 2, max: 250)] private string $title = ''; /** diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index 52fc35951..8d3046ac7 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -46,16 +46,14 @@ class StoredObject implements Document, TrackCreationInterface /** * @ORM\Column(type="json", name="datas") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $datas = []; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $filename = ''; /** @@ -64,46 +62,40 @@ class StoredObject implements Document, TrackCreationInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private ?int $id = null; /** * @var int[] * * @ORM\Column(type="json", name="iv") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $iv = []; /** * @ORM\Column(type="json", name="key") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $keyInfos = []; /** * @ORM\Column(type="text", name="title") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $title = ''; /** * @ORM\Column(type="text", name="type", options={"default": ""}) - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $type = ''; /** * @ORM\Column(type="uuid", unique=true) - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private UuidInterface $uuid; /** @@ -135,10 +127,9 @@ class StoredObject implements Document, TrackCreationInterface * @param StoredObject::STATUS_* $status */ public function __construct(/** - * @ORM\Column(type="text", options={"default": "ready"}) - * - * @Serializer\Groups({"read"}) - */ + * @ORM\Column(type="text", options={"default": "ready"}) + */ + #[Serializer\Groups(['read'])] private string $status = 'ready' ) { $this->uuid = Uuid::uuid4(); @@ -152,10 +143,9 @@ class StoredObject implements Document, TrackCreationInterface } /** - * @Serializer\Groups({"read", "write"}) - * * @deprecated */ + #[Serializer\Groups(['read', 'write'])] public function getCreationDate(): \DateTime { if (null === $this->createdAt) { @@ -233,10 +223,9 @@ class StoredObject implements Document, TrackCreationInterface } /** - * @Serializer\Groups({"write"}) - * * @deprecated */ + #[Serializer\Groups(['write'])] public function setCreationDate(\DateTime $creationDate): self { $this->createdAt = \DateTimeImmutable::createFromMutable($creationDate); diff --git a/src/Bundle/ChillEventBundle/Controller/AdminController.php b/src/Bundle/ChillEventBundle/Controller/AdminController.php index 3434df9e5..5e8bd3023 100644 --- a/src/Bundle/ChillEventBundle/Controller/AdminController.php +++ b/src/Bundle/ChillEventBundle/Controller/AdminController.php @@ -22,9 +22,8 @@ class AdminController extends AbstractController { /** * Event admin. - * - * @Route("/{_locale}/admin/event", name="chill_event_admin_index") */ + #[Route(path: '/{_locale}/admin/event', name: 'chill_event_admin_index')] public function indexAdminAction() { return $this->render('@ChillEvent/Admin/index.html.twig'); diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index c652ddecf..72bc8964e 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -60,9 +60,7 @@ final class EventController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'DELETE'])] public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); @@ -113,9 +111,11 @@ final class EventController extends AbstractController * Displays a form to edit an existing Event entity. * * @return \Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')] public function editAction($event_id) { $em = $this->managerRegistry->getManager(); @@ -140,9 +140,11 @@ final class EventController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response * * @throws \Doctrine\ORM\NonUniqueResultException + * @throws \Doctrine\ORM\NonUniqueResultException * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])] public function listByPersonAction($person_id) { $em = $this->managerRegistry->getManager(); @@ -188,9 +190,7 @@ final class EventController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/most_recent", name="chill_event_list_most_recent", options={null}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/most_recent', name: 'chill_event_list_most_recent', options: [null])] public function mostRecentIndexAction() { return $this->redirectToRoute('chill_main_search', [ @@ -202,9 +202,11 @@ final class EventController extends AbstractController * Displays a form to create a new Event entity. * * @return \Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])] public function newAction(?Center $center, Request $request) { $user = $this->security->getUser(); @@ -244,9 +246,8 @@ final class EventController extends AbstractController /** * First step of new Event form. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new/pick-center", name="chill_event__event_new_pickcenter", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])] public function newPickCenterAction() { $role = 'CHILL_EVENT_CREATE'; @@ -294,9 +295,11 @@ final class EventController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response * * @throws \PhpOffice\PhpSpreadsheet\Exception + * @throws \PhpOffice\PhpSpreadsheet\Exception * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')] public function showAction(Event $event, Request $request) { if (!$event) { @@ -326,9 +329,8 @@ final class EventController extends AbstractController /** * Edits an existing Event entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/update", name="chill_event__event_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/update', name: 'chill_event__event_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/EventListController.php b/src/Bundle/ChillEventBundle/Controller/EventListController.php index 60df81240..692611adc 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventListController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventListController.php @@ -42,9 +42,7 @@ final readonly class EventListController private UrlGeneratorInterface $urlGenerator, ) {} - /** - * @Route("{_locale}/event/event/list", name="chill_event_event_list") - */ + #[Route(path: '{_locale}/event/event/list', name: 'chill_event_event_list')] public function __invoke(): Response { $filter = $this->buildFilterOrder(); diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index 11cddbf77..881f7a135 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -26,9 +26,8 @@ class EventTypeController extends AbstractController /** * Creates a new EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/create", name="chill_eventtype_admin_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/create', name: 'chill_eventtype_admin_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new EventType(); @@ -51,9 +50,8 @@ class EventTypeController extends AbstractController /** * Deletes a EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/delete", name="chill_eventtype_admin_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class EventTypeController extends AbstractController /** * Displays a form to edit an existing EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/edit", name="chill_eventtype_admin_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class EventTypeController extends AbstractController /** * Lists all EventType entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/", name="chill_eventtype_admin", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class EventTypeController extends AbstractController /** * Displays a form to create a new EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/new", name="chill_eventtype_admin_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')] public function newAction() { $entity = new EventType(); @@ -133,9 +128,8 @@ class EventTypeController extends AbstractController /** * Finds and displays a EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/show", name="chill_eventtype_admin_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class EventTypeController extends AbstractController /** * Edits an existing EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/update", name="chill_eventtype_admin_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 5d911adf2..7b03f7685 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -44,9 +44,7 @@ final class ParticipationController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/create', name: 'chill_event_participation_create')] public function createAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct @@ -243,9 +241,8 @@ final class ParticipationController extends AbstractController /** * @param int $participation_id - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/delete", name="chill_event_participation_delete", requirements={"participation_id"="\d+"}, methods={"GET", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'], methods: ['GET', 'DELETE'])] public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { $em = $this->managerRegistry->getManager(); @@ -292,9 +289,11 @@ final class ParticipationController extends AbstractController * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found * @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation + * @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/edit", name="chill_event_participation_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')] public function editAction(int $participation_id): Response { /** @var Participation $participation */ @@ -324,9 +323,11 @@ final class ParticipationController extends AbstractController * show a form to edit multiple participation for the same event. * * @param int $event_id + * @param int $event_id * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')] public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse { $event = $this->managerRegistry->getRepository(Event::class) @@ -381,9 +382,8 @@ final class ParticipationController extends AbstractController * This function parse the person_id / persons_ids query argument * and decide if it should process a single or multiple participation. Depending * on this, the appropriate layout and form. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/new", name="chill_event_participation_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/new', name: 'chill_event_participation_new')] public function newAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct @@ -416,9 +416,7 @@ final class ParticipationController extends AbstractController ."'persons_ids' argument in query"); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/update", name="chill_event_participation_update", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/update', name: 'chill_event_participation_update', methods: ['POST'])] public function updateAction(int $participation_id, Request $request): Response { /** @var Participation $participation */ @@ -460,9 +458,7 @@ final class ParticipationController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/update_multiple", name="chill_event_participation_update_multiple", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/update_multiple', name: 'chill_event_participation_update_multiple', methods: ['POST'])] public function updateMultipleAction(mixed $event_id, Request $request) { /** @var Event $event */ diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 7d3e6e0f1..e1d94389a 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -26,9 +26,8 @@ class RoleController extends AbstractController /** * Creates a new Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/create", name="chill_event_admin_role_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/create', name: 'chill_event_admin_role_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new Role(); @@ -51,9 +50,8 @@ class RoleController extends AbstractController /** * Deletes a Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/delete", name="chill_event_admin_role_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class RoleController extends AbstractController /** * Displays a form to edit an existing Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/edit", name="chill_event_admin_role_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class RoleController extends AbstractController /** * Lists all Role entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/", name="chill_event_admin_role", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class RoleController extends AbstractController /** * Displays a form to create a new Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/new", name="chill_event_admin_role_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')] public function newAction() { $entity = new Role(); @@ -133,9 +128,8 @@ class RoleController extends AbstractController /** * Finds and displays a Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/show", name="chill_event_admin_role_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class RoleController extends AbstractController /** * Edits an existing Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/update", name="chill_event_admin_role_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 294ca0222..77f6d4279 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -26,9 +26,8 @@ class StatusController extends AbstractController /** * Creates a new Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/create", name="chill_event_admin_status_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/create', name: 'chill_event_admin_status_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new Status(); @@ -51,9 +50,8 @@ class StatusController extends AbstractController /** * Deletes a Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/delete", name="chill_event_admin_status_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class StatusController extends AbstractController /** * Displays a form to edit an existing Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/edit", name="chill_event_admin_status_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class StatusController extends AbstractController /** * Lists all Status entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/", name="chill_event_admin_status", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class StatusController extends AbstractController /** * Displays a form to create a new Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/new", name="chill_event_admin_status_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')] public function newAction() { $entity = new Status(); @@ -133,9 +128,8 @@ class StatusController extends AbstractController /** * Finds and displays a Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/show", name="chill_event_admin_status_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class StatusController extends AbstractController /** * Edits an existing Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/update", name="chill_event_admin_status_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 486a67c5c..88d4ca3eb 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -45,9 +45,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Center $center = null; /** @@ -76,9 +75,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\Column(type="string", length=150) - * - * @Assert\NotBlank() */ + #[Assert\NotBlank] private ?string $name = null; /** @@ -92,9 +90,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?EventType $type = null; /** diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 9b4664f0d..55751998d 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -34,11 +34,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * * @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"}) * }) + * @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"}) + * }) * * @ORM\HasLifecycleCallbacks - * - * @UniqueEntity({"event", "person"}, message="event.validation.person_already_participate_to_event") */ +#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')] class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface { use TrackCreationTrait; @@ -62,9 +63,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Person $person = null; /** @@ -74,9 +74,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Status $status = null; public function getCenter() diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index 0d6dd0998..c7871a346 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -27,12 +27,12 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; class ChillImportUsersCommand extends Command { + protected static $defaultDescription = 'Import users from csv file'; /** * Centers and aliases. * @@ -55,7 +55,7 @@ class ChillImportUsersCommand extends Command public function __construct( protected EntityManagerInterface $em, protected LoggerInterface $logger, - protected UserPasswordEncoderInterface $passwordEncoder, + protected \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, protected ValidatorInterface $validator, protected UserRepository $userRepository ) { @@ -86,7 +86,6 @@ class ChillImportUsersCommand extends Command protected function configure() { $this - ->setDescription('Import users from csv file') ->setHelp("Import users from a csv file. Users are added to centers contained in the file. Headers are used to detect columns. Adding to multiple centers can be done by using a `grouping centers` file, which will group multiple centers into a signle alias, used in 'centers' column.") ->addArgument('csvfile', InputArgument::REQUIRED, 'Path to the csv file. Columns are: `username`, `email`, `center` (can contain alias), `permission group`') ->addOption('grouping-centers', null, InputOption::VALUE_OPTIONAL, 'Path to a csv file to aggregate multiple centers into a single alias') @@ -130,7 +129,7 @@ class ChillImportUsersCommand extends Command ->setEmail(\trim((string) $data['email'])) ->setUsername(\trim((string) $data['username'])) ->setEnabled(true) - ->setPassword($this->passwordEncoder->encodePassword( + ->setPassword($this->passwordEncoder->hashPassword( $user, \bin2hex(\random_bytes(32)) )); @@ -207,7 +206,7 @@ class ChillImportUsersCommand extends Command throw $e; } - return 0; + return Command::SUCCESS; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index da14d85ff..3e1367a00 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; */ class ChillUserSendRenewPasswordCodeCommand extends Command { + protected static $defaultDescription = 'Send a message with code to recover password'; /** * @var EntityManagerInterface */ @@ -82,7 +83,6 @@ class ChillUserSendRenewPasswordCodeCommand extends Command { $this ->setName('chill:user:send-password-recover-code') - ->setDescription('Send a message with code to recover password') ->addArgument('csvfile', InputArgument::REQUIRED, 'CSV file with the list of users') ->addOption('template', null, InputOption::VALUE_REQUIRED, 'Template for email') ->addOption('expiration', null, InputOption::VALUE_REQUIRED, 'Expiration of the link, as an unix timestamp') @@ -108,7 +108,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command $this->sendRecoverCode($user); } - return 0; + return Command::SUCCESS; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php index ec38fa173..6d998f732 100644 --- a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php @@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface; class ExecuteCronJobCommand extends Command { + protected static $defaultDescription = 'Execute the cronjob(s) given as argument, or one cronjob scheduled by system.'; + public function __construct( private readonly CronManagerInterface $cronManager ) { @@ -28,7 +30,6 @@ class ExecuteCronJobCommand extends Command protected function configure() { $this - ->setDescription('Execute the cronjob(s) given as argument, or one cronjob scheduled by system.') ->setHelp("If no job is specified, the next available cronjob will be executed by system.\nThis command should be execute every 15 minutes (more or less)") ->addArgument('job', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'one or more job to force execute (by default, all jobs are executed)', []) ->addUsage(''); @@ -39,13 +40,13 @@ class ExecuteCronJobCommand extends Command if ([] === $input->getArgument('job')) { $this->cronManager->run(); - return 0; + return Command::SUCCESS; } foreach ($input->getArgument('job') as $jobName) { $this->cronManager->run($jobName); } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php index 710dedb8f..d5dedd169 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesBEFromBestAddressCommand extends Command { + protected static $defaultDescription = 'Import BE addresses from BeST Address (see https://osoc19.github.io/best/)'; + public function __construct( private readonly AddressReferenceBEFromBestAddress $addressImporter, private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter @@ -32,8 +34,7 @@ class LoadAddressesBEFromBestAddressCommand extends Command $this ->setName('chill:main:address-ref-from-best-addresses') ->addArgument('lang', InputArgument::REQUIRED, "Language code, for example 'fr'") - ->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)") - ->setDescription('Import BE addresses from BeST Address (see https://osoc19.github.io/best/)'); + ->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)"); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -42,6 +43,6 @@ class LoadAddressesBEFromBestAddressCommand extends Command $this->addressImporter->import($input->getArgument('lang'), $input->getArgument('list')); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php index 89a159fc4..2bfc3be5c 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php @@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesFRFromBANOCommand extends Command { + protected static $defaultDescription = 'Import FR addresses from bano (see https://bano.openstreetmap.fr'; + public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano) { parent::__construct(); @@ -27,8 +29,7 @@ class LoadAddressesFRFromBANOCommand extends Command protected function configure() { $this->setName('chill:main:address-ref-from-bano') - ->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers') - ->setDescription('Import FR addresses from bano (see https://bano.openstreetmap.fr'); + ->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -39,6 +40,6 @@ class LoadAddressesFRFromBANOCommand extends Command $this->addressReferenceFromBano->import($departementNo); } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index e4b3ae673..376df4e52 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -54,8 +54,6 @@ class LoadAndUpdateLanguagesCommand extends Command { $this ->setName('chill:main:languages:populate') - ->setDescription('Load or update languages in db. This command does not delete existing '. - 'languages, but will update names according to available languages') ->addOption( self::INCLUDE_REGIONAL_VERSION, null, @@ -122,6 +120,6 @@ class LoadAndUpdateLanguagesCommand extends Command $em->flush(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index b6a9be75c..3f7f82523 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -55,9 +55,7 @@ class LoadCountriesCommand extends Command */ protected function configure() { - $this->setName('chill:main:countries:populate') - ->setDescription('Load or update countries in db. This command does not delete existing countries, '. - 'but will update names according to available languages'); + $this->setName('chill:main:countries:populate'); } /** @@ -83,6 +81,6 @@ class LoadCountriesCommand extends Command $em->flush(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php index be29cad9f..eb0bef879 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php @@ -18,6 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadPostalCodeFR extends Command { + protected static $defaultDescription = 'Load France\'s postal code from online open data'; + public function __construct(private readonly PostalCodeFRFromOpenData $loader) { parent::__construct(); @@ -25,14 +27,13 @@ class LoadPostalCodeFR extends Command public function configure(): void { - $this->setName('chill:main:postal-code:load:FR') - ->setDescription('Load France\'s postal code from online open data'); + $this->setName('chill:main:postal-code:load:FR'); } public function execute(InputInterface $input, OutputInterface $output): int { $this->loader->import(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index b22027499..4f0896114 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -25,6 +25,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class LoadPostalCodesCommand extends Command { + protected static $defaultDescription = 'Add the postal code from a csv file.'; + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator) { parent::__construct(); @@ -33,7 +35,6 @@ class LoadPostalCodesCommand extends Command protected function configure() { $this->setName('chill:main:postal-code:populate') - ->setDescription('Add the postal code from a csv file.') ->setHelp('This script will try to avoid existing postal code ' ."using the postal code and name. \n" .'The CSV file must have the following columns: ' @@ -101,7 +102,7 @@ class LoadPostalCodesCommand extends Command $output->writeln(''.$num.' were added !'); - return 0; + return Command::SUCCESS; } private function addPostalCode($row, OutputInterface $output) diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php index a83663ed0..6924b8049 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -18,13 +18,14 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; /** * Class SetPasswordCommand. */ class SetPasswordCommand extends Command { + protected static $defaultDescription = 'set a password to user'; + /** * SetPasswordCommand constructor. */ @@ -42,7 +43,7 @@ class SetPasswordCommand extends Command public function _setPassword(User $user, $password) { - $defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000); + $defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000); $encoders = [ User::class => $defaultEncoder, ]; @@ -56,7 +57,6 @@ class SetPasswordCommand extends Command public function configure() { $this->setName('chill:user:set_password') - ->setDescription('set a password to user') ->addArgument('username', InputArgument::REQUIRED, 'the user\'s ' .'username you want to change password') ->addArgument('password', InputArgument::OPTIONAL, 'the new password'); @@ -80,6 +80,6 @@ class SetPasswordCommand extends Command $this->_setPassword($user, $password); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php b/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php index 71bee0e0e..16a90dbe8 100644 --- a/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php @@ -18,22 +18,20 @@ use Symfony\Component\Console\Output\OutputInterface; class SynchronizeEntityInfoViewsCommand extends Command { + protected static $defaultDescription = 'Update or create sql views which provide info for various entities'; + public function __construct( private readonly ViewEntityInfoManager $viewEntityInfoManager, ) { parent::__construct('chill:db:sync-views'); } - protected function configure(): void - { - $this - ->setDescription('Update or create sql views which provide info for various entities'); - } + protected function configure(): void {} protected function execute(InputInterface $input, OutputInterface $output): int { $this->viewEntityInfoManager->synchronizeOnDB(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php index 23aa9fd10..3961c9f3a 100644 --- a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php +++ b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php @@ -21,13 +21,7 @@ class AbsenceController extends AbstractController { public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route( - * "/{_locale}/absence", - * name="chill_main_user_absence_index", - * methods={"GET", "POST"} - * ) - */ + #[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])] public function setAbsence(Request $request) { $user = $this->security->getUser(); @@ -48,13 +42,7 @@ class AbsenceController extends AbstractController ]); } - /** - * @Route( - * "/{_locale}/absence/unset", - * name="chill_main_user_absence_unset", - * methods={"GET", "POST"} - * ) - */ + #[Route(path: '/{_locale}/absence/unset', name: 'chill_main_user_absence_unset', methods: ['GET', 'POST'])] public function unsetAbsence(Request $request) { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php index 1f7abdb7a..5ea68cdbc 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php @@ -24,10 +24,8 @@ class AddressApiController extends ApiController /** * Duplicate an existing address. - * - * @Route("/api/1.0/main/address/{id}/duplicate.json", name="chill_api_main_address_duplicate", - * methods={"POST"}) */ + #[Route(path: '/api/1.0/main/address/{id}/duplicate.json', name: 'chill_api_main_address_duplicate', methods: ['POST'])] public function duplicate(Address $address): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index b3cf68849..e50cea6bb 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -28,9 +28,7 @@ final class AddressReferenceAPIController extends ApiController { public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {} - /** - * @Route("/api/1.0/main/address-reference/by-postal-code/{id}/search.json") - */ + #[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')] public function search(PostalCode $postalCode, Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index 967ee7b5b..680a63859 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -25,9 +25,7 @@ class AddressToReferenceMatcherController { public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) {} - /** - * @Route("/api/1.0/main/address/reference-match/{id}/set/reviewed", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/set/reviewed', methods: ['POST'])] public function markAddressAsReviewed(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { @@ -48,9 +46,8 @@ class AddressToReferenceMatcherController /** * Set an address back to "to review". Only if the address is in "reviewed" state. - * - * @Route("/api/1.0/main/address/reference-match/{id}/set/to_review", methods={"POST"}) */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/set/to_review', methods: ['POST'])] public function markAddressAsToReview(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { @@ -73,9 +70,7 @@ class AddressToReferenceMatcherController ); } - /** - * @Route("/api/1.0/main/address/reference-match/{id}/sync-with-reference", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/sync-with-reference', methods: ['POST'])] public function syncAddressWithReference(Address $address): JsonResponse { if (null === $address->getAddressReference()) { diff --git a/src/Bundle/ChillMainBundle/Controller/AdminController.php b/src/Bundle/ChillMainBundle/Controller/AdminController.php index 46fbfb351..abdfb679d 100644 --- a/src/Bundle/ChillMainBundle/Controller/AdminController.php +++ b/src/Bundle/ChillMainBundle/Controller/AdminController.php @@ -16,41 +16,31 @@ use Symfony\Component\Routing\Annotation\Route; class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin", name="chill_main_admin_central") - */ + #[Route(path: '/{_locale}/admin', name: 'chill_main_admin_central')] public function indexAction() { return $this->render('@ChillMain/Admin/index.html.twig'); } - /** - * @Route("/{_locale}/admin/language", name="chill_main_language_admin") - */ + #[Route(path: '/{_locale}/admin/language', name: 'chill_main_language_admin')] public function indexLanguageAction() { return $this->render('@ChillMain/Admin/indexLanguage.html.twig'); } - /** - * @Route("/{_locale}/admin/location", name="chill_main_location_admin") - */ + #[Route(path: '/{_locale}/admin/location', name: 'chill_main_location_admin')] public function indexLocationAction() { return $this->render('@ChillMain/Admin/indexLocation.html.twig'); } - /** - * @Route("/{_locale}/admin/user", name="chill_main_user_admin") - */ + #[Route(path: '/{_locale}/admin/user', name: 'chill_main_user_admin')] public function indexUserAction() { return $this->render('@ChillMain/Admin/indexUser.html.twig'); } - /** - * @Route("/{_locale}/admin/dashboard", name="chill_main_dashboard_admin") - */ + #[Route(path: '/{_locale}/admin/dashboard', name: 'chill_main_dashboard_admin')] public function indexDashboardAction() { return $this->render('@ChillMain/Admin/indexDashboard.html.twig'); diff --git a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php index c9b5435ce..ffc23da81 100644 --- a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php @@ -24,9 +24,8 @@ final readonly class DashboardApiController /** * Get user dashboard config (not yet based on user id and still hardcoded for now). - * - * @Route("/api/1.0/main/dashboard-config-item.json", methods={"get"}) */ + #[Route(path: '/api/1.0/main/dashboard-config-item.json', methods: ['get'])] public function getDashboardConfiguration(): JsonResponse { $data = []; diff --git a/src/Bundle/ChillMainBundle/Controller/DefaultController.php b/src/Bundle/ChillMainBundle/Controller/DefaultController.php index 389c89767..389ed7764 100644 --- a/src/Bundle/ChillMainBundle/Controller/DefaultController.php +++ b/src/Bundle/ChillMainBundle/Controller/DefaultController.php @@ -18,9 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; */ class DefaultController extends AbstractController { - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/homepage", name="chill_main_homepage") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/homepage', name: 'chill_main_homepage')] public function indexAction() { if ($this->isGranted('ROLE_ADMIN')) { @@ -30,9 +28,7 @@ class DefaultController extends AbstractController return $this->render('@ChillMain/layout.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/homepage", name="chill_main_homepage_without_locale") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/homepage', name: 'chill_main_homepage_without_locale')] public function indexWithoutLocaleAction() { return $this->redirectToRoute('chill_main_homepage'); diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 2df7008d6..709d3ceb9 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -65,9 +65,7 @@ class ExportController extends AbstractController $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"}) - */ + #[Route(path: '/{_locale}/exports/download/{alias}', name: 'chill_main_export_download', methods: ['GET'])] public function downloadResultAction(Request $request, mixed $alias) { /** @var ExportManager $exportManager */ @@ -109,9 +107,11 @@ class ExportController extends AbstractController * @param string $alias * * @return Response + * @return Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"}) */ + #[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])] public function generateAction(Request $request, $alias) { /** @var ExportManager $exportManager */ @@ -130,10 +130,9 @@ class ExportController extends AbstractController } /** - * @Route("/{_locale}/exports/generate-from-saved/{id}", name="chill_main_export_generate_from_saved") - * * @throws \RedisException */ + #[Route(path: '/{_locale}/exports/generate-from-saved/{id}', name: 'chill_main_export_generate_from_saved')] public function generateFromSavedExport(SavedExport $savedExport): RedirectResponse { $this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport); @@ -154,9 +153,8 @@ class ExportController extends AbstractController /** * Render the list of available exports. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/", name="chill_main_export_index") */ + #[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')] public function indexAction(): Response { $exportManager = $this->exportManager; @@ -179,9 +177,8 @@ class ExportController extends AbstractController * stored in the session (if valid), and then a redirection is done to next step. * 3. 'generate': gather data from session from the previous steps, and * make a redirection to the "generate" action with data in query (HTTP GET) - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/new/{alias}", name="chill_main_export_new") */ + #[Route(path: '/{_locale}/exports/new/{alias}', name: 'chill_main_export_new')] public function newAction(Request $request, string $alias): Response { // first check for ACL @@ -205,9 +202,7 @@ class ExportController extends AbstractController }; } - /** - * @Route("/{_locale}/export/saved/update-from-key/{id}/{key}", name="chill_main_export_saved_edit_options_from_key") - */ + #[Route(path: '/{_locale}/export/saved/update-from-key/{id}/{key}', name: 'chill_main_export_saved_edit_options_from_key')] public function editSavedExportOptionsFromKey(SavedExport $savedExport, string $key): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -227,9 +222,7 @@ class ExportController extends AbstractController return $this->redirectToRoute('chill_main_export_saved_edit', ['id' => $savedExport->getId()]); } - /** - * @Route("/{_locale}/export/save-from-key/{alias}/{key}", name="chill_main_export_save_from_key") - */ + #[Route(path: '/{_locale}/export/save-from-key/{alias}/{key}', name: 'chill_main_export_save_from_key')] public function saveFromKey(string $alias, string $key, Request $request): Response { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index 24253de36..7574eea1e 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -26,9 +26,7 @@ class GeographicalUnitByAddressApiController { public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {} - /** - * @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"}) - */ + #[Route(path: '/api/1.0/main/geographical-unit/by-address/{id}.{_format}', requirements: ['_format' => 'json'])] public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillMainBundle/Controller/LoginController.php b/src/Bundle/ChillMainBundle/Controller/LoginController.php index df295d0b2..a23d9ff08 100644 --- a/src/Bundle/ChillMainBundle/Controller/LoginController.php +++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php @@ -35,9 +35,11 @@ class LoginController extends AbstractController * Show a login form. * * @return Response + * @return Response * * @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')] public function loginAction(Request $request) { return $this->render('@ChillMain/Login/login.html.twig', [ diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index c4476a041..c687acc2f 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -29,9 +29,8 @@ class NewsItemApiController /** * Get list of news items filtered on start and end date. - * - * @Route("/api/1.0/main/news/current.json", methods={"get"}) */ + #[Route(path: '/api/1.0/main/news/current.json', methods: ['get'])] public function listCurrentNewsItems(): JsonResponse { $total = $this->newsItemRepository->countCurrentNews(); diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php index b79812464..78b7077ee 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php @@ -30,9 +30,7 @@ final readonly class NewsItemHistoryController private readonly Environment $environment, ) {} - /** - * @Route("/{_locale}/news-items/history", name="chill_main_news_items_history") - */ + #[Route(path: '/{_locale}/news-items/history', name: 'chill_main_news_items_history')] public function list(): Response { $filter = $this->buildFilterOrder(); @@ -48,9 +46,7 @@ final readonly class NewsItemHistoryController ])); } - /** - * @Route("/{_locale}/news-items/{id}", name="chill_main_single_news_item") - */ + #[Route(path: '/{_locale}/news-items/{id}', name: 'chill_main_single_news_item')] public function showSingleItem(NewsItem $newsItem, Request $request): Response { return new Response($this->environment->render( diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 16599b9a2..2fb7969cf 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -26,32 +26,24 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Security; use Symfony\Component\Serializer\SerializerInterface; -/** - * @Route("/api/1.0/main/notification") - */ +#[Route(path: '/api/1.0/main/notification')] class NotificationApiController { public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {} - /** - * @Route("/{id}/mark/read", name="chill_api_main_notification_mark_read", methods={"POST"}) - */ + #[Route(path: '/{id}/mark/read', name: 'chill_api_main_notification_mark_read', methods: ['POST'])] public function markAsRead(Notification $notification): JsonResponse { return $this->markAs('read', $notification); } - /** - * @Route("/{id}/mark/unread", name="chill_api_main_notification_mark_unread", methods={"POST"}) - */ + #[Route(path: '/{id}/mark/unread', name: 'chill_api_main_notification_mark_unread', methods: ['POST'])] public function markAsUnread(Notification $notification): JsonResponse { return $this->markAs('unread', $notification); } - /** - * @Route("/my/unread") - */ + #[Route(path: '/my/unread')] public function myUnreadNotifications(Request $request): JsonResponse { $total = $this->notificationRepository->countUnreadByUser($this->security->getUser()); diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index ea79317bf..162c099ef 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -35,16 +35,12 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -/** - * @Route("/{_locale}/notification") - */ +#[Route(path: '/{_locale}/notification')] class NotificationController extends AbstractController { public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/create", name="chill_main_notification_create") - */ + #[Route(path: '/create', name: 'chill_main_notification_create')] public function createAction(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -102,9 +98,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/edit", name="chill_main_notification_edit") - */ + #[Route(path: '/{id}/edit', name: 'chill_main_notification_edit')] public function editAction(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_UPDATE, $notification); @@ -132,9 +126,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/access_key", name="chill_main_notification_grant_access_by_access_key") - */ + #[Route(path: '/{id}/access_key', name: 'chill_main_notification_grant_access_by_access_key')] public function getAccessByAccessKey(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -174,9 +166,7 @@ class NotificationController extends AbstractController return $this->redirectToRoute('chill_main_notification_show', ['id' => $notification->getId()]); } - /** - * @Route("/inbox", name="chill_main_notification_my") - */ + #[Route(path: '/inbox', name: 'chill_main_notification_my')] public function inboxAction(): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -200,9 +190,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/sent", name="chill_main_notification_sent") - */ + #[Route(path: '/sent', name: 'chill_main_notification_sent')] public function sentAction(): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -226,9 +214,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/show", name="chill_main_notification_show") - */ + #[Route(path: '/{id}/show', name: 'chill_main_notification_show')] public function showAction(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_SEE, $notification); diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index e65c70672..efd6c9630 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -27,7 +27,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -40,21 +39,18 @@ final class PasswordController extends AbstractController /** * PasswordController constructor. */ - public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} + public function __construct(private readonly LoggerInterface $chillLogger, private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @return Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed") */ + #[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')] public function changeConfirmedAction() { return $this->render('@ChillMain/Password/recover_password_changed.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover") - */ + #[Route(path: '/public/{_locale}/password/recover', name: 'password_recover')] public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { @@ -96,7 +92,7 @@ final class PasswordController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $password = $form->get('new_password')->getData(); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); // logging for prod $this ->chillLogger @@ -120,9 +116,11 @@ final class PasswordController extends AbstractController /** * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException + * @throws \Doctrine\ORM\NonUniqueResultException * * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover") */ + #[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')] public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { @@ -193,9 +191,8 @@ final class PasswordController extends AbstractController /** * @return Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm") */ + #[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')] public function requestRecoverConfirmAction() { return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig'); @@ -203,9 +200,8 @@ final class PasswordController extends AbstractController /** * @return Response - * - * @Route("/{_locale}/my/password", name="change_my_password") */ + #[Route(path: '/{_locale}/my/password', name: 'change_my_password')] public function UserPasswordAction(Request $request) { if (!$this->security->isGranted('ROLE_USER')) { @@ -234,7 +230,7 @@ final class PasswordController extends AbstractController ] ); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); $em = $this->managerRegistry->getManager(); $em->flush(); diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 8b0561635..2abb7333f 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -24,10 +24,9 @@ class PermissionApiController extends AbstractController public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) {} /** - * @Route("/api/1.0/main/permissions/info.json", methods={"POST"}) - * * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface */ + #[Route(path: '/api/1.0/main/permissions/info.json', methods: ['POST'])] public function getPermissions(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 52ef9bfbb..62cc7a724 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -49,9 +49,7 @@ final class PermissionsGroupController extends AbstractController private readonly RoleScopeRepository $roleScopeRepository, ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope', name: 'admin_permissionsgroup_add_role_scope', methods: ['PUT'])] public function addLinkRoleScopeAction(Request $request, int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -129,9 +127,8 @@ final class PermissionsGroupController extends AbstractController /** * Creates a new PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/create", name="admin_permissionsgroup_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/create', name: 'admin_permissionsgroup_create', methods: ['POST'])] public function createAction(Request $request): Response { $permissionsGroup = new PermissionsGroup(); @@ -153,9 +150,8 @@ final class PermissionsGroupController extends AbstractController /** * remove an association between permissionsGroup and roleScope. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}", name="admin_permissionsgroup_delete_role_scope", methods={"DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['DELETE'])] public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response { $permissionsGroup = $this->permissionsGroupRepository->find($pgid); @@ -211,9 +207,8 @@ final class PermissionsGroupController extends AbstractController /** * Displays a form to edit an existing PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/edit", name="admin_permissionsgroup_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/edit', name: 'admin_permissionsgroup_edit')] public function editAction(int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -259,9 +254,8 @@ final class PermissionsGroupController extends AbstractController /** * Lists all PermissionsGroup entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/", name="admin_permissionsgroup") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/', name: 'admin_permissionsgroup')] public function indexAction(): Response { $entities = $this->permissionsGroupRepository->findAllOrderedAlphabetically(); @@ -273,9 +267,8 @@ final class PermissionsGroupController extends AbstractController /** * Displays a form to create a new PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/new", name="admin_permissionsgroup_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/new', name: 'admin_permissionsgroup_new')] public function newAction(): Response { $permissionsGroup = new PermissionsGroup(); @@ -289,9 +282,8 @@ final class PermissionsGroupController extends AbstractController /** * Finds and displays a PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/show", name="admin_permissionsgroup_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/show', name: 'admin_permissionsgroup_show')] public function showAction(int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -342,9 +334,8 @@ final class PermissionsGroupController extends AbstractController /** * Edits an existing PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/update", name="admin_permissionsgroup_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/update', name: 'admin_permissionsgroup_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, int $id): Response { $permissionsGroup = $this->permissionsGroupRepository diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index 2b897130d..cd13ad455 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -28,9 +28,7 @@ final class PostalCodeAPIController extends ApiController { public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {} - /** - * @Route("/api/1.0/main/postal-code/search.json") - */ + #[Route(path: '/api/1.0/main/postal-code/search.json')] public function search(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php index b7ea48328..edd8efda8 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php @@ -35,12 +35,9 @@ class PostalCodeController extends AbstractController } /** - * @Route( - * "{_locale}/postalcode/search" - * ) - * * @return JsonResponse */ + #[Route(path: '{_locale}/postalcode/search')] public function searchAction(Request $request) { $pattern = $request->query->getAlnum('q', ''); diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 15bfcb9bb..82d41a9e1 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -36,9 +36,7 @@ class SavedExportController { public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) {} - /** - * @Route("/{_locale}/exports/saved/{id}/delete", name="chill_main_export_saved_delete") - */ + #[Route(path: '/{_locale}/exports/saved/{id}/delete', name: 'chill_main_export_saved_delete')] public function delete(SavedExport $savedExport, Request $request): Response { if (!$this->security->isGranted(SavedExportVoter::DELETE, $savedExport)) { @@ -71,9 +69,7 @@ class SavedExportController ); } - /** - * @Route("/{_locale}/exports/saved/{id}/edit", name="chill_main_export_saved_edit") - */ + #[Route(path: '/{_locale}/exports/saved/{id}/edit', name: 'chill_main_export_saved_edit')] public function edit(SavedExport $savedExport, Request $request): Response { if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) { @@ -104,9 +100,7 @@ class SavedExportController ); } - /** - * @Route("/{_locale}/exports/saved/my", name="chill_main_export_saved_list_my") - */ + #[Route(path: '/{_locale}/exports/saved/my', name: 'chill_main_export_saved_list_my')] public function list(): Response { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillMainBundle/Controller/ScopeController.php b/src/Bundle/ChillMainBundle/Controller/ScopeController.php index e6bcdce86..5e932063a 100644 --- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php +++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php @@ -32,9 +32,8 @@ class ScopeController extends AbstractController /** * Creates a new Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/create", name="admin_scope_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/create', name: 'admin_scope_create', methods: ['POST'])] public function createAction(Request $request) { $scope = new Scope(); @@ -57,9 +56,8 @@ class ScopeController extends AbstractController /** * Displays a form to edit an existing Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/edit", name="admin_scope_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/{id}/edit', name: 'admin_scope_edit')] public function editAction(Scope $scope, Request $request): Response { $editForm = $this->createEditForm($scope); @@ -79,9 +77,8 @@ class ScopeController extends AbstractController /** * Lists all Scope entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/", name="admin_scope") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/', name: 'admin_scope')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -95,9 +92,8 @@ class ScopeController extends AbstractController /** * Displays a form to create a new Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/new", name="admin_scope_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/new', name: 'admin_scope_new')] public function newAction() { $scope = new Scope(); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 78dd5eaba..90fa6e1b5 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -34,9 +34,7 @@ class SearchController extends AbstractController { public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced/{name}', name: 'chill_main_advanced_search')] public function advancedSearchAction(mixed $name, Request $request) { try { @@ -81,9 +79,7 @@ class SearchController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced", name="chill_main_advanced_search_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced', name: 'chill_main_advanced_search_list')] public function advancedSearchListAction(Request $request) { /** @var Chill\MainBundle\Search\SearchProvider $variable */ @@ -100,9 +96,7 @@ class SearchController extends AbstractController return $this->render('@ChillMain/Search/choose_list.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search.{_format}', name: 'chill_main_search', requirements: ['_format' => 'html|json'], defaults: ['_format' => 'html'])] public function searchAction(Request $request, mixed $_format) { $pattern = trim((string) $request->query->get('q', '')); @@ -192,9 +186,7 @@ class SearchController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/api/1.0/search.{_format}', name: 'chill_main_search_global', requirements: ['_format' => 'json'], defaults: ['_format' => 'json'])] public function searchApi(Request $request, mixed $_format): JsonResponse { // TODO this is an incomplete implementation diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index ebbd7a360..97507739e 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -22,12 +22,7 @@ class TimelineCenterController extends AbstractController { public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) {} - /** - * @Route("/{_locale}/center/timeline", - * name="chill_center_timeline", - * methods={"GET"} - * ) - */ + #[Route(path: '/{_locale}/center/timeline', name: 'chill_center_timeline', methods: ['GET'])] public function centerAction(Request $request) { // collect reachable center for each group diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php index ae764c9d2..262bfdfde 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -24,15 +24,7 @@ class UserApiController extends ApiController { public function __construct(private readonly ChillSecurity $security) {} - /** - * @Route( - * "/api/1.0/main/user-current-location.{_format}", - * name="chill_main_user_current_location", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])] public function currentLocation(mixed $_format): JsonResponse { if (!$this->isGranted('ROLE_USER')) { @@ -47,15 +39,7 @@ class UserApiController extends ApiController ); } - /** - * @Route( - * "/api/1.0/main/whoami.{_format}", - * name="chill_main_user_whoami", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[Route(path: '/api/1.0/main/whoami.{_format}', name: 'chill_main_user_whoami', requirements: ['_format' => 'json'])] public function whoami(mixed $_format): JsonResponse { return $this->json( diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 81f39b084..cc1666494 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -31,7 +31,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -42,7 +41,7 @@ class UserController extends CRUDController public function __construct( private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, - private readonly UserPasswordEncoderInterface $passwordEncoder, + private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator, @@ -50,10 +49,7 @@ class UserController extends CRUDController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", - * name="admin_user_add_groupcenter") - */ + #[Route(path: '/{_locale}/admin/main/user/{uid}/add_link_groupcenter', name: 'admin_user_add_groupcenter')] public function addLinkGroupCenterAction(Request $request, mixed $uid): Response { $em = $this->managerRegistry->getManager(); @@ -102,10 +98,7 @@ class UserController extends CRUDController ]); } - /** - * @Route("/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}", - * name="admin_user_delete_groupcenter") - */ + #[Route(path: '/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}', name: 'admin_user_delete_groupcenter')] public function deleteLinkGroupCenterAction(mixed $uid, mixed $gcid, Request $request): RedirectResponse { $em = $this->managerRegistry->getManager(); @@ -202,9 +195,8 @@ class UserController extends CRUDController /** * Displays a form to edit the user current location. - * - * @Route("/{_locale}/main/user/current-location/edit", name="chill_main_user_currentlocation_edit") */ + #[Route(path: '/{_locale}/main/user/current-location/edit', name: 'chill_main_user_currentlocation_edit')] public function editCurrentLocationAction(Request $request) { $user = $this->security->getUser(); @@ -234,9 +226,8 @@ class UserController extends CRUDController /** * Displays a form to edit the user password. - * - * @Route("/{_locale}/admin/user/{id}/edit_password", name="admin_user_edit_password") */ + #[Route(path: '/{_locale}/admin/user/{id}/edit_password', name: 'admin_user_edit_password')] public function editPasswordAction(User $user, Request $request) { $editForm = $this->createEditPasswordForm($user); @@ -251,7 +242,7 @@ class UserController extends CRUDController 'user' => $user->getUsername(), ]); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); $this->managerRegistry->getManager()->flush(); $this->addFlash('success', $this->translator->trans('Password successfully updated!')); @@ -360,7 +351,7 @@ class UserController extends CRUDController // for "new", encode the password if ('new' === $action && $this->parameterBag->get('chill_main.access_user_change_password')) { $entity->setPassword($this->passwordEncoder - ->encodePassword($entity, $form['plainPassword']->getData())); + ->hashPassword($entity, $form['plainPassword']->getData())); } // default behaviour diff --git a/src/Bundle/ChillMainBundle/Controller/UserExportController.php b/src/Bundle/ChillMainBundle/Controller/UserExportController.php index 7f14b5e64..64b89a6f5 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserExportController.php @@ -33,9 +33,8 @@ final readonly class UserExportController * @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\Exception * @throws \League\Csv\UnavailableStream - * - * @Route("/{_locale}/admin/main/users/export/list.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_list") */ + #[Route(path: '/{_locale}/admin/main/users/export/list.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_list')] public function userList(Request $request, string $_format = 'csv'): StreamedResponse { if (!$this->security->isGranted('ROLE_ADMIN')) { @@ -94,9 +93,8 @@ final readonly class UserExportController * @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\Exception * @throws \League\Csv\UnavailableStream - * - * @Route("/{_locale}/admin/main/users/export/permissions.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_permissions") */ + #[Route(path: '/{_locale}/admin/main/users/export/permissions.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_permissions')] public function userPermissionsList(string $_format = 'csv'): StreamedResponse { if (!$this->security->isGranted('ROLE_ADMIN')) { diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php index 55d7aceb7..1bbf5c0c1 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -23,9 +23,7 @@ class UserJobScopeHistoriesController extends AbstractController private readonly Environment $engine, ) {} - /** - * @Route("/{_locale}/admin/main/user/{id}/job-scope-history", name="admin_user_job_scope_history") - */ + #[Route(path: '/{_locale}/admin/main/user/{id}/job-scope-history', name: 'admin_user_job_scope_history')] public function indexAction(User $user): Response { $jobHistories = $user->getUserJobHistoriesOrdered(); diff --git a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php index ecdde78a5..a48d1a1e2 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -32,9 +32,8 @@ final class UserProfileController extends AbstractController /** * User profile that allows editing of phonenumber and visualization of certain data. - * - * @Route("/{_locale}/main/user/my-profile", name="chill_main_user_profile") */ + #[Route(path: '/{_locale}/main/user/my-profile', name: 'chill_main_user_profile')] public function __invoke(Request $request) { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index 4c4d8218c..28dca8016 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -33,9 +33,8 @@ class WorkflowApiController /** * Return a list of workflow which are waiting an action for the user. - * - * @Route("/api/1.0/main/workflow/my", methods={"GET"}) */ + #[Route(path: '/api/1.0/main/workflow/my', methods: ['GET'])] public function myWorkflow(Request $request): JsonResponse { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { @@ -72,9 +71,8 @@ class WorkflowApiController /** * Return a list of workflow which are waiting an action for the user. - * - * @Route("/api/1.0/main/workflow/my-cc", methods={"GET"}) */ + #[Route(path: '/api/1.0/main/workflow/my-cc', methods: ['GET'])] public function myWorkflowCc(Request $request): JsonResponse { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { @@ -109,17 +107,13 @@ class WorkflowApiController ); } - /** - * @Route("/api/1.0/main/workflow/{id}/subscribe", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/workflow/{id}/subscribe', methods: ['POST'])] public function subscribe(EntityWorkflow $entityWorkflow, Request $request): Response { return $this->handleSubscription($entityWorkflow, $request, 'subscribe'); } - /** - * @Route("/api/1.0/main/workflow/{id}/unsubscribe", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/workflow/{id}/unsubscribe', methods: ['POST'])] public function unsubscribe(EntityWorkflow $entityWorkflow, Request $request): Response { return $this->handleSubscription($entityWorkflow, $request, 'unsubscribe'); diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index b19f03c3b..d75e42012 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -40,9 +40,7 @@ class WorkflowController extends AbstractController { public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") - */ + #[Route(path: '/{_locale}/main/workflow/create', name: 'chill_main_workflow_create')] public function create(Request $request): Response { if (!$request->query->has('entityClass')) { @@ -86,9 +84,7 @@ class WorkflowController extends AbstractController return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); } - /** - * @Route("/{_locale}/main/workflow/{id}/delete", name="chill_main_workflow_delete") - */ + #[Route(path: '/{_locale}/main/workflow/{id}/delete', name: 'chill_main_workflow_delete')] public function delete(EntityWorkflow $entityWorkflow, Request $request): Response { $this->denyAccessUnlessGranted(EntityWorkflowVoter::DELETE, $entityWorkflow); @@ -113,9 +109,7 @@ class WorkflowController extends AbstractController ]); } - /** - * @Route("/{_locale}/main/workflow-step/{id}/access_key", name="chill_main_workflow_grant_access_by_key") - */ + #[Route(path: '/{_locale}/main/workflow-step/{id}/access_key', name: 'chill_main_workflow_grant_access_by_key')] public function getAccessByAccessKey(EntityWorkflowStep $entityWorkflowStep, Request $request): Response { if (null === $accessKey = $request->query->get('accessKey', null)) { @@ -143,9 +137,8 @@ class WorkflowController extends AbstractController /** * Previous workflows where the user has applyed a transition. - * - * @Route("/{_locale}/main/workflow/list/previous_transitionned", name="chill_main_workflow_list_previous_transitionned") */ + #[Route(path: '/{_locale}/main/workflow/list/previous_transitionned', name: 'chill_main_workflow_list_previous_transitionned')] public function myPreviousWorkflowsTransitionned(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -173,9 +166,8 @@ class WorkflowController extends AbstractController /** * Previous workflows where the user was mentioned, but did not give any reaction. - * - * @Route("/{_locale}/main/workflow/list/previous_without_reaction", name="chill_main_workflow_list_previous_without_reaction") */ + #[Route(path: '/{_locale}/main/workflow/list/previous_without_reaction', name: 'chill_main_workflow_list_previous_without_reaction')] public function myPreviousWorkflowsWithoutReaction(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -201,9 +193,7 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/cc", name="chill_main_workflow_list_cc") - */ + #[Route(path: '/{_locale}/main/workflow/list/cc', name: 'chill_main_workflow_list_cc')] public function myWorkflowsCc(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -228,9 +218,7 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest") - */ + #[Route(path: '/{_locale}/main/workflow/list/dest', name: 'chill_main_workflow_list_dest')] public function myWorkflowsDest(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -255,9 +243,7 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/subscribed", name="chill_main_workflow_list_subscribed") - */ + #[Route(path: '/{_locale}/main/workflow/list/subscribed', name: 'chill_main_workflow_list_subscribed')] public function myWorkflowsSubscribed(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -282,9 +268,7 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/{id}/show", name="chill_main_workflow_show") - */ + #[Route(path: '/{_locale}/main/workflow/{id}/show', name: 'chill_main_workflow_show')] public function show(EntityWorkflow $entityWorkflow, Request $request): Response { $this->denyAccessUnlessGranted(EntityWorkflowVoter::SEE, $entityWorkflow); diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index 8cb335fba..1c99a3a74 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -18,7 +18,6 @@ use Doctrine\Persistence\ObjectManager; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; /** * Load fixtures users into database. @@ -65,7 +64,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde foreach (self::$refs as $username => $params) { $user = new User(); - $defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000); + $defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000); $encoderFactory = new EncoderFactory([ User::class => $defaultEncoder, diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php index 29f1c2f43..71c8dc504 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php @@ -20,18 +20,16 @@ trait TrackCreationTrait { /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $createdBy = null; public function getCreatedAt(): ?\DateTimeInterface diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php index 8a3f98972..c48a287d6 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php @@ -20,18 +20,16 @@ trait TrackUpdateTrait { /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $updatedBy = null; public function getUpdatedAt(): ?\DateTimeInterface diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index f6584fddd..b98f27b1a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -57,60 +57,52 @@ class Address implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\ManyToOne(targetEntity=AddressReference::class) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?AddressReference $addressReference = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $buildingName = ''; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private bool $confidential = false; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $corridor = ''; /** * used for the CEDEX information. * * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $distribution = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $extra = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $flat = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $floor = ''; /** @@ -140,19 +132,17 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @ORM\GeneratedValue(strategy="AUTO") * - * @Groups({"write"}) - * * @readonly */ + #[Groups(['write'])] private ?int $id = null; /** * True if the address is a "no address", aka homeless person, ... * - * @Groups({"write"}) - * * @ORM\Column(type="boolean", options={"default": false}) */ + #[Groups(['write'])] private bool $isNoAddress = false; /** @@ -160,28 +150,25 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @Groups({"write"}) - * * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") */ + #[Groups(['write'])] private ?ThirdParty $linkedToThirdParty = null; /** * A geospatial field storing the coordinates of the Address. * * @ORM\Column(type="point", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?Point $point = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?PostalCode $postcode = null; /** @@ -198,23 +185,20 @@ class Address implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $steps = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $street = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $streetNumber = ''; /** @@ -222,9 +206,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * of address. By default, the current date. * * @ORM\Column(type="date") - * - * @Groups({"write"}) */ + #[Groups(['write'])] private \DateTime $validFrom; /** @@ -232,9 +215,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * of address. * * @ORM\Column(type="date", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?\DateTime $validTo = null; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index 49b510f8c..84c8aa2b6 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -42,16 +42,14 @@ class AddressReference /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $deletedAt = null; /** @@ -60,67 +58,58 @@ class AddressReference * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $municipalityCode = ''; /** * A geospatial field storing the coordinates of the Address. * * @ORM\Column(type="point") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?Point $point = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?PostalCode $postcode = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $refId = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $source = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $street = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $streetNumber = ''; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $updatedAt = null; public function getCreatedAt(): ?\DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php index b81200bdb..20c8e3767 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -39,16 +39,14 @@ class Center implements HasCenterInterface, \Stringable * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="string", length=255) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private string $name = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 322155fe5..fa1accae8 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -18,25 +18,22 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Table(name="chill_main_civility") * * @ORM\Entity - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={"chill_main_civility": Civility::class}) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_civility' => Civility::class])] class Civility { /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $abbreviation = []; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** @@ -45,18 +42,16 @@ class Civility * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index 91484ba46..7ed4dc576 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -31,10 +31,9 @@ class Country /** * @ORM\Column(type="string", length=3) * - * @groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private string $countryCode = ''; /** @@ -43,9 +42,8 @@ class Country * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -53,10 +51,9 @@ class Country * * @ORM\Column(type="json") * - * @groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; public function getCountryCode(): string diff --git a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php index ed9cc07bf..03662b5ff 100644 --- a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php +++ b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php @@ -28,27 +28,22 @@ class DashboardConfigItem * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] private ?int $id = null; /** * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] private string $type = ''; /** * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] private string $position = ''; /** @@ -58,9 +53,8 @@ class DashboardConfigItem /** * @ORM\Column(type="json", options={"default": "[]", "jsonb": true}) - * - * @Serializer\Groups({"dashboardConfigItem:read"}) */ + #[Serializer\Groups(['dashboardConfigItem:read'])] private array $metadata = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index 79e28e6f3..196b5140a 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -25,33 +25,29 @@ class SimpleGeographicalUnitDTO * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public int $id, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public string $unitName, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public string $unitRefId, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public int $layerId ) {} } diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php index c875fecd4..7129de879 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php @@ -32,23 +32,20 @@ class GeographicalUnitLayer * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="json", nullable=false, options={"default": "[]"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $name = []; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $refId = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Language.php b/src/Bundle/ChillMainBundle/Entity/Language.php index 1a91de7b8..b6e42d7d8 100644 --- a/src/Bundle/ChillMainBundle/Entity/Language.php +++ b/src/Bundle/ChillMainBundle/Entity/Language.php @@ -31,9 +31,8 @@ class Language * @ORM\Id * * @ORM\Column(type="string") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?string $id = null; /** @@ -41,10 +40,9 @@ class Language * * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php index 29a049d35..92a2b43b7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Location.php +++ b/src/Bundle/ChillMainBundle/Entity/Location.php @@ -24,55 +24,46 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; * @ORM\Table(name="chill_main_location") * * @ORM\Entity(repositoryClass=LocationRepository::class) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "location": Location::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['location' => Location::class])] class Location implements TrackCreationInterface, TrackUpdateInterface { /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** * @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"}) * * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?Address $address = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $availableForUsers = false; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $createdBy = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?string $email = null; /** @@ -81,57 +72,50 @@ class Location implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=LocationType::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?LocationType $locationType = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?string $name = null; /** * @ORM\Column(type="phone_number", nullable=true) * - * @Serializer\Groups({"read", "write", "docgen:read"}) - * * @PhonenumberConstraint(type="any") */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?PhoneNumber $phonenumber1 = null; /** * @ORM\Column(type="phone_number", nullable=true) * - * @Serializer\Groups({"read", "write", "docgen:read"}) - * * @PhonenumberConstraint(type="any") */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?PhoneNumber $phonenumber2 = null; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $updatedBy = null; public function getActive(): ?bool diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index c6a176ab6..54e876d2d 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -21,13 +21,9 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; * @ORM\Table(name="chill_main_location_type") * * @ORM\Entity(repositoryClass=LocationTypeRepository::class) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "location-type": LocationType::class - * }) - * - * @UniqueEntity({"defaultFor"}) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['location-type' => LocationType::class])] +#[UniqueEntity(['defaultFor'])] class LocationType { final public const DEFAULT_FOR_3PARTY = 'thirdparty'; @@ -42,44 +38,38 @@ class LocationType /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $addressRequired = self::STATUS_OPTIONAL; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $availableForUsers = true; /** * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $contactData = self::STATUS_OPTIONAL; /** * @ORM\Column(type="string", nullable=true, length=32, unique=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $defaultFor = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $editableByUsers = true; /** @@ -88,18 +78,16 @@ class LocationType * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillMainBundle/Entity/NewsItem.php b/src/Bundle/ChillMainBundle/Entity/NewsItem.php index 604c58c5f..1aa2d83a1 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -36,49 +36,38 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $title = ''; /** * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $content = ''; /** * @ORM\Column(type="date_immutable", nullable=false) - * - * @Assert\NotNull - * - * @Groups({"read"}) */ + #[Assert\NotNull] + #[Groups(['read'])] private ?\DateTimeImmutable $startDate = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate") - * - * @Groups({"read"}) */ + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate')] + #[Groups(['read'])] private ?\DateTimeImmutable $endDate = null; public function getTitle(): string diff --git a/src/Bundle/ChillMainBundle/Entity/Notification.php b/src/Bundle/ChillMainBundle/Entity/Notification.php index 8604b5ee1..52dd6aba1 100644 --- a/src/Bundle/ChillMainBundle/Entity/Notification.php +++ b/src/Bundle/ChillMainBundle/Entity/Notification.php @@ -116,9 +116,8 @@ class Notification implements TrackUpdateInterface /** * @ORM\Column(type="text", options={"default": ""}) - * - * @Assert\NotBlank(message="notification.Title must be defined") */ + #[Assert\NotBlank(message: 'notification.Title must be defined')] private string $title = ''; /** @@ -187,10 +186,9 @@ class Notification implements TrackUpdateInterface } /** - * @Assert\Callback - * * @param array $payload */ + #[Assert\Callback] public function assertCountAddresses(ExecutionContextInterface $context, $payload): void { if (0 === (\count($this->getAddressesEmails()) + \count($this->getAddressees()))) { diff --git a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php index 49d1e859d..3e23a7ceb 100644 --- a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php +++ b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php @@ -29,9 +29,8 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac { /** * @ORM\Column(type="text") - * - * @Assert\NotBlank(message="notification.Comment content might not be blank") */ + #[Assert\NotBlank(message: 'notification.Comment content might not be blank')] private string $content = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 4d906d6c8..fee552c6b 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -56,23 +56,20 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface /** * @ORM\Column(type="point", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?Point $center = null; /** * @ORM\Column(type="string", length=100) - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?string $code = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?Country $country = null; /** @@ -86,37 +83,32 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?int $id = null; /** * @ORM\Column(type="string", length=255, name="label") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?string $name = null; /** * @ORM\Column(name="origin", type="integer", nullable=true) - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private int $origin = 0; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?string $postalCodeSource = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?string $refPostalCodeId = null; public function getCenter(): ?Point diff --git a/src/Bundle/ChillMainBundle/Entity/SavedExport.php b/src/Bundle/ChillMainBundle/Entity/SavedExport.php index 224423783..b9b27c39b 100644 --- a/src/Bundle/ChillMainBundle/Entity/SavedExport.php +++ b/src/Bundle/ChillMainBundle/Entity/SavedExport.php @@ -33,9 +33,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private string $description = ''; /** @@ -59,9 +58,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private string $title = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Scope.php b/src/Bundle/ChillMainBundle/Entity/Scope.php index 464d60488..4a21c66d7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Scope.php +++ b/src/Bundle/ChillMainBundle/Entity/Scope.php @@ -24,11 +24,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Table(name="scopes") * * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "scope": Scope::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['scope' => Scope::class])] class Scope { /** @@ -42,9 +39,8 @@ class Scope * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -52,10 +48,9 @@ class Scope * * @ORM\Column(type="json") * - * @Groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 4ea96bb2d..b9af72fd0 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -33,11 +33,8 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; * @ORM\Table(name="users") * * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "user": User::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])] class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface { /** diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php index 6be1a5efe..d071d2adc 100644 --- a/src/Bundle/ChillMainBundle/Entity/UserJob.php +++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php @@ -18,11 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table("chill_main_user_job") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "user_job": UserJob::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user_job' => UserJob::class])] class UserJob { /** @@ -36,9 +33,8 @@ class UserJob * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] protected ?int $id = null; /** @@ -46,10 +42,9 @@ class UserJob * * @ORM\Column(name="label", type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] protected array $label = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index e26547428..6e2824b88 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -29,11 +29,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Table("chill_main_workflow_entity") * * @EntityWorkflowCreation(groups={"creation"}) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "entity_workflow": EntityWorkflow::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['entity_workflow' => EntityWorkflow::class])] class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -100,10 +97,9 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface * * @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"}) * - * @Assert\Valid(traverse=true) - * * @var Collection */ + #[Assert\Valid(traverse: true)] private Collection $steps; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 53e4ad945..509390fac 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -413,9 +413,7 @@ class EntityWorkflowStep return $this; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validateOnCreation(ExecutionContextInterface $context, mixed $payload): void { return; diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php index 8db31c0b1..a4cab4a9b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php @@ -28,7 +28,7 @@ class AddressDataMapper implements DataMapperInterface * @param Address $address * @param \Iterator $forms */ - public function mapDataToForms($address, iterable $forms) + public function mapDataToForms($address, \Traversable $forms) { if (null === $address) { return; @@ -78,7 +78,7 @@ class AddressDataMapper implements DataMapperInterface * @param \Iterator $forms * @param Address $address */ - public function mapFormsToData(iterable $forms, &$address) + public function mapFormsToData(\Traversable $forms, &$address) { if (!$address instanceof Address) { $address = new Address(); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php index 495c5d221..2a19c8e0b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface; final readonly class ExportPickCenterDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, iterable $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { if (null === $viewData) { return; @@ -31,7 +31,7 @@ final readonly class ExportPickCenterDataMapper implements DataMapperInterface // NOTE: we do not map back the regroupments } - public function mapFormsToData(iterable $forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { /** @var array $forms */ $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 4f6022afe..3f1284db8 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -21,7 +21,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI { public function __construct(private readonly Security $security) {} - public function mapDataToForms($viewData, iterable $forms) + public function mapDataToForms($viewData, \Traversable $forms) { if (null === $viewData) { return null; @@ -36,7 +36,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI $forms['comments']->setData($viewData->getCommentForUser($this->security->getUser())); } - public function mapFormsToData(iterable $forms, &$viewData) + public function mapFormsToData(\Traversable $forms, &$viewData) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php index 99dd4b053..254860e64 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception; class RollingDateDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, iterable $forms) + public function mapDataToForms($viewData, \Traversable $forms) { if (null === $viewData) { return; @@ -33,7 +33,7 @@ class RollingDateDataMapper implements DataMapperInterface $forms['fixedDate']->setData($viewData->getFixedDate()); } - public function mapFormsToData(iterable $forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index ef040d16b..d6a0cea20 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -18,7 +18,7 @@ class ScopePickerDataMapper implements DataMapperInterface { public function __construct(private readonly ?Scope $scope = null) {} - public function mapDataToForms($data, iterable $forms) + public function mapDataToForms($data, \Traversable $forms) { $forms = iterator_to_array($forms); @@ -37,7 +37,7 @@ class ScopePickerDataMapper implements DataMapperInterface } } - public function mapFormsToData(iterable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php index 8a5dc01fd..b3ae403a3 100644 --- a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php +++ b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php @@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; @@ -32,12 +31,12 @@ class UserPasswordType extends AbstractType protected $chillLogger; /** - * @var UserPasswordEncoderInterface + * @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface */ protected $passwordEncoder; public function __construct( - UserPasswordEncoderInterface $passwordEncoder, + \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, LoggerInterface $chillLogger ) { $this->passwordEncoder = $passwordEncoder; diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index 14f448746..9d6a0f948 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -19,17 +19,13 @@ class SearchApiResult public function __construct(private readonly float $relevance) {} - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getRelevance(): float { return $this->relevance; } - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getResult() { return $this->result; diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index c624c6a99..a561fe0bc 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\NoResultException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; @@ -36,7 +35,7 @@ class UserProvider implements UserProviderInterface ->setParameter('pattern', $username) ->getSingleResult(); } catch (NoResultException $e) { - throw new UsernameNotFoundException('Bad credentials.', 0, $e); + throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException('Bad credentials.', 0, $e); } return $user; @@ -51,7 +50,7 @@ class UserProvider implements UserProviderInterface $reloadedUser = $this->em->getRepository(User::class)->find($user->getId()); if (null === $reloadedUser) { - throw new UsernameNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId())); + throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId())); } return $reloadedUser; diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php index 4108566ad..8699aded5 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Test\PrepareClientTrait; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; /** * @internal @@ -34,7 +33,7 @@ final class UserControllerTest extends WebTestCase $user = new User(); $user->setUsername('Test_user '.uniqid()); - $user->setPassword(self::getContainer()->get(UserPasswordEncoderInterface::class)->encodePassword( + $user->setPassword(self::getContainer()->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class)->encodePassword( $user, 'password' )); @@ -138,9 +137,9 @@ final class UserControllerTest extends WebTestCase protected function isPasswordValid($username, $password) { - /** @var \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder */ + /** @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher $passwordEncoder */ $passwordEncoder = self::getContainer() - ->get(UserPasswordEncoderInterface::class); + ->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class); $user = self::getContainer()->get(UserRepositoryInterface::class) ->findOneBy(['username' => $username]); diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index fd86aefbf..6472a48f5 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -23,6 +23,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class ChillPersonMoveCommand extends Command { + protected static $defaultDescription = 'Move all the associated entities on a "from" person to a "to" person and remove the old person'; + public function __construct( private readonly PersonMove $mover, private readonly EntityManagerInterface $em, @@ -53,7 +55,6 @@ final class ChillPersonMoveCommand extends Command { $this ->setName('chill:person:move') - ->setDescription('Move all the associated entities on a "from" person to a "to" person and remove the old person') ->addOption('from', 'f', InputOption::VALUE_REQUIRED, 'The person id to delete, all associated data will be moved before') ->addOption('to', 't', InputOption::VALUE_REQUIRED, 'The person id which will received data') ->addOption('dump-sql', null, InputOption::VALUE_NONE, 'dump sql to stdout') @@ -99,7 +100,7 @@ final class ChillPersonMoveCommand extends Command $this->chillLogger->notice('Move a person from command line succeeded', $ctxt); } - return 0; + return Command::SUCCESS; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php index 6c85548dd..6aab04389 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php @@ -41,7 +41,6 @@ final class ImportSocialWorkMetadata extends Command ->setName('chill:person:import-socialwork') ->addOption('filepath', 'f', InputOption::VALUE_REQUIRED, 'The file to import.') ->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The default language') - ->setDescription($description) ->setHelp($help); } diff --git a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php index f826c4d17..43a74a5e1 100644 --- a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface; class RemoveOldDraftAccompanyingPeriodCommand extends Command { + protected static $defaultDescription = 'Remove draft accompanying period which are still draft and unused'; + public function __construct(private readonly LoggerInterface $logger, private readonly OldDraftAccompanyingPeriodRemoverInterface $remover) { parent::__construct('chill:person:remove-old-draft-period'); @@ -28,7 +30,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command protected function configure(): void { $this - ->setDescription('Remove draft accompanying period which are still draft and unused') ->addArgument('interval', InputArgument::OPTIONAL, 'The interval for unactive periods', 'P15D'); } @@ -50,6 +51,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command $this->logger->info('['.$this->getName().'] end of command'); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 6caa6be4c..262a4a03d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -79,9 +79,7 @@ final class AccompanyingCourseApiController extends ApiController ]); } - /** - * @Route("/api/1.0/person/accompanying-course/list/by-recent-attributions") - */ + #[Route(path: '/api/1.0/person/accompanying-course/list/by-recent-attributions')] public function findMyRecentCourseAttribution(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -247,11 +245,7 @@ final class AccompanyingCourseApiController extends ApiController return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, ['groups' => ['read']]); } - /** - * @Route("/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}", - * requirements={ "_format": "json"}, - * name="chill_api_person_accompanying_period_referrers_suggested") - */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}', requirements: ['_format' => 'json'], name: 'chill_api_person_accompanying_period_referrers_suggested')] public function suggestReferrals(AccompanyingPeriod $period, string $_format = 'json'): JsonResponse { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $period); @@ -278,10 +272,9 @@ final class AccompanyingCourseApiController extends ApiController } /** - * @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential") - * * @ParamConverter("accompanyingCourse", options={"id": "id"}) */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/confidential.json', name: 'chill_api_person_accompanying_period_confidential')] public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request) { if ('POST' === $request->getMethod()) { @@ -296,10 +289,9 @@ final class AccompanyingCourseApiController extends ApiController } /** - * @Route("/api/1.0/person/accompanying-course/{id}/intensity.json", name="chill_api_person_accompanying_period_intensity") - * * @ParamConverter("accompanyingCourse", options={"id": "id"}) */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/intensity.json', name: 'chill_api_person_accompanying_period_intensity')] public function toggleIntensityApi(AccompanyingPeriod $accompanyingCourse, Request $request) { if ('POST' === $request->getMethod()) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index d4a78fc18..f7622953d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -41,10 +41,9 @@ class AccompanyingCourseCommentController extends AbstractController /** * Page of comments in Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/comments', name: 'chill_person_accompanying_period_comment_list')] public function commentAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE_DETAILS, $accompanyingCourse); @@ -118,12 +117,8 @@ class AccompanyingCourseCommentController extends AbstractController /** * Delete an existing comment. - * - * @Route( - * "/{_locale}/parcours/comment/{id}/delete", - * name="chill_person_accompanying_period_comment_delete" - * ) */ + #[Route(path: '/{_locale}/parcours/comment/{id}/delete', name: 'chill_person_accompanying_period_comment_delete')] public function deleteAction(AccompanyingPeriod\Comment $comment, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodCommentVoter::DELETE, $comment); @@ -159,9 +154,7 @@ class AccompanyingCourseCommentController extends AbstractController ]); } - /** - * @Route("/{_locale}/parcours/comment/{id}/pin", name="chill_person_accompanying_period_comment_pin") - */ + #[Route(path: '/{_locale}/parcours/comment/{id}/pin', name: 'chill_person_accompanying_period_comment_pin')] public function pinComment(AccompanyingPeriod\Comment $comment): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod()); @@ -177,9 +170,7 @@ class AccompanyingCourseCommentController extends AbstractController ]); } - /** - * @Route("/{_locale}/parcours/comment/{id}/unpin", name="chill_person_accompanying_period_comment_unpin") - */ + #[Route(path: '/{_locale}/parcours/comment/{id}/unpin', name: 'chill_person_accompanying_period_comment_unpin')] public function unpinComment(AccompanyingPeriod\Comment $comment): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod()); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 972ed2dd0..1b2362533 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -15,7 +15,6 @@ use Chill\ActivityBundle\Entity\Activity; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\Household; -use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\AccompanyingCourseType; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Repository\PersonRepository; @@ -50,10 +49,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ) {} /** - * @Route("/{_locale}/parcours/{accompanying_period_id}/close", name="chill_person_accompanying_course_close") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/close', name: 'chill_person_accompanying_course_close')] public function closeAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse); @@ -97,10 +95,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle /** * Delete page of Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}/delete", name="chill_person_accompanying_course_delete") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/delete', name: 'chill_person_accompanying_course_delete')] public function deleteAction(Request $request, AccompanyingPeriod $accompanyingCourse) { $em = $this->managerRegistry->getManager(); @@ -154,10 +151,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle * * the page edit all blocks managed by vuejs component * - * @Route("/{_locale}/parcours/{accompanying_period_id}/edit", name="chill_person_accompanying_course_edit") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/edit', name: 'chill_person_accompanying_course_edit')] public function editAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse); @@ -172,10 +168,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle * * the page show anti chronologic history with all actions, title of page is 'Accompanying Course History' * - * @Route("/{_locale}/parcours/{accompanying_period_id}/history", name="chill_person_accompanying_course_history") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/history', name: 'chill_person_accompanying_course_history')] public function historyAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); @@ -188,10 +183,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle /** * Homepage of Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}", name="chill_person_accompanying_course_index") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}', name: 'chill_person_accompanying_course_index')] public function indexAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); @@ -228,9 +222,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ]); } - /** - * @Route("/{_locale}/person/parcours/new", name="chill_person_accompanying_course_new") - */ + #[Route(path: '/{_locale}/person/parcours/new', name: 'chill_person_accompanying_course_new')] public function newAction(Request $request): Response { $user = $this->security->getUser(); @@ -268,9 +260,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ]); } - /** - * @Route("/{_locale}/person/household/parcours/new", name="chill_household_accompanying_course_new") - */ + #[Route(path: '/{_locale}/person/household/parcours/new', name: 'chill_household_accompanying_course_new')] public function newHouseholdParcoursAction(Request $request): Response { $user = $this->getUser(); @@ -308,10 +298,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle } /** - * @Route("/{_locale}/parcours/{accompanying_period_id}/open", name="chill_person_accompanying_course_reopen") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/open', name: 'chill_person_accompanying_course_reopen')] public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index 9999257a3..98467a302 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -29,9 +29,7 @@ class AccompanyingCourseWorkApiController extends ApiController private readonly Security $security, ) {} - /** - * @Route("/api/1.0/person/accompanying-period/work/my-near-end") - */ + #[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')] public function myWorksNearEndDate(Request $request): JsonResponse { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 591742ee9..fb5b3066c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -17,7 +17,6 @@ use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; -use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter; @@ -44,13 +43,7 @@ final class AccompanyingCourseWorkController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route( - * "{_locale}/person/accompanying-period/{id}/work/new", - * name="chill_person_accompanying_period_work_new", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/{id}/work/new', name: 'chill_person_accompanying_period_work_new', methods: ['GET'])] public function createWork(AccompanyingPeriod $period): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::CREATE, $period); @@ -77,13 +70,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/delete", - * name="chill_person_accompanying_period_work_delete", - * methods={"GET", "POST", "DELETE"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/delete', name: 'chill_person_accompanying_period_work_delete', methods: ['GET', 'POST', 'DELETE'])] public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work); @@ -123,13 +110,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/edit", - * name="chill_person_accompanying_period_work_edit", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/edit', name: 'chill_person_accompanying_period_work_edit', methods: ['GET'])] public function editWork(AccompanyingPeriodWork $work): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work); @@ -143,13 +124,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/{id}/work", - * name="chill_person_accompanying_period_work_list", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/{id}/work', name: 'chill_person_accompanying_period_work_list', methods: ['GET'])] public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period); @@ -181,13 +156,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/show", - * name="chill_person_accompanying_period_work_show", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/show', name: 'chill_person_accompanying_period_work_show', methods: ['GET'])] public function showWork(AccompanyingPeriodWork $work): Response { if (null === $work) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 21378b9d7..677040484 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -22,13 +22,7 @@ class AccompanyingCourseWorkEvaluationDocumentController extends AbstractControl { public function __construct(private readonly Security $security) {} - /** - * @Route( - * "{_locale}/person/accompanying-period/work/evaluation/document/{id}/show", - * name="chill_person_accompanying_period_work_evaluation_document_show", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/evaluation/document/{id}/show', name: 'chill_person_accompanying_period_work_evaluation_document_show', methods: ['GET'])] public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response { $work = $document->getAccompanyingPeriodWorkEvaluation()->getAccompanyingPeriodWork(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index ed86f02e5..7c18ab8a3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -44,9 +44,8 @@ class AccompanyingPeriodController extends AbstractController /** * @throws \Exception - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/close", name="chill_person_accompanying_period_close") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/close', name: 'chill_person_accompanying_period_close')] public function closeAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -123,9 +122,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/create", name="chill_person_accompanying_period_create") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/create', name: 'chill_person_accompanying_period_create')] public function createAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -190,10 +187,9 @@ class AccompanyingPeriodController extends AbstractController } /** - * @ParamConverter("person", options={"id": "person_id"}) - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period", name="chill_person_accompanying_period_list") + * @ParamConverter("person", options={"id"="person_id"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period', name: 'chill_person_accompanying_period_list')] public function listAction(Person $person): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $person); @@ -218,9 +214,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/open", name="chill_person_accompanying_period_open") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/open', name: 'chill_person_accompanying_period_open')] public function openAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -303,9 +297,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open", name="chill_person_accompanying_period_re_open") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open', name: 'chill_person_accompanying_period_re_open')] public function reOpenAction(int $person_id, int $period_id, Request $request): Response { /** @var Person $person */ @@ -353,9 +345,8 @@ class AccompanyingPeriodController extends AbstractController /** * @throws Exception - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/update", name="chill_person_accompanying_period_update") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/update', name: 'chill_person_accompanying_period_update')] public function updateAction(int $person_id, int $period_id, Request $request): Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index f5516114f..a3ce3ef13 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -33,9 +33,7 @@ class AccompanyingPeriodRegulationListController { public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} - /** - * @Route("/{_locale}/person/periods/undispatched", name="chill_person_course_list_regulation") - */ + #[Route(path: '/{_locale}/person/periods/undispatched', name: 'chill_person_course_list_regulation')] public function listRegul(Request $request): Response { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 60b8e9cff..1be5543d1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -31,10 +31,7 @@ class AccompanyingPeriodWorkEvaluationApiController { public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) {} - /** - * @Route("/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}", - * requirements={"format": "json"}) - */ + #[Route(path: '/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}', requirements: ['format' => 'json'])] public function listTemplateByEvaluation(Evaluation $evaluation, string $_format): JsonResponse { if ('json' !== $_format) { @@ -64,9 +61,7 @@ class AccompanyingPeriodWorkEvaluationApiController ), JsonResponse::HTTP_OK, [], true); } - /** - * @Route("/api/1.0/person/accompanying-period/work/evaluation/my-near-end") - */ + #[Route(path: '/api/1.0/person/accompanying-period/work/evaluation/my-near-end')] public function myWorksNearEndDate(Request $request): JsonResponse { $total = $this->accompanyingPeriodWorkEvaluationRepository diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminController.php b/src/Bundle/ChillPersonBundle/Controller/AdminController.php index 7f973d50a..970010e20 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AdminController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AdminController.php @@ -19,33 +19,25 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/accompanying-course", name="chill_accompanying-course_admin_index") - */ + #[Route(path: '/{_locale}/admin/accompanying-course', name: 'chill_accompanying-course_admin_index')] public function indexAccompanyingCourseAdminAction() { return $this->render('@ChillPerson/Admin/indexAccompanyingCourse.html.twig'); } - /** - * @Route("/{_locale}/admin/household", name="chill_household_admin_index") - */ + #[Route(path: '/{_locale}/admin/household', name: 'chill_household_admin_index')] public function indexHouseholdAdminAction() { return $this->render('@ChillPerson/Admin/indexHousehold.html.twig'); } - /** - * @Route("/{_locale}/admin/person", name="chill_person_admin_index") - */ + #[Route(path: '/{_locale}/admin/person', name: 'chill_person_admin_index')] public function indexPersonAdminAction() { return $this->render('@ChillPerson/Admin/indexPerson.html.twig'); } - /** - * @Route("/{_locale}/admin/social-work", name="chill_social-work_admin_index") - */ + #[Route(path: '/{_locale}/admin/social-work', name: 'chill_social-work_admin_index')] public function indexSocialWorkAdminAction() { return $this->render('@ChillPerson/Admin/indexSocialWork.html.twig'); @@ -53,9 +45,8 @@ class AdminController extends AbstractController /** * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/person_redirect_to_main", name="chill_person_admin_redirect_to_admin_index", options={null}) */ + #[Route(path: '/{_locale}/admin/person_redirect_to_main', name: 'chill_person_admin_redirect_to_admin_index', options: [null])] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index a6d5ed2c5..05e73ad2a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -34,11 +34,9 @@ class HouseholdApiController extends ApiController public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** - * @Route("/api/1.0/person/household/by-address-reference/{id}.json", - * name="chill_api_person_household_by_address_reference") - * * @return \Symfony\Component\HttpFoundation\JsonResponse */ + #[Route(path: '/api/1.0/person/household/by-address-reference/{id}.json', name: 'chill_api_person_household_by_address_reference')] public function getHouseholdByAddressReference(AddressReference $addressReference): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -59,10 +57,8 @@ class HouseholdApiController extends ApiController /** * Add an address to a household. - * - * @Route("/api/1.0/person/household/{id}/address.{_format}", name="chill_api_single_household_address", - * methods={"POST"}, requirements={"_format": "json"}) */ + #[Route(path: '/api/1.0/person/household/{id}/address.{_format}', name: 'chill_api_single_household_address', methods: ['POST'], requirements: ['_format' => 'json'])] public function householdAddressApi(Household $household, Request $request, string $_format): Response { $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); @@ -104,15 +100,9 @@ class HouseholdApiController extends ApiController } /** - * @Route("/api/1.0/person/address/suggest/by-household/{household_id}.{_format}", - * name="chill_person_address_suggest_by_household", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/api/1.0/person/address/suggest/by-household/{household_id}.{_format}', name: 'chill_person_address_suggest_by_household', requirements: ['_format' => 'json'])] public function suggestAddressByHousehold(Household $household, string $_format) { // TODO add acl diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 00503ab3e..0da3688f9 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -46,9 +46,7 @@ class HouseholdCompositionController extends AbstractController private readonly UrlGeneratorInterface $urlGenerator ) {} - /** - * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") - */ + #[Route(path: '/{_locale}/person/household/{household_id}/composition/{composition_id}/delete', name: 'chill_person_household_composition_delete')] public function deleteAction(Request $request, mixed $household_id, mixed $composition_id): Response { $composition = $this->householdCompositionRepository->find($composition_id); @@ -95,9 +93,7 @@ class HouseholdCompositionController extends AbstractController ); } - /** - * @Route("/{_locale}/person/household/{id}/composition/index", name="chill_person_household_composition_index") - */ + #[Route(path: '/{_locale}/person/household/{id}/composition/index', name: 'chill_person_household_composition_index')] public function index(Household $household, Request $request): Response { if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) { @@ -122,9 +118,7 @@ class HouseholdCompositionController extends AbstractController )); } - /** - * @Route("/{_locale}/person/household/{id}/composition/new", name="chill_person_household_composition_new") - */ + #[Route(path: '/{_locale}/person/household/{id}/composition/new', name: 'chill_person_household_composition_new')] public function newAction(Household $household, Request $request): Response { if ($this->security->isGranted(HouseholdVoter::EDIT, $household)) { diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index ae74d365b..83a195c5b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -29,22 +29,15 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/{_locale}/person/household") - */ +#[Route(path: '/{_locale}/person/household')] class HouseholdController extends AbstractController { public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** - * @Route( - * "/{household_id}/accompanying-period", - * name="chill_person_household_accompanying_period", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/accompanying-period', name: 'chill_person_household_accompanying_period', methods: ['GET', 'HEAD'])] public function accompanyingPeriod(Request $request, Household $household) { $currentMembers = $household->getCurrentPersons(); @@ -92,14 +85,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/edit", - * name="chill_person_household_address_edit", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/edit', name: 'chill_person_household_address_edit', methods: ['GET', 'HEAD', 'POST'])] public function addressEdit(Request $request, Household $household) { // TODO ACL @@ -119,14 +107,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/addresses", - * name="chill_person_household_addresses", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/addresses', name: 'chill_person_household_addresses', methods: ['GET', 'HEAD'])] public function addresses(Request $request, Household $household) { // TODO ACL @@ -150,14 +133,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/move", - * name="chill_person_household_address_move", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/move', name: 'chill_person_household_address_move', methods: ['GET', 'HEAD', 'POST'])] public function addressMove(Request $request, Household $household) { // TODO ACL @@ -171,14 +149,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/edit_valid_from", - * name="chill_person_household_address_valid_from_edit", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/edit_valid_from', name: 'chill_person_household_address_valid_from_edit', methods: ['GET', 'HEAD', 'POST'])] public function addressValidFromEdit(Request $request, Household $household) { $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); @@ -228,14 +201,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/members/metadata/edit", - * name="chill_person_household_members_metadata_edit", - * methods={"GET", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/members/metadata/edit', name: 'chill_person_household_members_metadata_edit', methods: ['GET', 'POST'])] public function editHouseholdMetadata(Request $request, Household $household) { // TODO ACL @@ -260,14 +228,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/relationship", - * name="chill_person_household_relationship", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/relationship', name: 'chill_person_household_relationship', methods: ['GET', 'HEAD'])] public function showRelationship(Request $request, Household $household) { $jsonString = $this->serializer->serialize( @@ -286,14 +249,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/summary", - * name="chill_person_household_summary", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/summary', name: 'chill_person_household_summary', methods: ['GET', 'HEAD'])] public function summary(Request $request, Household $household) { // TODO ACL diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index aa2f80a43..07ab6da70 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -47,12 +47,7 @@ class HouseholdMemberController extends ApiController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @Route( - * "/{_locale}/person/household/member/{id}/edit", - * name="chill_person_household_member_edit" - * ) - */ + #[Route(path: '/{_locale}/person/household/member/{id}/edit', name: 'chill_person_household_member_edit')] public function editMembership(Request $request, HouseholdMember $member): Response { // TODO ACL @@ -90,12 +85,8 @@ class HouseholdMemberController extends ApiController * * household: the id of the destination household * * allow_leave_without_household: if present, the editor will allow * to leave household without joining another - * - * @Route( - * "/{_locale}/person/household/members/editor", - * name="chill_person_household_members_editor" - * ) */ + #[Route(path: '/{_locale}/person/household/members/editor', name: 'chill_person_household_members_editor')] public function editor(Request $request) { $ids = $request->query->all('persons'); @@ -173,12 +164,7 @@ class HouseholdMemberController extends ApiController ]); } - /** - * @Route( - * "/api/1.0/person/household/members/move.{_format}", - * name="chill_api_person_household_members_move" - * ) - */ + #[Route(path: '/api/1.0/person/household/members/move.{_format}', name: 'chill_api_person_household_members_move')] public function move(Request $request, mixed $_format): Response { try { diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index b1df6cb16..13b1fc7ca 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -31,9 +31,7 @@ class PersonAddressController extends AbstractController */ public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/create', name: 'chill_person_address_create', methods: ['POST'])] public function createAction(mixed $person_id, Request $request) { $person = $this->managerRegistry->getManager() @@ -88,9 +86,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/edit", name="chill_person_address_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/edit', name: 'chill_person_address_edit')] public function editAction(mixed $person_id, mixed $address_id) { $person = $this->managerRegistry->getManager() @@ -118,9 +114,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/list", name="chill_person_address_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/list', name: 'chill_person_address_list')] public function listAction(mixed $person_id) { $person = $this->managerRegistry->getManager() @@ -142,9 +136,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/new", name="chill_person_address_new") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/new', name: 'chill_person_address_new')] public function newAction(mixed $person_id) { $person = $this->managerRegistry->getManager() @@ -171,9 +163,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/update", name="chill_person_address_update") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/update', name: 'chill_person_address_update')] public function updateAction(mixed $person_id, mixed $address_id, Request $request) { $person = $this->managerRegistry->getManager() diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 01008f240..6a1820b24 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -36,11 +36,7 @@ class PersonApiController extends ApiController $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } - /** - * @Route("/api/1.0/person/creation/authorized-centers", - * name="chill_person_person_creation_authorized_centers" - * ) - */ + #[Route(path: '/api/1.0/person/creation/authorized-centers', name: 'chill_person_person_creation_authorized_centers')] public function authorizedCentersForCreation(): Response { $centers = $this->authorizedCenterOnPersonCreation->getCenters(); @@ -53,14 +49,7 @@ class PersonApiController extends ApiController ); } - /** - * @Route("/api/1.0/person/config/alt_names.{_format}", - * name="chill_person_config_alt_names", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[Route(path: '/api/1.0/person/config/alt_names.{_format}', name: 'chill_person_config_alt_names', requirements: ['_format' => 'json'])] public function configAltNames(Request $request, string $_format): Response { $configAltNamesChoices = $this->configPersonAltNameHelper->getChoices(); @@ -83,15 +72,9 @@ class PersonApiController extends ApiController } /** - * @Route("/api/1.0/person/address/suggest/by-person/{person_id}.{_format}", - * name="chill_person_address_suggest_by_person", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("person", options={"id": "person_id"}) */ + #[Route(path: '/api/1.0/person/address/suggest/by-person/{person_id}.{_format}', name: 'chill_person_address_suggest_by_person', requirements: ['_format' => 'json'])] public function suggestAddress(Person $person, Request $request, string $_format): Response { $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 3d8d1bdbe..9f35e1b5c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -49,9 +49,7 @@ final class PersonController extends AbstractController private readonly EntityManagerInterface $em, ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit") - */ + #[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')] public function editAction(int $person_id, Request $request) { $person = $this->_getPerson($person_id); @@ -116,14 +114,9 @@ final class PersonController extends AbstractController } /** - * @Route( - * "/{_locale}/person/household/{person_id}/history", - * name="chill_person_household_person_history", - * methods={"GET", "POST"} - * ) - * * @ParamConverter("person", options={"id": "person_id"}) */ + #[Route(path: '/{_locale}/person/household/{person_id}/history', name: 'chill_person_household_person_history', methods: ['GET', 'POST'])] public function householdHistoryByPerson(Request $request, Person $person): Response { $this->denyAccessUnlessGranted( @@ -146,14 +139,13 @@ final class PersonController extends AbstractController /** * Method for creating a new person. * - *The controller register data from a previous post on the form, and + * The controller register data from a previous post on the form, and * register it in the session. * * The next post compare the data with previous one and, if yes, show a * review page if there are "alternate persons". - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/new", name="chill_person_new") */ + #[Route(path: '/{_locale}/person/new', name: 'chill_person_new')] public function newAction(Request $request): Response { $person = new Person(); @@ -248,9 +240,7 @@ final class PersonController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general", name="chill_person_view") - */ + #[Route(path: '/{_locale}/person/{person_id}/general', name: 'chill_person_view')] public function viewAction(int $person_id) { $person = $this->_getPerson($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 119780b47..b11390a46 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -42,9 +42,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm', name: 'chill_person_duplicate_confirm')] public function confirmAction(mixed $person1_id, mixed $person2_id, Request $request) { if ($person1_id === $person2_id) { @@ -104,9 +102,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/find-manually", name="chill_person_find_manually_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/find-manually', name: 'chill_person_find_manually_duplicate')] public function findManuallyDuplicateAction(mixed $person_id, Request $request) { $person = $this->_getPerson($person_id); @@ -155,9 +151,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate", name="chill_person_duplicate_not_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate', name: 'chill_person_duplicate_not_duplicate')] public function notDuplicateAction(mixed $person1_id, mixed $person2_id) { $user = $this->security->getUser(); @@ -190,9 +184,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate", name="chill_person_remove_duplicate_not_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate', name: 'chill_person_remove_duplicate_not_duplicate')] public function removeNotDuplicateAction(mixed $person1_id, mixed $person2_id) { [$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id); @@ -214,9 +206,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/duplicate/view", name="chill_person_duplicate_view") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/duplicate/view', name: 'chill_person_duplicate_view')] public function viewAction(mixed $person_id, PersonNotDuplicateRepository $personNotDuplicateRepository) { $person = $this->_getPerson($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index a9d60d18e..079830cf7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -27,9 +27,7 @@ final class PersonResourceController extends AbstractController { public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/delete', name: 'chill_person_resource_delete')] public function deleteAction(Request $request, mixed $person_id, mixed $resource_id): Response { $personOwner = $this->personRepository->find($person_id); @@ -76,9 +74,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/edit", name="chill_person_resource_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/edit', name: 'chill_person_resource_edit')] public function editAction(Request $request, mixed $resource_id, mixed $person_id): Response { $resource = $this->personResourceRepository->find($resource_id); @@ -113,9 +109,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/list", name="chill_person_resource_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/list', name: 'chill_person_resource_list')] public function listAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); @@ -133,9 +127,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/new", name="chill_person_resource_new") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/new', name: 'chill_person_resource_new')] public function newAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index 7cd95773e..6e3fa5117 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -41,9 +41,7 @@ class ReassignAccompanyingPeriodController extends AbstractController { public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) {} - /** - * @Route("/{_locale}/person/accompanying-periods/reassign", name="chill_course_list_reassign") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/reassign', name: 'chill_course_list_reassign')] public function listAction(Request $request): Response { if (!$this->security->isGranted(AccompanyingPeriodVoter::REASSIGN_BULK)) { diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index 4cf3e0d6e..dc3c8ee0a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -29,9 +29,7 @@ final class ResidentialAddressController extends AbstractController { public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete") - */ + #[Route(path: '/{_locale}/person/residential-address/{id}/delete', name: 'chill_person_residential_address_delete')] public function deleteAction(Request $request, ResidentialAddress $residentialAddress): Response { $this->denyAccessUnlessGranted(PersonVoter::UPDATE, $residentialAddress->getPerson()); @@ -57,9 +55,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/residential-address/{id}/edit", name="chill_person_residential_address_edit") - */ + #[Route(path: '/{_locale}/person/residential-address/{id}/edit', name: 'chill_person_residential_address_edit')] public function editAction(Request $request, ResidentialAddress $residentialAddress): Response { if ($request->query->has('kind')) { @@ -93,9 +89,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/{id}/residential-address/list", name="chill_person_residential_address_list") - */ + #[Route(path: '/{_locale}/person/{id}/residential-address/list', name: 'chill_person_residential_address_list')] public function listAction(Request $request, Person $person): Response { $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); @@ -108,9 +102,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/{id}/residential-address/new", name="chill_person_residential_address_new") - */ + #[Route(path: '/{_locale}/person/{id}/residential-address/new', name: 'chill_person_residential_address_new')] public function newAction(Request $request, Person $person): Response { $residentialAddress = new ResidentialAddress(); diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index b97f2ed30..27a7acbf5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -25,15 +25,9 @@ class SocialWorkEvaluationApiController extends AbstractController public function __construct(private readonly PaginatorFactory $paginatorFactory) {} /** - * @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json", - * name="chill_person_evaluation_index_by_social_action", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("action", options={"id": "action_id"}) */ + #[Route(path: '/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json', name: 'chill_person_evaluation_index_by_social_action', requirements: ['_format' => 'json'])] public function listEvaluationBySocialAction(SocialAction $action): Response { $evaluations = $action->getEvaluations()->filter(static fn (Evaluation $eval) => $eval->isActive()); diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index 5cfc26cc7..0cd86eb5b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -24,9 +24,7 @@ class TimelinePersonController extends AbstractController { public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/timeline', name: 'chill_person_timeline')] public function personAction(Request $request, mixed $person_id) { $person = $this->managerRegistry diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 1f484fd91..adaaa27d0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -23,9 +23,7 @@ class UserAccompanyingPeriodController extends AbstractController { public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) {} - /** - * @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/my', name: 'chill_person_accompanying_period_user')] public function listAction(Request $request): Response { $active = $request->query->getBoolean('active', true); @@ -56,9 +54,7 @@ class UserAccompanyingPeriodController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/my/drafts', name: 'chill_person_accompanying_period_draft_user')] public function listDraftsAction(): Response { $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index a38b7055c..27a217987 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -58,18 +58,14 @@ use UnexpectedValueException; * * @ORM\Table(name="chill_person_accompanying_period") * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period": AccompanyingPeriod::class - * }) - * - * @Assert\GroupSequenceProvider - * * @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @LocationValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @ConfidentialCourseMustHaveReferrer(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])] +#[Assert\GroupSequenceProvider] class AccompanyingPeriod implements GroupSequenceProviderInterface, HasCentersInterface, @@ -144,11 +140,9 @@ class AccompanyingPeriod implements /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?Location $administrativeLocation = null; /** @@ -160,17 +154,10 @@ class AccompanyingPeriod implements /** * @ORM\Column(type="date", nullable=true) - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) - * - * @Assert\GreaterThanOrEqual( - * propertyPath="openingDate", - * groups={AccompanyingPeriod::STEP_CLOSED}, - * message="The closing date must be later than the date of creation" - * ) */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] + #[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')] private ?\DateTime $closingDate = null; /** @@ -178,11 +165,9 @@ class AccompanyingPeriod implements * targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] private ?ClosingMotive $closingMotive = null; /** @@ -194,40 +179,35 @@ class AccompanyingPeriod implements * * @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"}) * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT}) - * * @var Collection */ + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])] private Collection $comments; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $confidential = false; /** * @ORM\Column(type="datetime", nullable=true, options={"default": NULL}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?\DateTimeInterface $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?User $createdBy = null; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $emergency = false; /** @@ -236,29 +216,24 @@ class AccompanyingPeriod implements * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="string", nullable=true) - * - * @Groups({"read"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?string $intensity = self::INTENSITY_OCCASIONAL; /** * @ORM\ManyToOne( * targetEntity=UserJob::class * ) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?UserJob $job = null; /** @@ -271,24 +246,19 @@ class AccompanyingPeriod implements /** * @ORM\Column(type="date") - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\LessThan(value="tomorrow", groups={AccompanyingPeriod::STEP_CONFIRMED}) - * - * @Assert\LessThanOrEqual(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])] + #[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?\DateTime $openingDate = null; /** * @ORM\ManyToOne(targetEntity=Origin::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?Origin $origin = null; /** @@ -296,12 +266,11 @@ class AccompanyingPeriod implements * mappedBy="accompanyingPeriod", orphanRemoval=true, * cascade={"persist", "refresh", "remove", "merge", "detach"}) * - * @Groups({"read", "docgen:read"}) - * * @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $participations; /** @@ -318,26 +287,23 @@ class AccompanyingPeriod implements * cascade={"persist"}, * ) * - * @Groups({"read"}) - * * @ORM\JoinColumn(onDelete="SET NULL") */ + #[Groups(['read'])] private ?Comment $pinnedComment = null; private bool $preventUserIsChangedNotification = false; /** * @ORM\Column(type="text") - * - * @Groups({"read", "write"}) */ + #[Groups(['read', 'write'])] private string $remark = ''; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $requestorAnonymous = false; /** @@ -364,10 +330,9 @@ class AccompanyingPeriod implements * orphanRemoval=true * ) * - * @Groups({"read", "docgen:read"}) - * * @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"}) */ + #[Groups(['read', 'docgen:read'])] private Collection $resources; /** @@ -383,11 +348,9 @@ class AccompanyingPeriod implements * joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")} * ) - * - * @Groups({"read", "docgen:read"}) - * - * @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must be associated to at least one scope") */ + #[Groups(['read', 'docgen:read'])] + #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')] private Collection $scopes; /** @@ -400,20 +363,17 @@ class AccompanyingPeriod implements * @ORM\JoinTable( * name="chill_person_accompanying_period_social_issues" * ) - * - * @Groups({"read", "docgen:read"}) - * - * @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must contains at least one social issue") */ + #[Groups(['read', 'docgen:read'])] + #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')] private Collection $socialIssues; /** * @ORM\Column(type="string", length=32, nullable=true) * - * @Groups({"read"}) - * * @var AccompanyingPeriod::STEP_* */ + #[Groups(['read'])] private ?string $step = self::STEP_DRAFT; /** @@ -440,9 +400,8 @@ class AccompanyingPeriod implements * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private ?User $user = null; /** @@ -469,9 +428,8 @@ class AccompanyingPeriod implements * targetEntity=AccompanyingPeriodWork::class, * mappedBy="accompanyingPeriod" * ) - * - * @Assert\Valid(traverse=true) */ + #[Assert\Valid(traverse: true)] private Collection $works; /** @@ -749,10 +707,9 @@ class AccompanyingPeriod implements } /** - * @Groups({"read"}) - * * @return ReadableCollection<(int|string), Comment> */ + #[Groups(['read'])] public function getComments(): ReadableCollection { $pinnedComment = $this->pinnedComment; @@ -775,9 +732,7 @@ class AccompanyingPeriod implements return $this->createdBy; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getCurrentParticipations(): ReadableCollection { return $this->getOpenParticipations(); @@ -826,9 +781,8 @@ class AccompanyingPeriod implements /** * Get the location, taking precedence into account. - * - * @Groups({"read"}) */ + #[Groups(['read'])] public function getLocation(?\DateTimeImmutable $at = null): ?Address { if ($this->getPersonLocation() instanceof Person) { @@ -849,10 +803,9 @@ class AccompanyingPeriod implements /** * Get where the location is. * - * @Groups({"read"}) - * * @return 'person'|'address'|'none' */ + #[Groups(['read'])] public function getLocationStatus(): string { if ($this->getPersonLocation() instanceof Person) { @@ -949,9 +902,7 @@ class AccompanyingPeriod implements ); } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getPersonLocation(): ?Person { return $this->personLocation; @@ -971,9 +922,7 @@ class AccompanyingPeriod implements ); } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getPinnedComment(): ?Comment { return $this->pinnedComment; @@ -1026,9 +975,7 @@ class AccompanyingPeriod implements return $this->remark; } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getRequestor(): Person|ThirdParty|null { return $this->requestorPerson ?? $this->requestorThirdParty; @@ -1254,9 +1201,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setAddressLocation(?Address $addressLocation = null): self { if ($this->addressLocation !== $addressLocation) { @@ -1369,9 +1314,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setPersonLocation(?Person $person = null): self { if ($this->personLocation !== $person) { @@ -1391,9 +1334,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setPinnedComment(?Comment $comment = null): self { if (null !== $this->pinnedComment) { @@ -1421,9 +1362,8 @@ class AccompanyingPeriod implements * @param $requestor Person|ThirdParty * * @throw UnexpectedValueException if the requestor is not a Person or ThirdParty - * - * @Groups({"write"}) */ + #[Groups(['write'])] public function setRequestor($requestor): self { if ($requestor instanceof Person) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 618918695..dcf154b8b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -33,23 +33,16 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_work") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "accompanying_period_work": AccompanyingPeriodWork::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])] class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface { /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) * - * @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"}) - * * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** @@ -60,57 +53,46 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * orphanRemoval=true * ) * - * @Serializer\Groups({"read", "docgen:read"}) - * * @ORM\OrderBy({"startDate": "DESC", "id": "DESC"}) * * @var Collection * * @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer` */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection $accompanyingPeriodWorkEvaluations; /** * @ORM\Column(type="datetime_immutable") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private bool $createdAutomatically = false; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private string $createdAutomaticallyReason = ''; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?User $createdBy = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate", - * message="accompanying_course_work.The endDate should be greater or equal than the start date" - * ) */ + #[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')] private ?\DateTimeImmutable $endDate = null; /** @@ -122,20 +104,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * cascade={"persist"}, * orphanRemoval=true * ) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $goals; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * - * In schema : traitant */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private ?ThirdParty $handlingThierParty = null; /** @@ -144,16 +120,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])] private string $note = ''; /** @@ -162,18 +136,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToMany(targetEntity=Person::class) * * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"accompanying_period_work:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])] private Collection $persons; /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") - * - * @Serializer\Groups({"read", "accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit'])] private PrivateCommentEmbeddable $privateComment; /** @@ -189,29 +159,22 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks") * * @ORM\JoinTable(name="chill_person_accompanying_period_work_result") - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $results; /** * @ORM\ManyToOne(targetEntity=SocialAction::class) * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:create"}) - * * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])] private ?SocialAction $socialAction = null; /** * @ORM\Column(type="date_immutable") - * - * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?\DateTimeImmutable $startDate = null; /** @@ -222,35 +185,30 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party") * * In schema : intervenants - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $thirdParties; /** * @ORM\Column(type="datetime_immutable") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $updatedBy = null; /** * @ORM\Column(type="integer", nullable=false, options={"default": 1}) * - * @Serializer\Groups({"read", "accompanying_period_work:edit"}) - * * @ORM\Version */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit'])] private int $version = 1; public function __construct() @@ -394,11 +352,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @return ReadableCollection - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"accompanying_period_work:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])] public function getReferrers(): ReadableCollection { $users = $this->referrersHistory diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 7f2fc981c..18993c3d9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -25,11 +25,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table("chill_person_accompanying_period_work_evaluation") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class, - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])] class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface { /** @@ -38,35 +35,29 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * inversedBy="accompanyingPeriodWorkEvaluations" * ) * - * @Serializer\Groups({"read:evaluation:include-work"}) - * * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ + #[Serializer\Groups(['read:evaluation:include-work'])] private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private string $comment = ''; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne( * targetEntity=User::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $createdBy = null; /** @@ -83,29 +74,23 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * * @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"}) * - * @Serializer\Groups({"read"}) - * * @var Collection */ + #[Serializer\Groups(['read'])] private Collection $documents; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $endDate = null; /** * @ORM\ManyToOne( * targetEntity=Evaluation::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])] private ?Evaluation $evaluation = null; /** @@ -114,9 +99,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -125,63 +109,46 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * * This data is not persisted into database, but will appears on the data * normalized during the same request (like PUT/PATCH request) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private $key; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $maxDate = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $startDate = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne( * targetEntity=User::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $updatedBy = null; /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateInterval $warningInterval = null; /** * @ORM\Column(type="integer", nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?int $timeSpent = null; public function __construct() @@ -270,9 +237,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this->updatedBy; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getWarningDate(): ?\DateTimeImmutable { if (null === $this->getEndDate() || null === $this->getWarningInterval()) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php index e5ddc059a..d20e8d7ed 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php @@ -23,11 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table("chill_person_accompanying_period_work_evaluation_document") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_work_evaluation_document": AccompanyingPeriodWorkEvaluationDocument::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])] class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface { use TrackCreationTrait; @@ -52,10 +49,8 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct * @internal the default name exceeds 64 characters, we must set manually: * * @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] private ?int $id = null; /** @@ -64,43 +59,31 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct * * This data is not persisted into database, but will appears on the data * normalized during the same request (like PUT/PATCH request) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private $key; /** * @ORM\ManyToOne( * targetEntity=StoredObject::class, * ) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) - * - * @Assert\Valid */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] + #[Assert\Valid] private ?StoredObject $storedObject = null; /** * @ORM\ManyToOne( * targetEntity=DocGeneratorTemplate::class * ) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] private ?DocGeneratorTemplate $template = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private ?string $title = ''; public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php index c0a1528ad..bdd30eec3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php @@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_work_goal") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "accompanying_period_work_goal": AccompanyingPeriodWorkGoal::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])] class AccompanyingPeriodWorkGoal { /** @@ -39,10 +33,8 @@ class AccompanyingPeriodWorkGoal /** * @ORM\ManyToOne(targetEntity=Goal::class) - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] private ?Goal $goal = null; /** @@ -51,17 +43,14 @@ class AccompanyingPeriodWorkGoal * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read'])] private string $note = ''; /** @@ -70,10 +59,8 @@ class AccompanyingPeriodWorkGoal * @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals") * * @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result") - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] private Collection $results; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php index 97938dafc..dc12bff2a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php @@ -47,18 +47,16 @@ class ClosingMotive * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php index c972f453a..b230b4b18 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php @@ -24,11 +24,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_comment") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_comment": Comment::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])] class Comment implements TrackCreationInterface, TrackUpdateInterface { /** @@ -42,29 +39,24 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default":""}) - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $content = ''; /** * @ORM\Column(type="datetime") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTimeInterface $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?User $creator = null; /** @@ -73,25 +65,22 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="datetime") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeInterface $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?User $updatedBy = null; public function getAccompanyingPeriod(): ?AccompanyingPeriod diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php index 979fd4581..565f6f789 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php @@ -18,13 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_origin") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "origin": Origin::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])] class Origin { /** @@ -33,25 +28,22 @@ class Origin * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $label = []; /** * @ORM\Column(type="date_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $noActiveAfter = null; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index f0ff1d956..e5e5a6091 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -31,11 +31,12 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"}) * } * ) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_resource": Resource::class - * }) + * @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}), + * @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"}) + * } + * ) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])] class Resource { /** @@ -50,9 +51,8 @@ class Resource /** * @ORM\Column(type="text", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?string $comment = ''; /** @@ -61,27 +61,24 @@ class Resource * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?ThirdParty $thirdParty = null; public function getAccompanyingPeriod(): ?AccompanyingPeriod @@ -104,9 +101,7 @@ class Resource return $this->person; } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getResource(): Person|ThirdParty|null { return $this->person ?? $this->thirdParty; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php index 964f66f1a..2a04bbff5 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php @@ -21,18 +21,14 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_participation") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_participation": AccompanyingPeriodParticipation::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])] class AccompanyingPeriodParticipation { /** * @ORM\Column(type="date", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTime $endDate = null; /** @@ -41,16 +37,14 @@ class AccompanyingPeriodParticipation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="date", nullable=false) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTime $startDate = null; public function __construct(/** @@ -59,12 +53,11 @@ class AccompanyingPeriodParticipation * @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false) */ private ?AccompanyingPeriod $accompanyingPeriod, /** - * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") - * - * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) - * - * @Groups({"read", "docgen:read"}) - */ + * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") + * + * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) + */ + #[Groups(['read', 'docgen:read'])] private ?Person $person ) { $this->startDate = new \DateTime('now'); diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index cc0ff2d69..45f6eb3a3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -32,12 +32,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * name="chill_person_household" * ) * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household": Household::class - * }) - * * @MaxHolder(groups={"household_memberships"}) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])] class Household { /** @@ -52,9 +49,8 @@ class Household * @ORM\JoinTable(name="chill_person_household_to_addresses") * * @ORM\OrderBy({"validFrom": "DESC", "id": "DESC"}) - * - * @Serializer\Groups({"write"}) */ + #[Serializer\Groups(['write'])] private Collection $addresses; /** @@ -73,9 +69,8 @@ class Household * ) * * @ORM\OrderBy({"startDate": "DESC"}) - * - * @Assert\Valid(traverse=true, groups={"household_composition"}) */ + #[Assert\Valid(traverse: true, groups: ['household_composition'])] private Collection&Selectable $compositions; /** @@ -84,9 +79,8 @@ class Household * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -96,23 +90,20 @@ class Household * targetEntity=HouseholdMember::class, * mappedBy="household" * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection $members; /** * @ORM\Column(type="boolean", name="waiting_for_birth", options={"default": false}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private bool $waitingForBirth = false; /** * @ORM\Column(type="date_immutable", name="waiting_for_birth_date", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $waitingForBirthDate = null; public function __construct() @@ -159,8 +150,6 @@ class Household * By default, the addresses are ordered by date, descending (the most * recent first). * - * @Assert\Callback(methods={"validate"}) - * * @return Collection
    */ public function getAddresses(): Collection @@ -209,11 +198,8 @@ class Household return $this->compositions; } - /** - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\SerializedName("current_address") - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Serializer\SerializedName('current_address')] public function getCurrentAddress(?\DateTime $at = null): ?Address { $at ??= new \DateTime('today'); @@ -229,11 +215,8 @@ class Household return null; } - /** - * @Serializer\Groups({"docgen:read"}) - * - * @Serializer\SerializedName("current_composition") - */ + #[Serializer\Groups(['docgen:read'])] + #[Serializer\SerializedName('current_composition')] public function getCurrentComposition(?\DateTimeImmutable $at = null): ?HouseholdComposition { $at ??= new \DateTimeImmutable('today'); @@ -259,9 +242,7 @@ class Household return null; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection { return $this->getMembers()->matching($this->buildCriteriaCurrentMembers($now)); @@ -281,11 +262,9 @@ class Household * get current members ids. * * Used in serialization - * - * @Serializer\Groups({"read"}) - * - * @Serializer\SerializedName("current_members_id") */ + #[Serializer\Groups(['read'])] + #[Serializer\SerializedName('current_members_id')] public function getCurrentMembersIds(?\DateTimeImmutable $now = null): ReadableCollection { return $this->getCurrentMembers($now)->map( @@ -606,9 +585,8 @@ class Household * This will force the startDate's address on today. * * Used on household creation. - * - * @Serializer\Groups({"create"}) */ + #[Serializer\Groups(['create'])] public function setForceAddress(Address $address) { $address->setValidFrom(new \DateTime('today')); @@ -629,6 +607,7 @@ class Household return $this; } + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { $addresses = $this->getAddresses(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php index d8eab9bef..77f2a5994 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php @@ -26,11 +26,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Table( * name="chill_person_household_composition" * ) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_composition_type": HouseholdCompositionType::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -44,11 +41,9 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate", groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $endDate = null; /** @@ -62,9 +57,8 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa * @ORM\ManyToOne(targetEntity=HouseholdCompositionType::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?HouseholdCompositionType $householdCompositionType = null; /** @@ -73,29 +67,23 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="integer", nullable=true, options={"default": null}) - * - * @Assert\NotNull - * - * @Assert\GreaterThanOrEqual(0, groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\NotNull] + #[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?int $numberOfChildren = null; /** * @ORM\Column(type="date_immutable", nullable=false) - * - * @Assert\NotNull(groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\NotNull(groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $startDate = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php index cb1fe2703..2b3773bdf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php @@ -20,11 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Table( * name="chill_person_household_composition_type" * ) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_composition_type": HouseholdCompositionType::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] class HouseholdCompositionType { /** @@ -38,18 +35,16 @@ class HouseholdCompositionType * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $label = []; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php index 21c28f52e..09a32b2e2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php @@ -27,40 +27,30 @@ class HouseholdMember { /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?string $comment = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\GreaterThanOrEqual( - * propertyPath="startDate", - * message="household_membership.The end date must be after start date", - * groups={"household_memberships"} - * ) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])] private ?\DateTimeImmutable $endDate = null; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private bool $holder = false; /** * @ORM\ManyToOne( * targetEntity="\Chill\PersonBundle\Entity\Household\Household" * ) - * - * @Assert\Valid(groups={"household_memberships"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Assert\Valid(groups: ['household_memberships'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?Household $household = null; /** @@ -69,9 +59,8 @@ class HouseholdMember * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -79,21 +68,17 @@ class HouseholdMember * targetEntity="\Chill\PersonBundle\Entity\Person" * ) * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"docgen:person:with-household": false}) - * - * @Assert\Valid(groups={"household_memberships"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\Valid(groups: ['household_memberships'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity=Position::class) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?Position $position = null; /** @@ -103,11 +88,9 @@ class HouseholdMember /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?\DateTimeImmutable $startDate = null; public function getComment(): ?string @@ -140,9 +123,7 @@ class HouseholdMember return $this->position; } - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getShareHousehold(): ?bool { return $this->shareHousehold; diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php index 2252fca97..2080fceb1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php @@ -18,18 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_household_position") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_position": Position::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])] class Position { /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({ "read" }) */ + #[Serializer\Groups(['read'])] private bool $allowHolder = false; /** @@ -38,32 +34,28 @@ class Position * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $label = []; /** * @ORM\Column(type="float") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private float $ordering = 0.00; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $shareHouseHold = true; public function getAllowHolder(): bool diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 3ee30ac87..50c17cc19 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -62,19 +62,25 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * columns={"birthdate"} * ) * }) + * @ORM\Index( + * name="person_names", + * columns={"firstName", "lastName"} + * ), + * @ORM\Index( + * name="person_birthdate", + * columns={"birthdate"} + * ) + * }) * * @ORM\HasLifecycleCallbacks * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "person": Person::class - * }) - * * @PersonHasCenter * * @HouseholdMembershipSequential( * groups={"household_memberships"} * ) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])] class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable { final public const BOTH_GENDER = 'both'; @@ -282,35 +288,27 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's deathdate. * * @ORM\Column(type="date_immutable", nullable=true) - * - * @Assert\Date - * - * @Assert\GreaterThanOrEqual(propertyPath="birthdate") - * - * @Assert\LessThanOrEqual("today") */ + #[Assert\Date] + #[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')] + #[Assert\LessThanOrEqual('today')] private ?\DateTimeImmutable $deathdate = null; /** * The person's email. * * @ORM\Column(type="text", nullable=true) - * - * @Assert\Email() */ + #[Assert\Email] private ?string $email = ''; /** * The person's first name. * * @ORM\Column(type="string", length=255) - * - * @Assert\NotBlank(message="The firstname cannot be empty") - * - * @Assert\Length( - * max=255, - * ) */ + #[Assert\NotBlank(message: 'The firstname cannot be empty')] + #[Assert\Length(max: 255)] private string $firstName = ''; /** @@ -325,9 +323,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's gender. * * @ORM\Column(type="string", length=9, nullable=true) - * - * @Assert\NotNull(message="The gender must be set") */ + #[Assert\NotNull(message: 'The gender must be set')] private ?string $gender = null; /** @@ -374,13 +371,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's last name. * * @ORM\Column(type="string", length=255) - * - * @Assert\NotBlank(message="The lastname cannot be empty") - * - * @Assert\Length( - * max=255, - * ) */ + #[Assert\NotBlank(message: 'The lastname cannot be empty')] + #[Assert\Length(max: 255)] private string $lastName = ''; /** @@ -403,9 +396,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The date of the last marital status change of the person. * * @ORM\Column(type="date", nullable=true) - * - * @Assert\Date */ + #[Assert\Date] private ?\DateTime $maritalStatusDate = null; /** @@ -451,11 +443,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * cascade={"persist", "remove", "merge", "detach"}, * orphanRemoval=true * ) - * - * @Assert\Valid( - * traverse=true, - * ) */ + #[Assert\Valid(traverse: true)] private Collection $otherPhoneNumbers; /** @@ -1410,11 +1399,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * Validation callback that checks if the accompanying periods are valid. * * This method add violation errors. - * - * @Assert\Callback( - * groups={"accompanying_period_consistent"} - * ) */ + #[Assert\Callback(groups: ['accompanying_period_consistent'])] public function isAccompanyingPeriodValid(ExecutionContextInterface $context) { $r = $this->checkAccompanyingPeriodsAreNotCollapsing(); @@ -1439,11 +1425,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * two addresses with the same validFrom date). * * This method add violation errors. - * - * @Assert\Callback( - * groups={"addresses_consistent"} - * ) */ + #[Assert\Callback(groups: ['addresses_consistent'])] public function isAddressesValid(ExecutionContextInterface $context) { if ($this->hasTwoAdressWithSameValidFromDate()) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index c5c2c8d08..de30f059c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -28,11 +28,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Entity * * @ORM\Table(name="chill_person_resource") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "personResource": personResource::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['personResource' => PersonResource::class])] class PersonResource implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -41,16 +38,14 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private CommentEmbeddable $comment; /** * @ORM\Column(type="text", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?string $freeText = null; /** @@ -59,18 +54,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?PersonResourceKind $kind = null; /** @@ -79,9 +72,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?Person $person = null; /** @@ -90,18 +82,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="resources") * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?Person $personOwner = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?ThirdParty $thirdParty = null; public function __construct() @@ -142,9 +132,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this->personOwner; } - /** - * @Groups({"read", "docgen:read"}) - */ + #[Groups(['read', 'docgen:read'])] public function getResourceKind(): string { if ($this->getPerson() instanceof Person) { @@ -234,9 +222,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, mixed $payload) { if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php index f036e4b4a..03def4e4d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php @@ -27,9 +27,8 @@ class PersonResourceKind * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** @@ -40,10 +39,9 @@ class PersonResourceKind /** * @ORM\Column(type="json", length=255) * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $title; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php index acd312190..7317a7eba 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php @@ -31,9 +31,8 @@ class ResidentialAddress * @ORM\ManyToOne(targetEntity=Address::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?Address $address = null; /** @@ -43,9 +42,8 @@ class ResidentialAddress /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $endDate = null; /** @@ -53,19 +51,17 @@ class ResidentialAddress * * @ORM\JoinColumn(nullable=true) * - * @Groups({"read"}) - * * @Context(normalizationContext={"groups": {"minimal"}}) */ + #[Groups(['read'])] private ?Person $hostPerson = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?ThirdParty $hostThirdParty = null; /** @@ -86,9 +82,8 @@ class ResidentialAddress /** * @ORM\Column(type="datetime_immutable") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $startDate = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php index c17172882..e31c8b877 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php @@ -34,16 +34,14 @@ class PersonAltName /** * @ORM\Column(name="key", type="string", length=255) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $key = ''; /** * @ORM\Column(name="label", type="text") - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $label = ''; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php index a8c542622..ab60a06d9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php @@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; * @ORM\Entity * * @ORM\Table(name="chill_person_relations") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "relation": Relation::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['relation' => Relation::class])] class Relation { /** @@ -32,34 +29,30 @@ class Relation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $isActive = true; /** * @ORM\Column(type="json", nullable=true) * - * @Serializer\Groups({"read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read'])] private array $reverseTitle = []; /** * @ORM\Column(type="json", nullable=true) * - * @Serializer\Groups({"read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read'])] private array $title = []; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php index ce56fa013..d0a7f5fd9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php @@ -30,12 +30,9 @@ use Symfony\Component\Validator\Constraints as Assert; * * @DiscriminatorColumn(name="relation_id", type="integer") * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "relationship": Relationship::class - * }) - * * @RelationshipNoDuplicate */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['relationship' => Relationship::class])] class Relationship implements TrackCreationInterface, TrackUpdateInterface { /** @@ -54,11 +51,9 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Person $fromPerson = null; /** @@ -67,43 +62,33 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Relation::class) * * @ORM\JoinColumn(nullable=false, name="relation_id", referencedColumnName="id") - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Relation $relation = null; /** * @ORM\Column(type="boolean") - * - * @Assert\Type( - * type="bool", - * message="This must be of type boolean" - * ) - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\Type(type: 'bool', message: 'This must be of type boolean')] + #[Serializer\Groups(['read', 'write'])] private bool $reverse; /** * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Person $toPerson = null; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 4ec5bcf78..d7ada64d2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_evaluation") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "social_work_evaluation": Evaluation::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_evaluation' => Evaluation::class])] class Evaluation { /** @@ -35,9 +32,8 @@ class Evaluation /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateInterval $delay = null; /** @@ -46,16 +42,14 @@ class Evaluation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateInterval $notificationDelay = null; /** @@ -71,17 +65,15 @@ class Evaluation /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; /** * @ORM\Column(type="text", nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?string $url = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php index 856e565eb..85a8d3607 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php @@ -20,14 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_goal") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_goal": Goal::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_goal' => Goal::class])] class Goal { /** @@ -41,9 +35,8 @@ class Goal * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -65,10 +58,9 @@ class Goal /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php index c8afb0456..6cb1d1db4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php @@ -23,14 +23,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_result") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_result": Result::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_result' => Result::class])] class Result { /** @@ -65,9 +59,8 @@ class Result * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -80,10 +73,9 @@ class Result /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 19fd7395b..5aafef643 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_action") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_social_action": SocialAction::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_social_action' => SocialAction::class])] class SocialAction { /** diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 397e5a826..63e2c0566 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Entity * * @ORM\Table(name="chill_person_social_issue") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "social_issue": SocialIssue::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['social_issue' => SocialIssue::class])] class SocialIssue { /** @@ -68,9 +65,8 @@ class SocialIssue /** * @ORM\Column(type="json") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php index d2a7aba55..3a2a61cad 100644 --- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php +++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class PersonAltNameDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, iterable $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { if (null === $viewData) { return; @@ -43,7 +43,7 @@ class PersonAltNameDataMapper implements DataMapperInterface } } - public function mapFormsToData(iterable $forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { $mapIndexToKey = []; diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 200a8fbac..2c6234eb0 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -62,12 +62,7 @@ final class SingleTaskController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @Route( - * "/{_locale}/task/single-task/{id}/delete", - * name="chill_task_single_task_delete" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/delete', name: 'chill_task_single_task_delete')] public function deleteAction(Request $request, mixed $id) { $course = null; @@ -163,12 +158,7 @@ final class SingleTaskController extends AbstractController ); } - /** - * @Route( - * "/{_locale}/task/single-task/{id}/edit", - * name="chill_task_single_task_edit" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/edit', name: 'chill_task_single_task_edit')] public function editAction( SingleTask $task, Request $request @@ -258,12 +248,8 @@ final class SingleTaskController extends AbstractController * - person_id * - hide_form (hide the form to filter the tasks) * - status: date state, amongst SingleTaskRepository::DATE_STATUSES, or 'closed'. - * - * @Route( - * "/{_locale}/task/single-task/list", - * name="chill_task_singletask_list" - * ) */ + #[Route(path: '/{_locale}/task/single-task/list', name: 'chill_task_singletask_list')] public function listAction( Request $request ) { @@ -316,11 +302,7 @@ final class SingleTaskController extends AbstractController ]); } - /** - * @Route( - * "/{_locale}/task/single-task/by-course/{id}", - * name="chill_task_singletask_by-course_list") - */ + #[Route(path: '/{_locale}/task/single-task/by-course/{id}', name: 'chill_task_singletask_by-course_list')] public function listCourseTasks( AccompanyingPeriod $course, FormFactoryInterface $formFactory, @@ -367,11 +349,7 @@ final class SingleTaskController extends AbstractController ); } - /** - * @Route( - * "/{_locale}/task/single-task/by-person/{id}", - * name="chill_task_singletask_by-person_list") - */ + #[Route(path: '/{_locale}/task/single-task/by-person/{id}', name: 'chill_task_singletask_by-person_list')] public function listPersonTasks( Person $person ): Response { @@ -418,17 +396,9 @@ final class SingleTaskController extends AbstractController /** * @return Response - * - * @Route( - * "/{_locale}/task/single-task/list/my", - * name="chill_task_singletask_my_tasks", - * defaults={"_format": "html"} - * ) - * @Route( - * "/api/1.0/task/single-task/list/my", - * defaults={"_format": "json"} - * ) */ + #[Route(path: '/{_locale}/task/single-task/list/my', name: 'chill_task_singletask_my_tasks', defaults: ['_format' => 'html'])] + #[Route(path: '/api/1.0/task/single-task/list/my', defaults: ['_format' => 'json'])] public function myTasksAction(string $_format, Request $request) { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -484,12 +454,7 @@ final class SingleTaskController extends AbstractController } } - /** - * @Route( - * "/{_locale}/task/single-task/new", - * name="chill_task_single_task_new" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/new', name: 'chill_task_single_task_new')] public function newAction(Request $request) { $user = $this->security->getUser(); @@ -600,12 +565,7 @@ final class SingleTaskController extends AbstractController }; } - /** - * @Route( - * "/{_locale}/task/single-task/{id}/show", - * name="chill_task_single_task_show" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/show', name: 'chill_task_single_task_show')] public function showAction(SingleTask $task, Request $request) { $this->denyAccessUnlessGranted(TaskVoter::SHOW, $task); diff --git a/src/Bundle/ChillTaskBundle/Controller/TaskController.php b/src/Bundle/ChillTaskBundle/Controller/TaskController.php index 5ffc202de..8837dda05 100644 --- a/src/Bundle/ChillTaskBundle/Controller/TaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/TaskController.php @@ -36,17 +36,13 @@ class TaskController extends AbstractController /** * Apply a transition to a task. * - * @Route( - * "/{_locale}/task/transition/{kind}/{taskId}/{transition}", - * name="chill_task_task_transition" - * ) - * * @param string $kind * @param int $taskId * @param string $transition * * @return Response */ + #[Route(path: '/{_locale}/task/transition/{kind}/{taskId}/{transition}', name: 'chill_task_task_transition')] public function applyTransitionAction( $kind, $taskId, diff --git a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php index f9118737f..d111ada3d 100644 --- a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php @@ -25,20 +25,16 @@ use Symfony\Component\Validator\Constraints as Assert; * AbstractTask. * * @ORM\MappedSuperclass - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "single_task": SingleTask::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['single_task' => SingleTask::class])] abstract class AbstractTask implements HasCenterInterface, HasScopeInterface { /** * @ORM\ManyToOne( * targetEntity="\Chill\MainBundle\Entity\User" * ) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $assignee = null; /** @@ -50,55 +46,47 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface /** * @ORM\Column(name="closed", type="boolean", options={ "default": false }) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $closed = false; /** * @ORM\ManyToOne(targetEntity="\Chill\PersonBundle\Entity\AccompanyingPeriod") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?AccompanyingPeriod $course = null; /** * @ORM\Column(name="current_states", type="json", options={"jsonb"=true, "default"="[]"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $currentStates = []; /** * @ORM\Column(name="description", type="text") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $description = ''; /** * @ORM\ManyToOne( * targetEntity="\Chill\PersonBundle\Entity\Person" * ) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?Person $person = null; /** * @ORM\Column(name="title", type="text") - * - * @Assert\NotBlank - * - * @Serializer\Groups({"read"}) */ + #[Assert\NotBlank] + #[Serializer\Groups(['read'])] private string $title = ''; /** * @ORM\Column(name="type", type="string", length=255) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $type = null; public function getAssignee(): ?User diff --git a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php index 5e8f8eb0b..dab5eb7e5 100644 --- a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php @@ -47,11 +47,9 @@ class SingleTask extends AbstractTask { /** * @ORM\Column(name="end_date", type="date", nullable=true) - * - * @Assert\Date - * - * @Serializer\Groups({"read"}) */ + #[Assert\Date] + #[Serializer\Groups(['read'])] private ?\DateTime $endDate = null; /** @@ -60,9 +58,8 @@ class SingleTask extends AbstractTask * @ORM\Id * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** @@ -75,20 +72,11 @@ class SingleTask extends AbstractTask /** * @ORM\Column(name="start_date", type="date", nullable=true) - * - * @Serializer\Groups({"read"}) - * - * @Assert\Date - * - * @Assert\Expression( - * "value === null or this.getEndDate() === null or value < this.getEndDate()", - * message="The start date must be before the end date" - * ) - * @Assert\Expression( - * "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()", - * message="The start date must be before warning date" - * ) */ + #[Serializer\Groups(['read'])] + #[Assert\Date] + #[Assert\Expression('value === null or this.getEndDate() === null or value < this.getEndDate()', message: 'The start date must be before the end date')] + #[Assert\Expression('value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()', message: 'The start date must be before warning date')] private ?\DateTime $startDate = null; /** @@ -104,14 +92,9 @@ class SingleTask extends AbstractTask /** * @ORM\Column(name="warning_interval", type="dateinterval", nullable=true) - * - * @Serializer\Groups({"read"}) - * - * @Assert\Expression( - * "!(value != null and this.getEndDate() == null)", - * message="An end date is required if a warning interval is set" - * ) */ + #[Serializer\Groups(['read'])] + #[Assert\Expression('!(value != null and this.getEndDate() == null)', message: 'An end date is required if a warning interval is set')] private ?\DateInterval $warningInterval = null; public function __construct() @@ -164,9 +147,8 @@ class SingleTask extends AbstractTask * Return null if warningDate or endDate is null * * @return \DateTimeImmutable - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public function getWarningDate() { if (null === $this->getWarningInterval()) { diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php b/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php index 559310be6..85d50e93f 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php @@ -18,9 +18,8 @@ class AdminController extends AbstractController { /** * ThirdParty admin. - * - * @Route("/{_locale}/admin/thirdparty", name="chill_thirdparty_admin_index") */ + #[Route(path: '/{_locale}/admin/thirdparty', name: 'chill_thirdparty_admin_index')] public function indexAdminAction() { return $this->render('@ChillThirdParty/Admin/index.html.twig'); diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 56a2e4dcd..ca910d854 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -92,11 +92,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * [fr] Sigle. * * @ORM\Column(name="acronym", type="string", length=64, nullable=true) - * - * @Assert\Length(min="2") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 2)] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $acronym = ''; /** @@ -112,10 +110,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?Address $address = null; /** @@ -136,10 +133,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}) * - * @Groups({"docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['docgen:read', 'docgen:read:3party:parent'])] private Collection $categories; /** @@ -158,33 +154,29 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * cascade={"persist"}, orphanRemoval=true) * * @var Collection - * - * @Assert\Valid(traverse=true) */ + #[Assert\Valid(traverse: true)] private Collection $children; /** * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?Civility $civility = null; /** * @ORM\Column(name="comment", type="text", nullable=true) - * - * @Groups({"read", "write"}) */ + #[Groups(['read', 'write'])] private ?string $comment = null; /** * @ORM\Column(name="contact_data_anonymous", type="boolean", options={"default": false}) - * - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] private bool $contactDataAnonymous = false; /** @@ -201,18 +193,15 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin /** * @ORM\Column(name="email", type="string", length=255, nullable=true) - * - * @Assert\Email() - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Email] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $email = null; /** * @ORM\Column(name="firstname", type="text", options={"default": ""}) - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $firstname = ''; /** @@ -221,40 +210,32 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * @ORM\Id * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] private ?int $id = null; /** * @ORM\Column(name="kind", type="string", length="20", options={"default": ""}) - * - * @Groups({"write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['write', 'docgen:read', 'docgen:read:3party:parent'])] private string $kind = ''; /** * @ORM\Column(name="name", type="string", length=255) - * - * @Assert\Length(min="2") - * - * @Assert\NotNull - * - * @Assert\NotBlank - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 2)] + #[Assert\NotNull] + #[Assert\NotBlank] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private string $name = ''; /** * [fr] Raison sociale. * * @ORM\Column(name="name_company", type="string", length=255, nullable=true) - * - * @Assert\Length(min="3") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 3)] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $nameCompany = ''; /** @@ -264,10 +245,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * - * @Groups({"read", "write", "docgen:read"}) - * * @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private ?ThirdParty $parent = null; /** @@ -275,19 +255,17 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\Column(name="profession", type="text", nullable=false) * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private string $profession = ''; /** * @ORM\Column(name="telephone", type="phone_number", nullable=true) * * @PhonenumberConstraint(type="any") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?PhoneNumber $telephone = null; /** @@ -546,9 +524,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin return $this->updatedBy; } - /** - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) - */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] public function isChild(): bool { return null !== $this->parent; diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php index 7bd8f9f7b..8d29ab620 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php @@ -33,16 +33,14 @@ class ThirdPartyCategory * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php index 8994543c2..87d9d046c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php @@ -19,17 +19,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Table(name="chill_3party.party_profession") * * @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "third_party_profession": ThirdPartyProfession::class}) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['third_party_profession' => ThirdPartyProfession::class])] class ThirdPartyProfession { /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** @@ -38,16 +35,14 @@ class ThirdPartyProfession * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read", "read", "write"}) */ + #[Serializer\Groups(['docgen:read', 'read', 'write'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"docgen:read", "read"}) */ + #[Serializer\Groups(['docgen:read', 'read'])] private array $name = []; public function getActive(): ?bool From 72016e1a21edfb0e98a3979bf9f2cd54f138e3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 5 Apr 2024 00:01:30 +0200 Subject: [PATCH 084/251] Apply rector rules: add annotation for doctrine mapping --- rector.php | 1 + .../ChillActivityBundle/Entity/Activity.php | 100 +++----- .../Entity/ActivityPresence.php | 24 +- .../Entity/ActivityReason.php | 31 +-- .../Entity/ActivityReasonCategory.php | 29 +-- .../Entity/ActivityType.php | 188 ++++----------- .../Entity/ActivityTypeCategory.php | 34 +-- .../src/Entity/AsideActivity.php | 75 ++---- .../src/Entity/AsideActivityCategory.php | 42 ++-- .../Entity/AbstractElement.php | 35 +-- .../ChillBudgetBundle/Entity/Charge.php | 27 +-- .../ChillBudgetBundle/Entity/ChargeKind.php | 38 +-- .../ChillBudgetBundle/Entity/Resource.php | 23 +- .../ChillBudgetBundle/Entity/ResourceKind.php | 43 ++-- .../ChillCalendarBundle/Entity/Calendar.php | 108 +++------ .../Entity/CalendarDoc.php | 45 ++-- .../Entity/CalendarRange.php | 47 ++-- .../Entity/CancelReason.php | 31 +-- .../ChillCalendarBundle/Entity/Invite.php | 35 +-- .../Entity/RemoteCalendarTrait.php | 8 +- .../Entity/CustomField.php | 50 ++-- .../Entity/CustomFieldLongChoice/Option.php | 50 ++-- .../Entity/CustomFieldsDefaultGroup.php | 32 +-- .../Entity/CustomFieldsGroup.php | 32 +-- .../Entity/DocGeneratorTemplate.php | 44 ++-- .../Entity/AccompanyingCourseDocument.php | 27 +-- .../ChillDocStoreBundle/Entity/Document.php | 44 +--- .../Entity/DocumentCategory.php | 23 +- .../Entity/PersonDocument.php | 26 +- .../Entity/StoredObject.php | 62 ++--- .../Controller/EventController.php | 25 +- .../Controller/ParticipationController.php | 4 - src/Bundle/ChillEventBundle/Entity/Event.php | 66 ++--- .../ChillEventBundle/Entity/EventType.php | 34 +-- .../ChillEventBundle/Entity/Participation.php | 44 ++-- src/Bundle/ChillEventBundle/Entity/Role.php | 30 +-- src/Bundle/ChillEventBundle/Entity/Status.php | 30 +-- .../Controller/ExportController.php | 5 +- .../Controller/LoginController.php | 4 +- .../Controller/PasswordController.php | 2 - .../Doctrine/Model/TrackCreationTrait.php | 12 +- .../Doctrine/Model/TrackUpdateTrait.php | 12 +- src/Bundle/ChillMainBundle/Entity/Address.php | 94 +++----- .../Entity/AddressReference.php | 73 ++---- src/Bundle/ChillMainBundle/Entity/Center.php | 36 +-- .../ChillMainBundle/Entity/Civility.php | 33 +-- src/Bundle/ChillMainBundle/Entity/Country.php | 24 +- .../Entity/CronJobExecution.php | 32 +-- .../Entity/DashboardConfigItem.php | 35 +-- .../Entity/Embeddable/CommentEmbeddable.php | 15 +- .../Embeddable/PrivateCommentEmbeddable.php | 7 +- .../Entity/GeographicalUnit.php | 39 +-- .../Entity/GeographicalUnitLayer.php | 34 +-- .../ChillMainBundle/Entity/GroupCenter.php | 49 ++-- .../ChillMainBundle/Entity/Language.php | 18 +- .../ChillMainBundle/Entity/Location.php | 73 ++---- .../ChillMainBundle/Entity/LocationType.php | 46 ++-- .../ChillMainBundle/Entity/NewsItem.php | 35 +-- .../ChillMainBundle/Entity/Notification.php | 88 +++---- .../Entity/NotificationComment.php | 65 ++--- .../Entity/PermissionsGroup.php | 42 +--- .../ChillMainBundle/Entity/PostalCode.php | 70 ++---- .../ChillMainBundle/Entity/Regroupment.php | 34 +-- .../ChillMainBundle/Entity/RoleScope.php | 44 ++-- .../ChillMainBundle/Entity/SavedExport.php | 39 +-- src/Bundle/ChillMainBundle/Entity/Scope.php | 34 +-- src/Bundle/ChillMainBundle/Entity/User.php | 100 +++----- .../Entity/User/UserJobHistory.php | 35 +-- .../Entity/User/UserScopeHistory.php | 35 +-- src/Bundle/ChillMainBundle/Entity/UserJob.php | 25 +- .../Entity/Workflow/EntityWorkflow.php | 42 ++-- .../Entity/Workflow/EntityWorkflowComment.php | 27 +-- .../Entity/Workflow/EntityWorkflowStep.php | 79 ++---- .../Tests/Export/SortExportElementTest.php | 2 +- .../Entity/AccompanyingPeriod.php | 203 +++++----------- .../AccompanyingPeriodInfo.php | 27 +-- .../AccompanyingPeriodLocationHistory.php | 39 +-- .../AccompanyingPeriodStepHistory.php | 43 ++-- .../AccompanyingPeriodWork.php | 119 +++------ .../AccompanyingPeriodWorkEvaluation.php | 84 ++----- ...companyingPeriodWorkEvaluationDocument.php | 39 +-- .../AccompanyingPeriodWorkGoal.php | 35 +-- .../AccompanyingPeriodWorkReferrerHistory.php | 33 +-- .../AccompanyingPeriod/ClosingMotive.php | 41 +--- .../Entity/AccompanyingPeriod/Comment.php | 57 ++--- .../Entity/AccompanyingPeriod/Origin.php | 26 +- .../Entity/AccompanyingPeriod/Resource.php | 60 ++--- .../Entity/AccompanyingPeriod/UserHistory.php | 43 ++-- .../AccompanyingPeriodParticipation.php | 39 +-- .../Entity/Household/Household.php | 52 ++-- .../Entity/Household/HouseholdComposition.php | 53 ++-- .../Household/HouseholdCompositionType.php | 28 +-- .../Entity/Household/HouseholdMember.php | 56 ++--- .../Household/PersonHouseholdAddress.php | 45 ++-- .../Entity/Household/Position.php | 34 +-- .../Entity/MaritalStatus.php | 18 +- .../ChillPersonBundle/Entity/Person.php | 228 +++++------------- .../Entity/Person/PersonCenterCurrent.php | 28 +-- .../Entity/Person/PersonCenterHistory.php | 31 +-- .../Entity/Person/PersonCurrentAddress.php | 27 +-- .../Entity/Person/PersonResource.php | 51 ++-- .../Entity/Person/PersonResourceKind.php | 26 +- .../Entity/Person/ResidentialAddress.php | 59 ++--- .../Entity/PersonAltName.php | 30 +-- .../Entity/PersonNotDuplicate.php | 26 +- .../ChillPersonBundle/Entity/PersonPhone.php | 45 +--- .../Entity/Relationships/Relation.php | 29 +-- .../Entity/Relationships/Relationship.php | 65 ++--- .../Entity/SocialWork/Evaluation.php | 44 +--- .../Entity/SocialWork/Goal.php | 33 +-- .../Entity/SocialWork/Result.php | 38 +-- .../Entity/SocialWork/SocialAction.php | 58 ++--- .../Entity/SocialWork/SocialIssue.php | 41 +--- .../ByStepAggregatorTest.php | 2 +- .../ByStepFilterTest.php | 2 +- .../ChillReportBundle/Entity/Report.php | 42 +--- .../ChillTaskBundle/Entity/AbstractTask.php | 47 +--- .../ChillTaskBundle/Entity/RecurringTask.php | 41 +--- .../ChillTaskBundle/Entity/SingleTask.php | 64 ++--- .../Entity/Task/AbstractTaskPlaceEvent.php | 22 +- .../Entity/Task/SingleTaskPlaceEvent.php | 40 +-- .../Entity/ThirdParty.php | 121 +++------- .../Entity/ThirdPartyCategory.php | 27 +-- .../Entity/ThirdPartyProfession.php | 27 +-- 124 files changed, 1724 insertions(+), 3770 deletions(-) diff --git a/rector.php b/rector.php index ec3020ddf..b5d6ad6ef 100644 --- a/rector.php +++ b/rector.php @@ -42,6 +42,7 @@ return static function (RectorConfig $rectorConfig): void { \Rector\Symfony\Set\SymfonySetList::SYMFONY_53, \Rector\Symfony\Set\SymfonySetList::SYMFONY_54, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, + \Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, ]); // migrate for phpunit diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index ec1ae23e2..bac5df2e0 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -44,11 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Activity. * - * @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository") * - * @ORM\Table(name="activity") * - * @ORM\HasLifecycleCallbacks * * @ActivityValidator\ActivityValidity * @@ -59,6 +56,9 @@ use Symfony\Component\Validator\Constraints as Assert; * path="scope") */ #[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])] +#[ORM\Entity(repositoryClass: \Chill\ActivityBundle\Repository\ActivityRepository::class)] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activity')] class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -69,157 +69,121 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac final public const SENTRECEIVED_SENT = 'sent'; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") - */ #[Groups(['read'])] + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class)] private ?AccompanyingPeriod $accompanyingPeriod = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") - * - * @ORM\JoinColumn(name="type_id") - */ + #[Groups(['read', 'docgen:read'])] #[SerializedName('activityType')] + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityType::class)] + #[ORM\JoinColumn(name: 'type_id')] private ActivityType $activityType; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityPresence::class)] private ?ActivityPresence $attendee = null; - /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - */ #[Groups(['docgen:read'])] + #[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'comment_')] private CommentEmbeddable $comment; - /** - * @ORM\Column(type="datetime") - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private \DateTime $date; /** - * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"}) - * * @var Collection */ #[Assert\Valid(traverse: true)] + #[ORM\ManyToMany(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])] private Collection $documents; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTime $durationTime = null; - /** - * @ORM\Column(type="boolean", options={"default": false}) - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $emergency = false; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)] private ?Location $location = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") - */ + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)] private ?Person $person = null; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class)] private Collection $persons; - /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") - */ + #[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')] private PrivateCommentEmbeddable $privateComment; /** - * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") - * * @var Collection */ #[Groups(['docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class)] private Collection $reasons; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)] private ?Scope $scope = null; - /** - * @ORM\Column(type="string", options={"default": ""}) - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, options: ['default' => ''])] private string $sentReceived = ''; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction") * - * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialAction::class)] + #[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialaction')] private Collection $socialActions; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue") * - * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class)] + #[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialissue')] private Collection $socialIssues; /** - * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)] private Collection $thirdParties; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTime $travelTime = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $user = null; /** - * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\User::class)] private Collection $users; public function __construct() diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index 0a558c51b..e89158abd 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -17,35 +17,29 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * Class ActivityPresence. * - * @ORM\Entity * - * @ORM\Table(name="activitytpresence") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytpresence')] class ActivityPresence { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** - * @ORM\Column(type="json") - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index 90d088f6f..6219acb9e 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -16,38 +16,27 @@ use Doctrine\ORM\Mapping as ORM; /** * Class ActivityReason. * - * @ORM\Entity * - * @ORM\Table(name="activityreason") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activityreason')] class ActivityReason { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory", - * inversedBy="reasons") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityReasonCategory::class, inversedBy: 'reasons')] private ?ActivityReasonCategory $category = null; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 64d7f9672..bd0cecf5a 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -18,44 +18,35 @@ use Doctrine\ORM\Mapping as ORM; /** * Class ActivityReasonCategory. * - * @ORM\Entity * - * @ORM\Table(name="activityreasoncategory") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activityreasoncategory')] class ActivityReasonCategory implements \Stringable { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** * @var string - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private $name; /** * Array of ActivityReason. * * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chill\ActivityBundle\Entity\ActivityReason", - * mappedBy="category") */ + #[ORM\OneToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class, mappedBy: 'category')] private Collection $reasons; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 404cda36c..fd9a38c95 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -20,12 +20,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class ActivityType. * - * @ORM\Entity * - * @ORM\Table(name="activitytype") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytype')] class ActivityType { final public const FIELD_INVISIBLE = 0; @@ -36,247 +36,161 @@ class ActivityType /** * @deprecated not in use - * - * @ORM\Column(type="string", nullable=false, options={"default": ""}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $accompanyingPeriodLabel = ''; /** * @deprecated not in use - * - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="boolean") - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $attendeeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $attendeeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityTypeCategory::class)] private ?ActivityTypeCategory $category = null; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $commentLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $commentVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $dateLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $dateVisible = self::FIELD_REQUIRED; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $documentsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $documentsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $durationTimeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $durationTimeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $emergencyLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $emergencyVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $locationLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $locationVisible = self::FIELD_INVISIBLE; /** - * @ORM\Column(type="json") - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ #[Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": "0.0"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])] private float $ordering = 0.0; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $personLabel = ''; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $personsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $personsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $personVisible = self::FIELD_REQUIRED; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $privateCommentLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $privateCommentVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $reasonsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $reasonsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $sentReceivedLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $sentReceivedVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialActionsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialActionsVisible = self::FIELD_INVISIBLE; /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - * * @deprecated not in use */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialDataLabel = ''; /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * * @deprecated not in use */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialDataVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialIssuesLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialIssuesVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $thirdPartiesLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $thirdPartiesVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $travelTimeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $travelTimeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $userLabel = ''; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $usersLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $usersVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $userVisible = self::FIELD_REQUIRED; #[Assert\Callback] diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php index 680a15fa7..d70535bbf 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php @@ -13,37 +13,25 @@ namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="activitytypecategory") - * - * @ORM\HasLifecycleCallbacks - */ + +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytypecategory')] class ActivityTypeCategory { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": "0.0"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])] private float $ordering = 0.0; /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index 02da401bc..ee58f31b7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -18,79 +18,54 @@ use Chill\MainBundle\Entity\Location; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table(schema="chill_asideactivity") - */ + +#[ORM\Entity] +#[ORM\Table(schema: 'chill_asideactivity')] class AsideActivity implements TrackCreationInterface, TrackUpdateInterface { - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=false) - */ + #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: false)] private User $agent; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $createdAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: false)] private User $createdBy; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $date = null; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTimeInterface $duration = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: Location::class)] + #[ORM\JoinColumn(nullable: true)] private ?Location $location = null; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private ?string $note = null; - /** - * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="asideActivities") - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'asideActivities')] + #[ORM\JoinColumn(nullable: false)] private ?AsideActivityCategory $type = null; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] private ?\DateTimeInterface $updatedAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private User $updatedBy; public function getAgent(): ?User diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index e5eb044d9..ebf09e59c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -17,51 +17,37 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; -/** - * @ORM\Entity - * - * @ORM\Table(schema="chill_asideactivity") - */ + +#[ORM\Entity] +#[ORM\Table(schema: 'chill_asideactivity')] class AsideActivityCategory { /** - * @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent") - * * @var Collection */ + #[ORM\OneToMany(targetEntity: AsideActivityCategory::class, mappedBy: 'parent')] private Collection $children; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $isActive = true; private AsideActivityCategory $oldParent; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'children')] + #[ORM\JoinColumn(nullable: true)] private ?AsideActivityCategory $parent = null; - /** - * @ORM\Column(type="json", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255)] private array $title; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php index e57438f0f..a348a0d07 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php +++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php @@ -20,52 +20,33 @@ use Symfony\Component\Validator\Constraints as Assert; /** * AbstractElement. - * - * @ORM\MappedSuperclass */ +#[ORM\MappedSuperclass] abstract class AbstractElement { - /** - * @ORM\Column(name="amount", type="decimal", precision=10, scale=2) - */ #[Assert\GreaterThan(value: 0)] #[Assert\NotNull(message: 'The amount cannot be empty')] + #[ORM\Column(name: 'amount', type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 10, scale: 2)] private string $amount; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private ?string $comment = null; - /** - * @ORM\Column(name="endDate", type="datetime_immutable", nullable=true) - */ #[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")] + #[ORM\Column(name: 'endDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\ManyToOne( - * targetEntity="\Chill\PersonBundle\Entity\Household\Household" - * ) - */ + #[ORM\ManyToOne(targetEntity: Household::class)] private ?Household $household = null; - /** - * @ORM\ManyToOne( - * targetEntity="\Chill\PersonBundle\Entity\Person" - * ) - */ + #[ORM\ManyToOne(targetEntity: Person::class)] private ?Person $person = null; - /** - * @ORM\Column(name="startDate", type="datetime_immutable") - */ #[Assert\Date] + #[ORM\Column(name: 'startDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $startDate; - /** - * @ORM\Column(name="type", type="string", length=255) - */ + #[ORM\Column(name: 'type', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $type = ''; /* Getters and Setters */ diff --git a/src/Bundle/ChillBudgetBundle/Entity/Charge.php b/src/Bundle/ChillBudgetBundle/Entity/Charge.php index d6af5cc1e..5c78398b5 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Charge.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Charge.php @@ -18,10 +18,10 @@ use Doctrine\ORM\Mapping as ORM; /** * Charge. * - * @ORM\Table(name="chill_budget.charge") * - * @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ChargeRepository") */ +#[ORM\Entity(repositoryClass: \Chill\BudgetBundle\Repository\ChargeRepository::class)] +#[ORM\Table(name: 'chill_budget.charge')] class Charge extends AbstractElement implements HasCentersInterface { final public const HELP_ASKED = 'running'; @@ -39,25 +39,18 @@ class Charge extends AbstractElement implements HasCentersInterface self::HELP_NOT_RELEVANT, ]; - /** - * @ORM\ManyToOne(targetEntity=ChargeKind::class, inversedBy="AbstractElement") - * - * @ORM\JoinColumn - */ + + #[ORM\ManyToOne(targetEntity: ChargeKind::class, inversedBy: 'AbstractElement')] + #[ORM\JoinColumn] private ?ChargeKind $charge = null; - /** - * @ORM\Column(name="help", type="string", nullable=true) - */ + #[ORM\Column(name: 'help', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] private ?string $help = self::HELP_NOT_RELEVANT; - /** - * @ORM\Column(name="id", type="integer") - * - * @ORM\Id - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php index 4150d09cc..7d8037802 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php @@ -18,49 +18,35 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Type of charge. * - * @ORM\Table(name="chill_budget.charge_type", - * uniqueConstraints={@ORM\UniqueConstraint(name="charge_kind_unique_type_idx", fields={"kind"})} - * ) * - * @ORM\Entity */ #[UniqueEntity(fields: ['kind'])] +#[ORM\Entity] +#[ORM\Table(name: 'chill_budget.charge_type')] +#[ORM\UniqueConstraint(name: 'charge_kind_unique_type_idx', fields: ['kind'])] class ChargeKind { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", options={"default": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $isActive = true; - /** - * @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false) - */ #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] #[Assert\Length(min: 3)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, options: ['default' => ''], nullable: false)] private string $kind = ''; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillBudgetBundle/Entity/Resource.php b/src/Bundle/ChillBudgetBundle/Entity/Resource.php index c4845ed1b..c482424a8 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Resource.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Resource.php @@ -18,26 +18,21 @@ use Doctrine\ORM\Mapping as ORM; /** * Resource. * - * @ORM\Table(name="chill_budget.resource") * - * @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ResourceRepository") */ +#[ORM\Entity(repositoryClass: \Chill\BudgetBundle\Repository\ResourceRepository::class)] +#[ORM\Table(name: 'chill_budget.resource')] class Resource extends AbstractElement implements HasCentersInterface { - /** - * @ORM\Column(name="id", type="integer") - * - * @ORM\Id - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=ResourceKind::class, inversedBy="AbstractElement") - * - * @ORM\JoinColumn - */ + + #[ORM\ManyToOne(targetEntity: ResourceKind::class, inversedBy: 'AbstractElement')] + #[ORM\JoinColumn] private ?ResourceKind $resource = null; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php index 2e0e360d9..30c1ac3d3 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php @@ -18,52 +18,37 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Type of resource. * - * @ORM\Table(name="chill_budget.resource_type", uniqueConstraints={ * - * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) - * }) - * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) - * }) - * - * @ORM\Entity */ #[UniqueEntity(fields: ['kind'])] +#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])] // @ORM\Entity +#[ORM\Table(name: 'chill_budget.resource_type')] +#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])] +#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])] +#[ORM\Entity] // @ORM\Entity class ResourceKind { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", options={"default": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $isActive = true; - /** - * @ORM\Column(type="string", length=255, nullable=false, options={"default": ""}) - */ #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] #[Assert\Length(min: 3)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])] private string $kind = ''; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 38a7e29f0..ee148820e 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -36,15 +36,11 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Mapping\ClassMetadata; -/** - * @ORM\Table( - * name="chill_calendar.calendar", - * uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})} - * ) - * - * @ORM\Entity - */ + #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])] +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.calendar')] +#[ORM\UniqueConstraint(name: 'idx_calendar_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])] class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface { use RemoteCalendarTrait; @@ -86,105 +82,75 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente public ?User $previousMainUser = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars") - */ #[Serializer\Groups(['calendar:read', 'read'])] + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'calendars')] private ?AccompanyingPeriod $accompanyingPeriod = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\Activity::class)] private ?Activity $activity = null; - /** - * @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar") - */ #[Serializer\Groups(['calendar:read', 'read'])] + #[ORM\OneToOne(targetEntity: \CalendarRange::class, inversedBy: 'calendar')] private ?CalendarRange $calendarRange = null; - /** - * @ORM\ManyToOne(targetEntity="CancelReason") - */ + #[ORM\ManyToOne(targetEntity: \CancelReason::class)] private ?CancelReason $cancelReason = null; - /** - * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") - */ #[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])] + #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')] private CommentEmbeddable $comment; - /** - * @ORM\Column(type="integer", nullable=false, options={"default": 0}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])] private int $dateTimeVersion = 0; /** * @var Collection - * - * @ORM\OneToMany(targetEntity=CalendarDoc::class, mappedBy="calendar", orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: CalendarDoc::class, mappedBy: 'calendar', orphanRemoval: true)] private Collection $documents; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.An end date is required')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; /** - * @ORM\OneToMany( - * targetEntity=Invite::class, - * mappedBy="calendar", - * orphanRemoval=true, - * cascade={"persist", "remove", "merge", "detach"} - * ) * - * @ORM\JoinTable(name="chill_calendar.calendar_to_invites") * * @var Collection&Selectable */ #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\OneToMany(targetEntity: Invite::class, mappedBy: 'calendar', orphanRemoval: true, cascade: ['persist', 'remove', 'merge', 'detach'])] + #[ORM\JoinTable(name: 'chill_calendar.calendar_to_invites')] private Collection&Selectable $invites; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - */ #[Serializer\Groups(['read', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A location is required')] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)] private ?Location $location = null; /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A main user is mandatory')] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $mainUser = null; - /** - * @ORM\ManyToOne(targetEntity=Person::class) - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: Person::class)] + #[ORM\JoinColumn(nullable: true)] private ?Person $person = null; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars") * - * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @@ -192,58 +158,50 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')] + #[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class, inversedBy: 'calendars')] + #[ORM\JoinTable(name: 'chill_calendar.calendar_to_persons')] private Collection $persons; - /** - * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_") - */ #[Serializer\Groups(['calendar:read'])] + #[ORM\Embedded(class: PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')] private PrivateCommentEmbeddable $privateComment; /** * @var Collection * - * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)] + #[ORM\JoinTable(name: 'chill_calendar.calendar_to_thirdparties')] private Collection $professionals; - /** - * @ORM\Column(type="boolean", nullable=true) - */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private ?bool $sendSMS = false; - /** - * @ORM\Column(type="text", nullable=false, options={"default": Calendar::SMS_PENDING}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => Calendar::SMS_PENDING])] private string $smsStatus = self::SMS_PENDING; /** - * @ORM\Column(type="datetime_immutable", nullable=false) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A start date is required')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; /** - * @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => 'valid'])] private string $status = self::STATUS_VALID; - /** - * @ORM\Column(type="boolean", nullable=true) - */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private ?bool $urgent = false; public function __construct() diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php index 5ea958fab..00493787b 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php @@ -20,50 +20,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table( - * name="chill_calendar.calendar_doc", - * ) - */ + +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.calendar_doc')] class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; use TrackUpdateTrait; - /** - * @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="documents") - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'documents')] + #[ORM\JoinColumn(nullable: false)] private Calendar $calendar; - /** - * @ORM\Column(type="integer", nullable=false, options={"default": 0}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])] private int $datetimeVersion = 0; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", nullable=false, options={"default": false}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])] private bool $trackDateTimeVersion = false; - public function __construct(Calendar $calendar, /** - * @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}) - * - * @ORM\JoinColumn(nullable=false) - */ + public function __construct(Calendar $calendar, + #[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])] + #[ORM\JoinColumn(nullable: false)] private ?StoredObject $storedObject) { $this->setCalendar($calendar); diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index 3e2cf1eb0..633a5c1f8 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -21,14 +21,10 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="chill_calendar.calendar_range", - * uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_range_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})} - * ) - * - * @ORM\Entity - */ + +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.calendar_range')] +#[ORM\UniqueConstraint(name: 'idx_calendar_range_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])] class CalendarRange implements TrackCreationInterface, TrackUpdateInterface { use RemoteCalendarTrait; @@ -37,49 +33,36 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface use TrackUpdateTrait; - /** - * @ORM\OneToOne(targetEntity=Calendar::class, mappedBy="calendarRange") - */ + #[ORM\OneToOne(targetEntity: Calendar::class, mappedBy: 'calendarRange')] private ?Calendar $calendar = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[Groups(['read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - * - * @ORM\JoinColumn(nullable=false) - */ + #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: Location::class)] + #[ORM\JoinColumn(nullable: false)] private ?Location $location = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php index cff54e70b..75fb311fe 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php @@ -14,11 +14,9 @@ namespace Chill\CalendarBundle\Entity; use Chill\CalendarBundle\Repository\CancelReasonRepository; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="chill_calendar.cancel_reason") - * - * @ORM\Entity(repositoryClass=CancelReasonRepository::class) - */ + +#[ORM\Entity(repositoryClass: CancelReasonRepository::class)] +#[ORM\Table(name: 'chill_calendar.cancel_reason')] class CancelReason { final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT'; @@ -27,28 +25,19 @@ class CancelReason final public const CANCELEDBY_USER = 'CANCELEDBY_USER'; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private ?bool $active = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $canceledBy = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php index 40024c52d..25da8fcd3 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php @@ -25,13 +25,11 @@ use Symfony\Component\Serializer\Annotation as Serializer; * The event/calendar in the user may have a different id than the mainUser. We add then fields to store the * remote id of this event in the remote calendar. * - * @ORM\Table( - * name="chill_calendar.invite", - * uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_invite_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})} - * ) * - * @ORM\Entity */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.invite')] +#[ORM\UniqueConstraint(name: 'idx_calendar_invite_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])] class Invite implements TrackUpdateInterface, TrackCreationInterface { use RemoteCalendarTrait; @@ -58,33 +56,24 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface final public const TENTATIVELY_ACCEPTED = 'tentative'; - /** - * @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites") - */ + #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'invites')] private ?Calendar $calendar = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[Serializer\Groups(groups: ['calendar:read', 'read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": "pending"}) - */ #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => 'pending'])] private string $status = self::PENDING; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @ORM\JoinColumn(nullable=false) - */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] + #[ORM\JoinColumn(nullable: false)] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php b/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php index 31282fb0b..b02875eed 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php +++ b/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php @@ -30,14 +30,10 @@ trait RemoteCalendarTrait */ public bool $preventEnqueueChanges = false; - /** - * @ORM\Column(type="json", options={"default": "[]"}, nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]'], nullable: false)] private array $remoteAttributes = []; - /** - * @ORM\Column(type="text", options={"default": ""}, nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)] private string $remoteId = ''; public function addRemoteAttributes(array $remoteAttributes): self diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index 6d1373fb0..fa60f6b91 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -16,69 +16,49 @@ use Doctrine\ORM\Mapping as ORM; /** * CustomField. * - * @ORM\Entity * - * @ORM\Table(name="customfield") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'customfield')] class CustomField { final public const ONE_TO_MANY = 2; final public const ONE_TO_ONE = 1; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup", - * inversedBy="customFields") - */ + #[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class, inversedBy: 'customFields')] private ?CustomFieldsGroup $customFieldGroup = null; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** * @var array - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private $name; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $options = []; - /** - * @ORM\Column(type="float") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] private ?float $ordering = null; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private false $required = false; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $slug = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $type = null; /** diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index 2d9889066..8afd96f81 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -15,61 +15,41 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity( - * repositoryClass="Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository") - * - * @ORM\Table(name="custom_field_long_choice_options") - */ + +#[ORM\Entity(repositoryClass: \Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository::class)] +#[ORM\Table(name: 'custom_field_long_choice_options')] class Option { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; /** * @var Collection