Symfony 6.4 update (#590)
* symfony 6.3: removed sensio/framework-extra-bundle * symfony 6.3: update * Symfony 6.3.1 update * chore: composer up * symfony 6.4 update * cs: php-code-fixer update * fix composer.lock * add php-http required dependencies * Fix Stan and CS --------- Co-authored-by: Jérôme Tanghe <jerome.tanghe@les-tilleuls.coop>
This commit is contained in:
parent
bef9d299c0
commit
32d91e49a0
141 changed files with 4178 additions and 3165 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"type": "project",
|
||||
"license": "MIT",
|
||||
"description": "APES : Platforme d'échange de services et de biens",
|
||||
"minimum-stability": "stable",
|
||||
"minimum-stability": "beta",
|
||||
"prefer-stable": true,
|
||||
"repositories": {
|
||||
"coopTilleuls/payum-mollie": {
|
||||
|
|
@ -44,51 +44,52 @@
|
|||
"odolbeau/phone-number-bundle": "^3.9",
|
||||
"payum/offline": "^1.7",
|
||||
"payum/payum-bundle": "^2.5",
|
||||
"php-http/message": "^1.16",
|
||||
"php-http/message-factory": "^1.1",
|
||||
"phpdocumentor/reflection-docblock": "^5.3",
|
||||
"phpstan/phpdoc-parser": "^1.11",
|
||||
"sensio/framework-extra-bundle": "^6.2",
|
||||
"snc/redis-bundle": "^4.3",
|
||||
"stof/doctrine-extensions-bundle": "^1.7",
|
||||
"symfony/asset": "6.2.*",
|
||||
"symfony/cache": "6.2.*",
|
||||
"symfony/clock": "6.2.*",
|
||||
"symfony/console": "6.2.*",
|
||||
"symfony/doctrine-messenger": "6.2.*",
|
||||
"symfony/dotenv": "6.2.*",
|
||||
"symfony/expression-language": "6.2.*",
|
||||
"symfony/fake-sms-notifier": "6.2.*",
|
||||
"symfony/asset": "6.4.*",
|
||||
"symfony/cache": "6.4.*",
|
||||
"symfony/clock": "6.4.*",
|
||||
"symfony/console": "6.4.*",
|
||||
"symfony/doctrine-messenger": "6.4.*",
|
||||
"symfony/dotenv": "6.4.*",
|
||||
"symfony/expression-language": "6.4.*",
|
||||
"symfony/fake-sms-notifier": "6.4.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/form": "6.2.*",
|
||||
"symfony/framework-bundle": "6.2.*",
|
||||
"symfony/google-mailer": "6.2.*",
|
||||
"symfony/html-sanitizer": "6.2.*",
|
||||
"symfony/http-client": "6.2.*",
|
||||
"symfony/mailer": "6.2.*",
|
||||
"symfony/form": "6.4.*",
|
||||
"symfony/framework-bundle": "6.4.*",
|
||||
"symfony/google-mailer": "6.4.*",
|
||||
"symfony/html-sanitizer": "6.4.*",
|
||||
"symfony/http-client": "6.4.*",
|
||||
"symfony/mailer": "6.4.*",
|
||||
"symfony/mercure-bundle": "^0.3.5",
|
||||
"symfony/messenger": "6.2.*",
|
||||
"symfony/mime": "6.2.*",
|
||||
"symfony/messenger": "6.4.*",
|
||||
"symfony/mime": "6.4.*",
|
||||
"symfony/monolog-bundle": "^3.8",
|
||||
"symfony/notifier": "6.2.*",
|
||||
"symfony/ovh-cloud-notifier": "6.2.*",
|
||||
"symfony/property-access": "6.2.*",
|
||||
"symfony/property-info": "6.2.*",
|
||||
"symfony/proxy-manager-bridge": "6.2.*",
|
||||
"symfony/rate-limiter": "6.2.*",
|
||||
"symfony/notifier": "6.4.*",
|
||||
"symfony/ovh-cloud-notifier": "6.4.*",
|
||||
"symfony/property-access": "6.4.*",
|
||||
"symfony/property-info": "6.4.*",
|
||||
"symfony/proxy-manager-bridge": "6.4.*",
|
||||
"symfony/rate-limiter": "6.4.*",
|
||||
"symfony/requirements-checker": "^2.0",
|
||||
"symfony/runtime": "6.2.*",
|
||||
"symfony/security-bundle": "6.2.*",
|
||||
"symfony/serializer": "6.2.*",
|
||||
"symfony/runtime": "6.4.*",
|
||||
"symfony/security-bundle": "6.4.*",
|
||||
"symfony/serializer": "6.4.*",
|
||||
"symfony/stimulus-bundle": "^2.14",
|
||||
"symfony/translation-contracts": "^3.2",
|
||||
"symfony/twig-bridge": "6.2.*",
|
||||
"symfony/twig-bundle": "6.2.*",
|
||||
"symfony/twilio-notifier": "6.2.*",
|
||||
"symfony/uid": "6.2.*",
|
||||
"symfony/twig-bridge": "6.4.*",
|
||||
"symfony/twig-bundle": "6.4.*",
|
||||
"symfony/twilio-notifier": "6.4.*",
|
||||
"symfony/uid": "6.4.*",
|
||||
"symfony/ux-autocomplete": "^2.7",
|
||||
"symfony/validator": "6.2.*",
|
||||
"symfony/validator": "6.4.*",
|
||||
"symfony/webpack-encore-bundle": "^1.16",
|
||||
"symfony/workflow": "6.2.*",
|
||||
"symfony/yaml": "6.2.*",
|
||||
"symfony/workflow": "6.4.*",
|
||||
"symfony/yaml": "6.4.*",
|
||||
"twig/cssinliner-extra": "^3.4",
|
||||
"twig/extra-bundle": "^3.4",
|
||||
"twig/inky-extra": "^3.4",
|
||||
|
|
@ -152,7 +153,7 @@
|
|||
"extra": {
|
||||
"symfony": {
|
||||
"allow-contrib": false,
|
||||
"require": "6.2.*",
|
||||
"require": "6.4.*",
|
||||
"docker": true
|
||||
}
|
||||
},
|
||||
|
|
@ -169,13 +170,13 @@
|
|||
"phpunit/phpunit": "^9.5",
|
||||
"rector/rector": "^0.14.5",
|
||||
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
|
||||
"symfony/browser-kit": "6.2.*",
|
||||
"symfony/css-selector": "6.2.*",
|
||||
"symfony/debug-bundle": "6.2.*",
|
||||
"symfony/browser-kit": "6.4.*",
|
||||
"symfony/css-selector": "6.4.*",
|
||||
"symfony/debug-bundle": "6.4.*",
|
||||
"symfony/maker-bundle": "^1.47",
|
||||
"symfony/panther": "^2.0",
|
||||
"symfony/phpunit-bridge": "^6.1",
|
||||
"symfony/web-profiler-bundle": "6.2.*",
|
||||
"symfony/web-profiler-bundle": "6.4.*",
|
||||
"zenstruck/messenger-test": "^1.5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6621
composer.lock
generated
6621
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -28,7 +28,6 @@ return [
|
|||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
|
||||
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
|
||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
||||
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
|
||||
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
|
||||
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# https://stackoverflow.com/q/69809320/633864
|
||||
sensio_framework_extra:
|
||||
router:
|
||||
annotations: false
|
||||
request:
|
||||
converters: false
|
||||
auto_convert: false
|
||||
|
|
@ -69,7 +69,7 @@ final class EndMembershipCommand extends Command
|
|||
/** @var UserGroup $userGroup */
|
||||
$user = $userGroup->getUser();
|
||||
$group = $userGroup->getGroup();
|
||||
$io->comment(sprintf(' > deleting membership for %s of %s (%s) (%s)',
|
||||
$io->comment(\sprintf(' > deleting membership for %s of %s (%s) (%s)',
|
||||
$group->getName(),
|
||||
$user->getDisplayName(),
|
||||
$userGroup->getMembership()->value,
|
||||
|
|
@ -88,7 +88,7 @@ final class EndMembershipCommand extends Command
|
|||
++$count;
|
||||
}
|
||||
|
||||
$io->note(sprintf(' > %d deletion(s) done.', $count));
|
||||
$io->note(\sprintf(' > %d deletion(s) done.', $count));
|
||||
$this->memoryReport($io);
|
||||
$this->done($io);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
|||
$days = $input->getArgument('days');
|
||||
$days = max(1, (int) $days);
|
||||
|
||||
$io->section(sprintf('Getting membership expiring in %d days...', $days));
|
||||
$io->section(\sprintf('Getting membership expiring in %d days...', $days));
|
||||
$query = $this->userGroupRepository->getExpiring($days);
|
||||
$io->section('Sending notificaitons...');
|
||||
$count = 0;
|
||||
|
|
@ -72,7 +72,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
|||
/** @var UserGroup $userGroup */
|
||||
$user = $userGroup->getUser();
|
||||
$group = $userGroup->getGroup();
|
||||
$io->comment(sprintf(' > notifying membership for %s of %s/%s (%s) (%s)',
|
||||
$io->comment(\sprintf(' > notifying membership for %s of %s/%s (%s) (%s)',
|
||||
$group->getName(),
|
||||
$user->getDisplayName(),
|
||||
$userGroup->getEndAt()?->format('Y-m-d'),
|
||||
|
|
@ -88,7 +88,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
|||
++$count;
|
||||
}
|
||||
|
||||
$io->note(sprintf(' > %d notification(s) sent.', $count));
|
||||
$io->note(\sprintf(' > %d notification(s) sent.', $count));
|
||||
|
||||
$this->memoryReport($io);
|
||||
$this->done($io);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ final class NotifyServiceRequestDatesCommand extends Command
|
|||
$serviceRequest->getStartAt() :
|
||||
$serviceRequest->getEndAt()
|
||||
;
|
||||
$io->comment(sprintf(' > notifying owner and recipient for service request %s (%s) starting on %s.',
|
||||
$io->comment(\sprintf(' > notifying owner and recipient for service request %s (%s) starting on %s.',
|
||||
$serviceRequest->getId(),
|
||||
$serviceRequest->getStatus()->value,
|
||||
$referenceDate->format('Y-m-d')
|
||||
|
|
@ -106,7 +106,7 @@ final class NotifyServiceRequestDatesCommand extends Command
|
|||
++$count;
|
||||
}
|
||||
|
||||
$io->note(sprintf(' > %d notification(s) sent.', $count * 2)); // owner and recipient
|
||||
$io->note(\sprintf(' > %d notification(s) sent.', $count * 2)); // owner and recipient
|
||||
|
||||
$this->memoryReport($io);
|
||||
$this->done($io);
|
||||
|
|
|
|||
|
|
@ -22,15 +22,18 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
|||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* All /admin routes are protected at the security.yaml level.
|
||||
* ROLE_ADMIN inherits the ROLE_GROUP_ADMIN role.
|
||||
*
|
||||
* @see security.yaml
|
||||
*/
|
||||
#[Security("is_granted('".User::ROLE_ADMIN."') or is_granted('".User::ROLE_GROUP_ADMIN."')")]
|
||||
#[IsGranted(User::ROLE_GROUP_ADMIN)]
|
||||
final class DashboardController extends AbstractDashboardController
|
||||
{
|
||||
public const DOMAIN = 'admin';
|
||||
|
|
@ -60,7 +63,7 @@ final class DashboardController extends AbstractDashboardController
|
|||
private readonly AdminUrlGenerator $adminUrlGenerator,
|
||||
private readonly AuthorizationChecker $authorizationChecker,
|
||||
private readonly UserRepository $userRepository,
|
||||
private readonly ServiceRequestRepository $requestRepository
|
||||
private readonly ServiceRequestRepository $requestRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ final class GroupCrudController extends AbstractCrudController implements GroupA
|
|||
private readonly TranslatorInterface $translator,
|
||||
private readonly FilterFactory $filterFactory,
|
||||
private readonly SluggerInterface $slugger,
|
||||
private readonly ConfigurationRepository $configurationRepository
|
||||
private readonly ConfigurationRepository $configurationRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ final class GroupCrudController extends AbstractCrudController implements GroupA
|
|||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$qb->andWhere(sprintf('%s.id IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
$qb->andWhere(\sprintf('%s.id IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||
|
||||
return $qb;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ final class GroupOfferCrudController extends AbstractCrudController implements G
|
|||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$qb->andWhere(sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
$qb->andWhere(\sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||
|
||||
return $qb;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ final class UserGroupCrudController extends AbstractCrudController implements Gr
|
|||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$qb->andWhere(sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
$qb->andWhere(\sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||
|
||||
return $qb;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ final class CreateGroupAction extends AbstractController
|
|||
) {
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route([
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/groups/create-my-group',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/groupes/creer-mon-groupe',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ trait PaginationTrait
|
|||
*
|
||||
* @implements PaginationInterface<int,Product>
|
||||
*
|
||||
* @return PaginationInterface<int,Product>
|
||||
* @return PaginationInterface<int,mixed>
|
||||
*/
|
||||
private function paginate(SearchResult $searchResult): PaginationInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ final class AddressController extends AbstractController
|
|||
/**
|
||||
* @see UserAddressQueryHandler
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-1',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-1',
|
||||
|
|
@ -75,7 +75,7 @@ final class AddressController extends AbstractController
|
|||
return $this->render('pages/account/address/step1.html.twig', compact('form'));
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-2',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-2',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|||
/**
|
||||
* @see UserGroupControllerTest
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
final class UserGroupController extends AbstractController
|
||||
{
|
||||
use SecurityTrait;
|
||||
|
|
@ -39,7 +39,7 @@ final class UserGroupController extends AbstractController
|
|||
|
||||
public function __construct(
|
||||
private readonly QueryBus $queryBus,
|
||||
private readonly CommandBus $commandBus
|
||||
private readonly CommandBus $commandBus,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class MyAccountAction extends AbstractController
|
|||
) {
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => self::BASE_URL_EN,
|
||||
'fr' => self::BASE_URL_FR,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ final class ProductAvailabilityController extends AbstractController
|
|||
) {
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/my-products/{id}/availabilities',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-produits/{id}/disponibilites',
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|||
/**
|
||||
* @see UserProductsControllerTest
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(name: 'app_user_')]
|
||||
final class UserProductsController extends AbstractController
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ final class UserProductsController extends AbstractController
|
|||
/**
|
||||
* @implements PaginationInterface<int,Product>
|
||||
*
|
||||
* @return PaginationInterface<int,Product>
|
||||
* @return PaginationInterface<int,mixed>
|
||||
*/
|
||||
private function paginate(Query $query, int $page): PaginationInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|||
/**
|
||||
* @see ConversationControllerTest
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
class ConversationController extends AbstractController
|
||||
{
|
||||
use FlashTrait;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ final class MyLendingsAction extends AbstractController
|
|||
) {
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/my-lendings',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-prets',
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class MyLoansAction extends AbstractController
|
|||
) {
|
||||
}
|
||||
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
#[Route(path: [
|
||||
'en' => MyAccountAction::BASE_URL_EN.'/my-loans',
|
||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-emprunts',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use Symfony\Component\Uid\Uuid;
|
|||
/**
|
||||
* @see ServiceRequestControllerTest
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
class ServiceRequestController extends AbstractController
|
||||
{
|
||||
use FlashTrait;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use function Symfony\Component\String\u;
|
|||
/**
|
||||
* @see ServiceRequestStatusWorkflowControllerTest
|
||||
*/
|
||||
#[isGranted(User::ROLE_USER)]
|
||||
#[IsGranted(User::ROLE_USER)]
|
||||
class ServiceRequestStatusWorkflowController extends AbstractController
|
||||
{
|
||||
use FlashTrait;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ trait i18nTrait
|
|||
* Get the i18n prefix of a given class to have a consistent key naming in i18n
|
||||
* files.
|
||||
*/
|
||||
public function getI18nPrefix(string $class = null): string
|
||||
public function getI18nPrefix(?string $class = null): string
|
||||
{
|
||||
$class = $class ?? $this::class;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
final class ValidationProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ValidatorInterface $validator
|
||||
private readonly ValidatorInterface $validator,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ final class ValidationProcessor implements ProcessorInterface
|
|||
/** @var ConstraintViolationList $violations */
|
||||
$violations = $this->validator->validate($object);
|
||||
if ($violations->count() > 0) {
|
||||
$message = sprintf("Error when validating fixture \"%s\", violation(s) detected:\n%s", $id, $violations);
|
||||
$message = \sprintf("Error when validating fixture \"%s\", violation(s) detected:\n%s", $id, $violations);
|
||||
throw new \DomainException($message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use function Symfony\Component\String\u;
|
|||
final class UserListener
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserManager $userManager
|
||||
private readonly UserManager $userManager,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ final class MessageManager
|
|||
ServiceRequest $serviceRequest,
|
||||
string $messageTemplate,
|
||||
array $messageParameters = [],
|
||||
\DateTimeImmutable $createdAt = null,
|
||||
?\DateTimeImmutable $createdAt = null,
|
||||
): Message {
|
||||
$message = (new Message())
|
||||
->setServiceRequest($serviceRequest)
|
||||
|
|
@ -61,7 +61,7 @@ final class MessageManager
|
|||
return $message;
|
||||
}
|
||||
|
||||
public function createFromRecipientMessage(ServiceRequest $serviceRequest, string $message, \DateTimeImmutable $createdAt = null): Message
|
||||
public function createFromRecipientMessage(ServiceRequest $serviceRequest, string $message, ?\DateTimeImmutable $createdAt = null): Message
|
||||
{
|
||||
$message = (new Message())
|
||||
->setServiceRequest($serviceRequest)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class ProductManager
|
|||
try {
|
||||
$this->productStorage->delete($image);
|
||||
} catch (FilesystemException $e) {
|
||||
$this->logger->warning(sprintf('Unable to delete product (%s) image %s: %s', $product->getId(), $image, $e->getMessage()));
|
||||
$this->logger->warning(\sprintf('Unable to delete product (%s) image %s: %s', $product->getId(), $image, $e->getMessage()));
|
||||
}
|
||||
|
||||
$product->deleteImage($image);
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ final class UserManager
|
|||
try {
|
||||
$this->userStorage->delete((string) $user->getAvatar());
|
||||
} catch (FilesystemException $e) {
|
||||
$this->logger->warning(sprintf('Unable to avatar of user (%s) image %s: %s', $user->getId(), $user->getAvatar(), $e->getMessage()));
|
||||
$this->logger->warning(\sprintf('Unable to avatar of user (%s) image %s: %s', $user->getId(), $user->getAvatar(), $e->getMessage()));
|
||||
}
|
||||
$user->deleteAvatar();
|
||||
$this->save($user, true);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use App\Form\Type\Product\SearchFormType;
|
|||
*/
|
||||
final class Search
|
||||
{
|
||||
public function __construct(string $q, int $page = 1, User $user = null)
|
||||
public function __construct(string $q, int $page = 1, ?User $user = null)
|
||||
{
|
||||
$this->q = $q;
|
||||
$this->page = $page;
|
||||
|
|
@ -78,9 +78,9 @@ final class Search
|
|||
*/
|
||||
public function hasProximity(): bool
|
||||
{
|
||||
return $this->hasCity() &&
|
||||
($this->city?->hasLocality() ?? false) &&
|
||||
$this->hasDistance()
|
||||
return $this->hasCity()
|
||||
&& ($this->city?->hasLocality() ?? false)
|
||||
&& $this->hasDistance()
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ trait FieldTrait
|
|||
/**
|
||||
* Render the boolean without switch: ✅ ❌.
|
||||
*/
|
||||
public function getSimpleBooleanField(string $propertyName, string $label = null): BooleanField
|
||||
public function getSimpleBooleanField(string $propertyName, ?string $label = null): BooleanField
|
||||
{
|
||||
return BooleanField::new($propertyName, $label)
|
||||
->renderAsSwitch(false)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ final class EnumFilter implements FilterInterface
|
|||
{
|
||||
use FilterTrait;
|
||||
|
||||
public static function new(string $propertyName, string $formType, string $label = null): self
|
||||
public static function new(string $propertyName, string $formType, ?string $label = null): self
|
||||
{
|
||||
return (new self())
|
||||
->setFilterFqcn(__CLASS__)
|
||||
|
|
@ -32,7 +32,7 @@ final class EnumFilter implements FilterInterface
|
|||
*/
|
||||
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
||||
{
|
||||
$queryBuilder->andWhere(sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||
$queryBuilder->andWhere(\sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||
->setParameter('value', $filterDataDto->getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ final class GroupFilter implements FilterInterface
|
|||
{
|
||||
use FilterTrait;
|
||||
|
||||
public static function new(string $propertyName, string $label = null): self
|
||||
public static function new(string $propertyName, ?string $label = null): self
|
||||
{
|
||||
return (new self())
|
||||
->setFilterFqcn(__CLASS__)
|
||||
|
|
@ -37,7 +37,7 @@ final class GroupFilter implements FilterInterface
|
|||
/** @var Group $group */
|
||||
$group = $filterDataDto->getValue();
|
||||
$queryBuilder
|
||||
->innerJoin(sprintf('%s.userGroups', $filterDataDto->getEntityAlias()), 'ug')
|
||||
->innerJoin(\sprintf('%s.userGroups', $filterDataDto->getEntityAlias()), 'ug')
|
||||
->andWhere('ug.group = :group')
|
||||
->setParameter(':group', $group->getId())
|
||||
;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ final class MyUsersFilter implements FilterInterface
|
|||
{
|
||||
use FilterTrait;
|
||||
|
||||
public static function new(string $propertyName, string $label = null): self
|
||||
public static function new(string $propertyName, ?string $label = null): self
|
||||
{
|
||||
return (new self())
|
||||
->setFilterFqcn(__CLASS__)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ final class MyGroupFilter implements FilterInterface
|
|||
{
|
||||
use FilterTrait;
|
||||
|
||||
public static function new(string $propertyName, string $label = null): self
|
||||
public static function new(string $propertyName, ?string $label = null): self
|
||||
{
|
||||
return (new self())
|
||||
->setFilterFqcn(__CLASS__)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ final class UuidFilter implements FilterInterface
|
|||
{
|
||||
use FilterTrait;
|
||||
|
||||
public static function new(string $propertyName, string $label = null): self
|
||||
public static function new(string $propertyName, ?string $label = null): self
|
||||
{
|
||||
return (new self())
|
||||
->setFilterFqcn(__CLASS__)
|
||||
|
|
@ -37,7 +37,7 @@ final class UuidFilter implements FilterInterface
|
|||
*/
|
||||
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
||||
{
|
||||
$queryBuilder->andWhere(sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||
$queryBuilder->andWhere(\sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||
->setParameter('value', $filterDataDto->getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class GroupType extends AbstractType
|
|||
{
|
||||
public function __construct(
|
||||
private readonly Security $security,
|
||||
private readonly AuthorizationChecker $authorizationChecker
|
||||
private readonly AuthorizationChecker $authorizationChecker,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class UserType extends AbstractType
|
|||
{
|
||||
public function __construct(
|
||||
private readonly Security $security,
|
||||
private readonly AuthorizationChecker $authorizationChecker
|
||||
private readonly AuthorizationChecker $authorizationChecker,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class Address implements \Stringable
|
|||
* OpenStreetMap identifier, usefull to create link to maps.
|
||||
*/
|
||||
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
||||
private int $osmId;
|
||||
private string $osmId;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
|
@ -340,12 +340,12 @@ class Address implements \Stringable
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getOsmId(): int
|
||||
public function getOsmId(): string
|
||||
{
|
||||
return $this->osmId;
|
||||
}
|
||||
|
||||
public function setOsmId(int $osmId): Address
|
||||
public function setOsmId(string $osmId): Address
|
||||
{
|
||||
$this->osmId = $osmId;
|
||||
|
||||
|
|
|
|||
|
|
@ -127,12 +127,12 @@ class Menu implements ImageInterface, \Stringable
|
|||
public function removeItem(MenuItem $item): self
|
||||
{
|
||||
$this->items->removeElement($item);
|
||||
// if ($this->items->removeElement($item)) {
|
||||
// if ($this->items->removeElement($item)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
// if ($item->getMenu() === $this) {
|
||||
// $item->setMenu(null);
|
||||
// }
|
||||
// }
|
||||
// if ($item->getMenu() === $this) {
|
||||
// $item->setMenu(null);
|
||||
// }
|
||||
// }
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,9 +487,9 @@ class Product implements \Stringable, ImagesInterface
|
|||
$resultArray = [];
|
||||
$today = CarbonImmutable::today(); // start of day 00:00:00
|
||||
$unavailabilities = $this->getAvailabilities()->filter(
|
||||
fn (ProductAvailability $pa) => $pa->getMode()->isUnavailable() && // of the good type
|
||||
($serviceRequest === null || $pa->getServiceRequest() !== $serviceRequest) && // exclude the dates of the current service request (modify dates)
|
||||
$pa->getEndAt() >= $today // passed dates are useless but the start date can be in the past
|
||||
fn (ProductAvailability $pa) => $pa->getMode()->isUnavailable() // of the good type
|
||||
&& ($serviceRequest === null || $pa->getServiceRequest() !== $serviceRequest) // exclude the dates of the current service request (modify dates)
|
||||
&& $pa->getEndAt() >= $today // passed dates are useless but the start date can be in the past
|
||||
);
|
||||
|
||||
foreach ($unavailabilities as $unavailability) {
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, ImageIn
|
|||
UserType::USER => UserCrudController::class,
|
||||
UserType::ADMIN => AdministratorCrudController::class,
|
||||
UserType::PLACE => PlaceCrudController::class,
|
||||
default => throw new \LogicException('No type assigned to user yet.')
|
||||
default => throw new \LogicException('No type assigned to user yet.'),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class CreateGroupFormType extends AbstractType
|
|||
public function __construct(
|
||||
private readonly Security $security,
|
||||
private readonly ConfigurationRepository $configurationRepository,
|
||||
private readonly GroupRepository $groupRepository
|
||||
private readonly GroupRepository $groupRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ final class ObjectFormType extends AbstractProductFormType
|
|||
public function __construct(
|
||||
MediaManager $mediaManager,
|
||||
private readonly GroupRepository $groupRepository,
|
||||
private readonly Security $security
|
||||
private readonly Security $security,
|
||||
) {
|
||||
parent::__construct($mediaManager, $security);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ final class ServiceFormType extends AbstractProductFormType
|
|||
public function __construct(
|
||||
MediaManager $mediaManager,
|
||||
private readonly GroupRepository $groupRepository,
|
||||
private readonly Security $security
|
||||
private readonly Security $security,
|
||||
) {
|
||||
parent::__construct($mediaManager, $security);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ abstract class AbstractUserProductSelectFormType extends AbstractType
|
|||
->from(ServiceRequest::class, 'sr')
|
||||
->andWhere('p = sr.product');
|
||||
|
||||
return $qb->andWhere(sprintf('sr.%s = :user', $this->isOwner() ? 'owner' : 'recipient'))
|
||||
return $qb->andWhere(\sprintf('sr.%s = :user', $this->isOwner() ? 'owner' : 'recipient'))
|
||||
->setParameter('user', $this->security->getUser());
|
||||
},
|
||||
'required' => false,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ final class NominatimToAddressAdapter
|
|||
$address->setOsmType((string) $nominatimAddress->getOSMType());
|
||||
|
||||
if ($nominatimAddress->getOSMId() !== null) {
|
||||
$address->setOsmId($nominatimAddress->getOSMId());
|
||||
$address->setOsmId((string) $nominatimAddress->getOSMId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class GeoProvider implements GeoProviderInterface
|
|||
/** @var AddressCollection $collection */
|
||||
$collection = $this->nominatimGeocoder->geocodeQuery($query);
|
||||
} catch (Exception $e) {
|
||||
throw new \RuntimeException(sprintf('Unable to get geoloc of %s: %s', $text, $e->getMessage()));
|
||||
throw new \RuntimeException(\sprintf('Unable to get geoloc of %s: %s', $text, $e->getMessage()));
|
||||
}
|
||||
|
||||
return $collection;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class GroupInvitationEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class NewAdminEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class PromoteToAdminEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ final class AdminPromotionEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ final class MainAdminPromotionEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class EndMembershipEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class NotifyMembershipExpirationEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class NotifyServiceRequestEndEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class NotifyServiceRequestStartEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class CreateAccountStep1Email implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ final class NewMessageEmail implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class NewServiceRequest implements EmailInterface
|
|||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
#[Autowire('%brand%')]
|
||||
private readonly string $brand
|
||||
private readonly string $brand,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ abstract class AbstractFormCommand
|
|||
}
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException(sprintf('Invalid property name, it should start with "%s"', implode(', ', $this->getSections())));
|
||||
throw new \UnexpectedValueException(\sprintf('Invalid property name, it should start with "%s"', implode(', ', $this->getSections())));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ final class CommandBus implements CommandBusInterface
|
|||
use HandleTrait;
|
||||
|
||||
public function __construct(
|
||||
MessageBusInterface $commandBus
|
||||
MessageBusInterface $commandBus,
|
||||
) {
|
||||
$this->messageBus = $commandBus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ final class QueryBus implements QueryBusInterface
|
|||
use HandleTrait;
|
||||
|
||||
public function __construct(
|
||||
MessageBusInterface $queryBus
|
||||
MessageBusInterface $queryBus,
|
||||
) {
|
||||
$this->messageBus = $queryBus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class DuplicateProductCommandHandler
|
|||
public function __construct(
|
||||
private readonly ProductRepository $productRepository,
|
||||
private readonly ProductManager $productManager,
|
||||
private readonly AuthorizationCheckerInterface $authorizationChecker
|
||||
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ final class TryAutoFinalizeCommandHandler
|
|||
public function __construct(
|
||||
private readonly ServiceRequestRepository $serviceRequestRepository,
|
||||
private readonly ServiceRequestManager $serviceRequestManager,
|
||||
private readonly ServiceRequestStatusWorkflow $serviceRequestStatusWorkflow
|
||||
private readonly ServiceRequestStatusWorkflow $serviceRequestStatusWorkflow,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
|||
final class ParametersFormQueryHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ConfigurationRepository $configurationRepository
|
||||
private readonly ConfigurationRepository $configurationRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ final class GetServiceRequestByIdQueryHandler
|
|||
}
|
||||
|
||||
if (!$this->security->isGranted(ServiceRequestVoter::VIEW, $serviceRequest)) {
|
||||
throw new AccessDeniedException(sprintf('Access to service request "%s" denied (not owner or recipient).', $message->id));
|
||||
throw new AccessDeniedException(\sprintf('Access to service request "%s" denied (not owner or recipient).', $message->id));
|
||||
}
|
||||
|
||||
return $serviceRequest;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ final class UserAddressQueryHandler
|
|||
private const WITH_LIMIT = 3;
|
||||
|
||||
public function __construct(
|
||||
private readonly GeoProviderInterface $geoProvider
|
||||
private readonly GeoProviderInterface $geoProvider,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ final class PayumManager
|
|||
{
|
||||
public function __construct(
|
||||
private readonly Payum $payum,
|
||||
#[Autowire('%env(string:PAYUM_GATEWAY)%')] private readonly string $payumGateway
|
||||
#[Autowire('%env(string:PAYUM_GATEWAY)%')] private readonly string $payumGateway,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use App\Entity\Category;
|
|||
use App\Entity\Product;
|
||||
use App\Entity\User;
|
||||
use App\Enum\Product\ProductType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
|
@ -16,7 +15,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
|||
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
|
||||
|
||||
/**
|
||||
* #@extends ServiceEntityRepository<Category>.
|
||||
* @extends NestedTreeRepository<Category>.
|
||||
*
|
||||
* @method Category|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Category|null findOneBy(array $criteria, array $orderBy = null)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class GroupOfferRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return an object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): GroupOffer
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): GroupOffer
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group offer not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ final class GroupRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return an object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Group
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Group
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ final class PaymentRepository extends ServiceEntityRepository
|
|||
parent::__construct($registry, self::ENTITY_CLASS);
|
||||
}
|
||||
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Payment
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Payment
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Payment not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class PlatformOfferRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return an object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): PlatformOffer
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): PlatformOffer
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Platform offer not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ final class ProductAvailabilityRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return product availability or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): ProductAvailability
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): ProductAvailability
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('ProductAvailability not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class ProductRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return an object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Product
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Product
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Product not found.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ final class ServiceRequestRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Return an object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): ServiceRequest
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): ServiceRequest
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Service request not found.');
|
||||
}
|
||||
|
|
@ -101,15 +101,15 @@ final class ServiceRequestRepository extends ServiceEntityRepository
|
|||
*/
|
||||
public function getActionSoon(string $property, int $days = 1): Query
|
||||
{
|
||||
$from = new \DateTimeImmutable(sprintf('+%d days midnight', $days));
|
||||
$from = new \DateTimeImmutable(\sprintf('+%d days midnight', $days));
|
||||
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
||||
|
||||
$qb = $this
|
||||
->createQueryBuilder('sr')
|
||||
->innerJoin('sr.owner', 'o')
|
||||
->innerJoin('sr.recipient', 'g')
|
||||
->andWhere(sprintf('sr.%s >= :from', $property))
|
||||
->andWhere(sprintf('sr.%s < :to', $property))
|
||||
->andWhere(\sprintf('sr.%s >= :from', $property))
|
||||
->andWhere(\sprintf('sr.%s < :to', $property))
|
||||
->setParameter('from', $from->format('Y-m-d'))
|
||||
->setParameter('to', $to->format('Y-m-d'))
|
||||
->andWhere('sr.status = :status')
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class UserGroupRepository extends ServiceEntityRepository
|
|||
*/
|
||||
public function getExpiring(int $days): Query
|
||||
{
|
||||
$from = new \DateTimeImmutable(sprintf('+%d days midnight', $days));
|
||||
$from = new \DateTimeImmutable(\sprintf('+%d days midnight', $days));
|
||||
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
||||
|
||||
$qb = $this
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
|||
/**
|
||||
* Return object or throws an exception if not found.
|
||||
*/
|
||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): User
|
||||
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): User
|
||||
{
|
||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('User not found.');
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
|||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||
throw new UnsupportedUserException(\sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
|
|
|
|||
|
|
@ -70,20 +70,20 @@ final class IndexProductsCommand extends Command
|
|||
|
||||
foreach ($query->toIterable() as $product) {
|
||||
/** @var Product $product */
|
||||
$io->comment(sprintf(' > adding product %s to batch', $product->getId()));
|
||||
$io->comment(\sprintf(' > adding product %s to batch', $product->getId()));
|
||||
$toIndex[] = $product;
|
||||
if ((\count($toIndex) % $batchSize) === 0) {
|
||||
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
||||
$io->note(sprintf(' > indexing %d product(s) from batch', \count($toIndex)));
|
||||
$io->note(\sprintf(' > indexing %d product(s) from batch', \count($toIndex)));
|
||||
$toIndex = [];
|
||||
}
|
||||
++$count;
|
||||
}
|
||||
|
||||
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
||||
$io->note(sprintf(' > indexing %d remaining product(s) from batch', \count($toIndex)));
|
||||
$io->note(\sprintf(' > indexing %d remaining product(s) from batch', \count($toIndex)));
|
||||
|
||||
$io->note(sprintf(' -> %d product(s) indexed.', $count));
|
||||
$io->note(\sprintf(' -> %d product(s) indexed.', $count));
|
||||
$io->note(' -> DONE');
|
||||
$io->newLine();
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class Meilisearch
|
|||
/**
|
||||
* Search with a main query and various filtery.
|
||||
*/
|
||||
public function search(Search $searchDto, ProductType $productType = null): SearchResult
|
||||
public function search(Search $searchDto, ?ProductType $productType = null): SearchResult
|
||||
{
|
||||
$searchParams = [];
|
||||
$searchParams = $this->withFilters($searchParams, $searchDto, $productType);
|
||||
|
|
@ -240,13 +240,13 @@ class Meilisearch
|
|||
|
||||
// place filter
|
||||
if ($searchDto->place !== null) {
|
||||
$filters[] = sprintf('ownerId = %s', $searchDto->place->getId());
|
||||
$filters[] = \sprintf('ownerId = %s', $searchDto->place->getId());
|
||||
}
|
||||
|
||||
// geo filter
|
||||
if ($searchDto->hasProximity()) {
|
||||
Assert::isInstanceOf($searchDto->city, Address::class);
|
||||
$filters[] = sprintf('_geoRadius(%s, %s, %d)',
|
||||
$filters[] = \sprintf('_geoRadius(%s, %s, %d)',
|
||||
$searchDto->city->getLatitude(),
|
||||
$searchDto->city->getLongitude(),
|
||||
(int) $searchDto->distance * 1000 // the distance is in meters, not kilometers
|
||||
|
|
@ -271,7 +271,7 @@ class Meilisearch
|
|||
// the proximity search has the priority to sort results
|
||||
if ($searchDto->hasProximity()) {
|
||||
Assert::isInstanceOf($searchDto->city, Address::class);
|
||||
$searchParams['sort'] = [sprintf('_geoPoint(%s, %s):asc',
|
||||
$searchParams['sort'] = [\sprintf('_geoPoint(%s, %s):asc',
|
||||
$searchDto->city->getLatitude(),
|
||||
$searchDto->city->getLongitude()),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
|||
final class AuthorizationChecker
|
||||
{
|
||||
public function __construct(
|
||||
public readonly AuthorizationCheckerInterface $authorizationChecker
|
||||
public readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ use function Symfony\Component\String\u;
|
|||
class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UrlGeneratorInterface $urlGenerator
|
||||
private readonly UrlGeneratorInterface $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function start(Request $request, AuthenticationException $authException = null): RedirectResponse
|
||||
public function start(Request $request, ?AuthenticationException $authException = null): RedirectResponse
|
||||
{
|
||||
/** @var string $route */
|
||||
$route = $request->attributes->get('_route');
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ final class ProductVoter extends Voter
|
|||
self::DUPLICATE => $this->canDuplicate($subject, $user),
|
||||
self::BORROW => $this->canBorrow($subject, $user),
|
||||
self::DELETE => $this->canDelete($subject, $user),
|
||||
default => throw new \LogicException('This code should not be reached!')
|
||||
default => throw new \LogicException('This code should not be reached!'),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class ServiceRequestVoter extends Voter
|
|||
|
||||
return match ($attribute) {
|
||||
self::VIEW => $this->canView($subject, $user),
|
||||
default => throw new \LogicException('This code should not be reached!')
|
||||
default => throw new \LogicException('This code should not be reached!'),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
|||
*/
|
||||
public function __construct(
|
||||
#[Autowire(service: ObjectNormalizer::class)]
|
||||
private readonly NormalizerInterface $normalizer
|
||||
private readonly NormalizerInterface $normalizer,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
|||
*
|
||||
* @throws ExceptionInterface
|
||||
*/
|
||||
public function normalize(mixed $object, string $format = null, array $context = []): array
|
||||
public function normalize(mixed $object, ?string $format = null, array $context = []): array
|
||||
{
|
||||
/** @var array<string, mixed> $data */
|
||||
$data = $this->normalizer->normalize($object, $format, $context);
|
||||
|
|
@ -46,7 +46,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
|||
/**
|
||||
* @param array<mixed> $context
|
||||
*/
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return $data instanceof ProductDocument;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ use App\Repository\GroupRepository;
|
|||
final class GroupGetStatsProvider implements ProviderInterface
|
||||
{
|
||||
public function __construct(
|
||||
readonly private GroupRepository $groupRepository
|
||||
readonly private GroupRepository $groupRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null // @phpstan-ignore-line
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||
{
|
||||
$groupStats = new GroupResource();
|
||||
$groupStats->count = $this->groupRepository->count([]);
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ class GroupsProvider implements ProviderInterface
|
|||
{
|
||||
public function __construct(
|
||||
readonly private GroupRepository $groupRepository,
|
||||
readonly private UserRepository $userRepository
|
||||
readonly private UserRepository $userRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null // @phpstan-ignore-line
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||
{
|
||||
if (isset($context['filters']['user'])) {
|
||||
if (isset($context['filters']['user'])) { // @phpstan-ignore-line
|
||||
$user = $this->userRepository->find($context['filters']['user']);
|
||||
|
||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true', $user);
|
||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true', $user); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true');
|
||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true'); // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,22 +8,19 @@ use ApiPlatform\Metadata\Operation;
|
|||
use ApiPlatform\State\ProcessorInterface;
|
||||
use App\Entity\Group;
|
||||
use App\Repository\GroupRepository;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @implements ProcessorInterface<Group,Group>
|
||||
*/
|
||||
class GroupChildServicesEnabledProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GroupRepository $groupRepository
|
||||
private readonly GroupRepository $groupRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed> $uriVariables
|
||||
* @param array<mixed> $context
|
||||
*/
|
||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Group
|
||||
{
|
||||
Assert::isInstanceOf($data, Group::class);
|
||||
$this->groupRepository->disableServicesForChildGroup($data);
|
||||
|
||||
return $data;
|
||||
|
|
|
|||
|
|
@ -8,25 +8,21 @@ use ApiPlatform\Metadata\Operation;
|
|||
use ApiPlatform\State\ProcessorInterface;
|
||||
use App\Entity\Product;
|
||||
use App\Repository\ProductRepository;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Change the status of a product from active to paused or the opposite.
|
||||
*
|
||||
* @implements ProcessorInterface<Product,Product>
|
||||
*/
|
||||
final class ProductSwitchProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProductRepository $productRepository
|
||||
private readonly ProductRepository $productRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed> $uriVariables
|
||||
* @param array<mixed> $context
|
||||
*/
|
||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Product
|
||||
{
|
||||
Assert::isInstanceOf($data, Product::class);
|
||||
$data->switchStatus();
|
||||
$this->productRepository->save($data, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestAcceptTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestAutoFinalizeTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestConfirmTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestFinalizeTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestModifyOwnerTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
|||
final class ServiceRequestModifyRecipientTransitionSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly Security $security
|
||||
public readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ final class ServiceRequestFinishedSubscriber implements EventSubscriberInterface
|
|||
$this->createSystemMessage($serviceRequest, $serviceRequest->getFinalizedAt());
|
||||
}
|
||||
|
||||
private function createSystemMessage(ServiceRequest $serviceRequest, \DateTimeImmutable $createdAt = null): void
|
||||
private function createSystemMessage(ServiceRequest $serviceRequest, ?\DateTimeImmutable $createdAt = null): void
|
||||
{
|
||||
$systemMessage = $this->messageManager->createSystemMessage(
|
||||
$serviceRequest,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ final class NoTranslator implements TranslatorInterface, TranslatorBagInterface,
|
|||
* @param TranslatorInterface&TranslatorBagInterface&LocaleAwareInterface $translator
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly TranslatorInterface $translator
|
||||
private readonly TranslatorInterface $translator,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -31,12 +31,12 @@ final class NoTranslator implements TranslatorInterface, TranslatorBagInterface,
|
|||
*
|
||||
* @param array<mixed> $parameters
|
||||
*/
|
||||
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
|
||||
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
|
||||
{
|
||||
// to find EasyAdmin translations codes, uncomment this
|
||||
// if ($domain === 'EasyAdminBundle') {
|
||||
// dump($id);
|
||||
// }
|
||||
// if ($domain === 'EasyAdminBundle') {
|
||||
// dump($id);
|
||||
// }
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ final class NoTranslator implements TranslatorInterface, TranslatorBagInterface,
|
|||
return $this->translator->getCatalogues();
|
||||
}
|
||||
|
||||
public function getCatalogue(string $locale = null): MessageCatalogueInterface
|
||||
public function getCatalogue(?string $locale = null): MessageCatalogueInterface
|
||||
{
|
||||
return $this->translator->getCatalogue($locale);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ final class ServiceRequestStatusWorkflow
|
|||
public const WORKFLOW_SERVICE_REQUEST_COMPLETED_AUTO_FINALIZE_EVENT = 'workflow.service_request_status.completed.autoFinalize';
|
||||
|
||||
public function __construct(
|
||||
private readonly WorkflowInterface $serviceRequestStatusStateMachine
|
||||
private readonly WorkflowInterface $serviceRequestStatusStateMachine,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ final class ServiceRequestStatusWorkflow
|
|||
|
||||
private function getException(ServiceRequest $sr, ServiceRequestStatusTransition $transition): \LogicException
|
||||
{
|
||||
return new \LogicException(sprintf(self::EXCEPTION_MESSAGE, $transition->name, $sr->getId(), $sr->getStatus()->value));
|
||||
return new \LogicException(\sprintf(self::EXCEPTION_MESSAGE, $transition->name, $sr->getId(), $sr->getStatus()->value));
|
||||
}
|
||||
|
||||
public function canAccept(ServiceRequest $sr): bool
|
||||
|
|
|
|||
12
symfony.lock
12
symfony.lock
|
|
@ -208,18 +208,6 @@
|
|||
"tests/bootstrap.php"
|
||||
]
|
||||
},
|
||||
"sensio/framework-extra-bundle": {
|
||||
"version": "6.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.2",
|
||||
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/sensio_framework_extra.yaml"
|
||||
]
|
||||
},
|
||||
"snc/redis-bundle": {
|
||||
"version": "4.3",
|
||||
"recipe": {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue