From e3559774fd22d167d8bfa670fe2ffe00ca661670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 3 Oct 2023 21:25:22 +0200 Subject: [PATCH 1/3] Improve the signature definition --- .../ChillMainBundle/CRUD/Controller/CRUDController.php | 5 +---- .../ChillMainBundle/Test/Export/AbstractAggregatorTest.php | 2 +- .../AccompanyingPeriodACLAwareRepositoryInterface.php | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 1b9778bed..c23b2b536 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -863,11 +863,8 @@ class CRUDController extends AbstractController * * save-and-close: return to index of current crud ; * * save-and-new: return to new page of current crud ; * * save-and-view: return to view page of current crud ; - * - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - protected function onBeforeRedirectAfterSubmission(string $action, mixed $entity, FormInterface $form, Request $request) + protected function onBeforeRedirectAfterSubmission(string $action, mixed $entity, FormInterface $form, Request $request): ?Response { $next = $request->request->get('submit', 'save-and-close'); diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index 1bdb27b7f..70df849cc 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -167,7 +167,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase * * This method is executed before the `setUp` method. * - * @return \Doctrine\DBAL\Query\QueryBuilder[] + * @return QueryBuilder[] */ abstract public function getQueryBuilders(); diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php index 7b31887b9..3baaf1517 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Repository; +use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\PostalCode; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; @@ -23,6 +24,7 @@ interface AccompanyingPeriodACLAwareRepositoryInterface /** * @param array|UserJob[] $jobs * @param array|Scope[] $services + * @param array|Location[] $administrativeLocations */ public function countByUnDispatched(array $jobs, array $services, array $administrativeLocations): int; @@ -45,7 +47,7 @@ interface AccompanyingPeriodACLAwareRepositoryInterface /** * @param array|UserJob[] $jobs if empty, does not take this argument into account * @param array|Scope[] $services if empty, does not take this argument into account - * + * @param array|Location[] $administrativeLocations * @return list */ public function findByUnDispatched(array $jobs, array $services, array $administrativeAdministrativeLocations, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; From 58e189ee07de54d43e237032140d39e8325be517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 4 Oct 2023 11:21:39 +0200 Subject: [PATCH 2/3] Improve type declaration --- .../Repository/UserACLAwareRepositoryInterface.php | 2 +- .../Security/Resolver/ScopeResolverDispatcher.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php index 6a51a9c0a..28ada8b69 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php @@ -20,7 +20,7 @@ interface UserACLAwareRepositoryInterface /** * Find the users reaching the given center and scope, for the given role. * - * @param array|Center|Center[] $center + * @param array|Center|Center[]|null $center * @param array|Scope|Scope[]|null $scope * @param bool $onlyActive true if get only active users * diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index afec7c6ad..93dec24da 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -32,6 +32,11 @@ final readonly class ScopeResolverDispatcher return false; } + /** + * @param mixed $entity + * @param array|null $options + * @return iterable|Scope|null + */ public function resolveScope(mixed $entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|null { foreach ($this->resolvers as $resolver) { From 4e13b2ae3a3e7cf275cfa157352123e824327079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Oct 2023 11:17:42 +0200 Subject: [PATCH 3/3] fix type-hints --- .../CRUD/Controller/EntityPersonCRUDController.php | 5 ++--- .../AccompanyingPeriodACLAwareRepositoryInterface.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php index 398114363..1ed8f3a58 100644 --- a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php +++ b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php @@ -17,6 +17,7 @@ use Doctrine\ORM\QueryBuilder; use Exception; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use function array_merge; /** @@ -143,10 +144,8 @@ class EntityPersonCRUDController extends CRUDController /** * @param mixed $entity - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - protected function onBeforeRedirectAfterSubmission(string $action, $entity, \Symfony\Component\Form\FormInterface $form, Request $request) + protected function onBeforeRedirectAfterSubmission(string $action, $entity, \Symfony\Component\Form\FormInterface $form, Request $request): ?Response { $next = $request->request->get('submit', 'save-and-close'); diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php index 3baaf1517..5e5f62ca3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php @@ -50,7 +50,7 @@ interface AccompanyingPeriodACLAwareRepositoryInterface * @param array|Location[] $administrativeLocations * @return list */ - public function findByUnDispatched(array $jobs, array $services, array $administrativeAdministrativeLocations, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; + public function findByUnDispatched(array $jobs, array $services, array $administrativeLocations, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; /** * @param array|PostalCode[] $postalCodes