Merge branch 'master' into upgrade-sf5

This commit is contained in:
2024-02-12 21:50:34 +01:00
920 changed files with 6430 additions and 1914 deletions

View File

@@ -23,7 +23,9 @@ 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}",

View File

@@ -35,7 +35,8 @@ 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")

View File

@@ -23,7 +23,9 @@ 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}",

View File

@@ -34,7 +34,9 @@ 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.

View File

@@ -30,7 +30,9 @@ 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")

View File

@@ -27,7 +27,9 @@ 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",

View File

@@ -34,7 +34,9 @@ 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")

View File

@@ -28,7 +28,9 @@ 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
{

View File

@@ -17,7 +17,9 @@ 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
{

View File

@@ -13,7 +13,7 @@ namespace Chill\CalendarBundle\Exception;
class UserAbsenceSyncException extends \LogicException
{
public function __construct(string $message = '', int $code = 20_230_706, \Throwable $previous = null)
public function __construct(string $message = '', int $code = 20_230_706, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}

View File

@@ -20,7 +20,9 @@ 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
{

View File

@@ -20,7 +20,9 @@ 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
{

View File

@@ -27,7 +27,8 @@ final readonly class JobAggregator implements AggregatorInterface
public function __construct(
private UserJobRepository $jobRepository,
private TranslatableStringHelper $translatableStringHelper
) {}
) {
}
public function addRole(): ?string
{
@@ -65,7 +66,9 @@ final readonly class JobAggregator implements AggregatorInterface
return Declarations::CALENDAR_TYPE;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{

View File

@@ -19,7 +19,9 @@ 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
{

View File

@@ -20,7 +20,9 @@ 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
{

View File

@@ -27,7 +27,8 @@ final readonly class ScopeAggregator implements AggregatorInterface
public function __construct(
private ScopeRepository $scopeRepository,
private TranslatableStringHelper $translatableStringHelper
) {}
) {
}
public function addRole(): ?string
{
@@ -65,7 +66,9 @@ final readonly class ScopeAggregator implements AggregatorInterface
return Declarations::CALENDAR_TYPE;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{

View File

@@ -26,7 +26,9 @@ 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
{

View File

@@ -27,7 +27,8 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
{
public function __construct(
private readonly CalendarRepository $calendarRepository,
) {}
) {
}
public function buildForm(FormBuilderInterface $builder)
{

View File

@@ -24,7 +24,9 @@ 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
{

View File

@@ -24,7 +24,9 @@ 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
{

View File

@@ -22,7 +22,9 @@ 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
{

View File

@@ -21,7 +21,9 @@ 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
{

View File

@@ -34,7 +34,9 @@ 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
{

View File

@@ -27,7 +27,8 @@ final readonly class JobFilter implements FilterInterface
public function __construct(
private TranslatableStringHelper $translatableStringHelper
) {}
) {
}
public function addRole(): ?string
{

View File

@@ -29,7 +29,8 @@ class ScopeFilter implements FilterInterface
public function __construct(
protected TranslatorInterface $translator,
private readonly TranslatableStringHelper $translatableStringHelper
) {}
) {
}
public function addRole(): ?string
{

View File

@@ -38,7 +38,8 @@ class CalendarType extends AbstractType
private readonly IdToLocationDataTransformer $idToLocationDataTransformer,
private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer,
private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer
) {}
) {
}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -19,7 +19,9 @@ 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)
{

View File

@@ -19,7 +19,9 @@ 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)
{

View File

@@ -18,7 +18,9 @@ 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)
{

View File

@@ -29,7 +29,9 @@ 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
{

View File

@@ -29,7 +29,9 @@ 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
{

View File

@@ -31,7 +31,9 @@ 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)
{

View File

@@ -32,7 +32,9 @@ 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
{

View File

@@ -31,7 +31,9 @@ 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)
{

View File

@@ -37,7 +37,9 @@ 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)
{

View File

@@ -31,7 +31,9 @@ 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
{

View File

@@ -36,7 +36,9 @@ 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
{

View File

@@ -20,7 +20,9 @@ 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
{

View File

@@ -24,7 +24,9 @@ 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
{

View File

@@ -28,7 +28,9 @@ 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}

View File

@@ -22,7 +22,9 @@ 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
{

View File

@@ -27,12 +27,13 @@ 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
*/
public function isUserAbsent(User $user): null|bool
public function isUserAbsent(User $user): bool|null
{
$id = $this->mapCalendarToUser->getUserId($user);

View File

@@ -18,5 +18,5 @@ interface MSUserAbsenceReaderInterface
/**
* @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft
*/
public function isUserAbsent(User $user): null|bool;
public function isUserAbsent(User $user): bool|null;
}

View File

@@ -21,7 +21,8 @@ readonly class MSUserAbsenceSync
private MSUserAbsenceReaderInterface $absenceReader,
private ClockInterface $clock,
private LoggerInterface $logger,
) {}
) {
}
public function syncUserAbsence(User $user): void
{

View File

@@ -29,7 +29,7 @@ class MachineHttpClient implements HttpClientInterface
private readonly HttpClientInterface $decoratedClient;
public function __construct(private readonly MachineTokenStorage $machineTokenStorage, HttpClientInterface $decoratedClient = null)
public function __construct(private readonly MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null)
{
$this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create();
}
@@ -68,7 +68,7 @@ class MachineHttpClient implements HttpClientInterface
return $this->decoratedClient->request($method, $url, $options);
}
public function stream($responses, float $timeout = null): ResponseStreamInterface
public function stream($responses, ?float $timeout = null): ResponseStreamInterface
{
return $this->decoratedClient->stream($responses, $timeout);
}

View File

@@ -29,7 +29,9 @@ 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
{

View File

@@ -36,7 +36,9 @@ 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
{
@@ -176,8 +178,8 @@ class MapCalendarToUser
public function writeSubscriptionMetadata(
User $user,
int $expiration,
string $id = null,
string $secret = null
?string $id = null,
?string $secret = null
): void {
$user->setAttributeByDomain(self::METADATA_KEY, self::EXPIRATION_SUBSCRIPTION_EVENT, $expiration);

View File

@@ -29,7 +29,7 @@ class OnBehalfOfUserHttpClient
private readonly HttpClientInterface $decoratedClient;
public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, HttpClientInterface $decoratedClient = null)
public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null)
{
$this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create();
}
@@ -63,7 +63,7 @@ class OnBehalfOfUserHttpClient
return $this->decoratedClient->request($method, $url, $options);
}
public function stream($responses, float $timeout = null): ResponseStreamInterface
public function stream($responses, ?float $timeout = null): ResponseStreamInterface
{
return $this->decoratedClient->stream($responses, $timeout);
}

View File

@@ -29,7 +29,9 @@ 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
{

View File

@@ -32,7 +32,9 @@ 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
{

View File

@@ -29,7 +29,9 @@ 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
{

View File

@@ -41,7 +41,9 @@ 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
{
@@ -169,7 +171,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
}
}
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
{
if ('' === $remoteId) {
return;

View File

@@ -46,13 +46,23 @@ 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
{
}
}

View File

@@ -47,7 +47,7 @@ interface RemoteCalendarConnectorInterface
*/
public function listEventsForUser(User $user, \DateTimeImmutable $startDate, \DateTimeImmutable $endDate, ?int $offset = 0, ?int $limit = 50): array;
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;

View File

@@ -44,5 +44,6 @@ class RemoteEvent
* @Serializer\Groups({"read"})
*/
public bool $isAllDay = false
) {}
) {
}
}

View File

@@ -28,7 +28,9 @@ 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
{
@@ -157,7 +159,7 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
/**
* @return array|Calendar[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array
{
$qb = $this->buildQueryByAccompanyingPeriod($period, $startDate, $endDate)->select('c');
@@ -176,7 +178,7 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
return $qb->getQuery()->getResult();
}
public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array
public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array
{
$qb = $this->buildQueryByPerson($person, $startDate, $endDate)
->select('c');

View File

@@ -46,7 +46,7 @@ interface CalendarACLAwareRepositoryInterface
/**
* @return array|Calendar[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array;
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array;
/**
* Return all the calendars which are associated with a person, either on @see{Calendar::person} or within.
@@ -58,5 +58,5 @@ interface CalendarACLAwareRepositoryInterface
*
* @return array|Calendar[]
*/
public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array;
public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array;
}

View File

@@ -35,7 +35,7 @@ class CalendarDocRepository implements ObjectRepository, CalendarDocRepositoryIn
return $this->repository->findAll();
}
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null)
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -25,7 +25,7 @@ interface CalendarDocRepositoryInterface
/**
* @return array|CalendarDoc[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null);
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null);
public function findOneBy(array $criteria): ?CalendarDoc;

View File

@@ -52,7 +52,7 @@ class CalendarRangeRepository implements ObjectRepository
/**
* @return array|CalendarRange[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null)
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -64,8 +64,8 @@ class CalendarRangeRepository implements ObjectRepository
User $user,
\DateTimeImmutable $from,
\DateTimeImmutable $to,
int $limit = null,
int $offset = null
?int $limit = null,
?int $offset = null
): array {
$qb = $this->buildQueryAvailableRangesForUser($user, $from, $to);

View File

@@ -46,7 +46,7 @@ class CalendarRepository implements ObjectRepository
->getSingleScalarResult();
}
public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
{
return $this->repository->createQueryBuilder($alias, $indexBy);
}
@@ -67,7 +67,7 @@ class CalendarRepository implements ObjectRepository
/**
* @return array|Calendar[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -75,7 +75,7 @@ class CalendarRepository implements ObjectRepository
/**
* @return array|Calendar[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $orderBy = null, int $limit = null, int $offset = null): array
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->findBy(
[
@@ -87,7 +87,7 @@ class CalendarRepository implements ObjectRepository
);
}
public function findByNotificationAvailable(\DateTimeImmutable $startDate, \DateTimeImmutable $endDate, int $limit = null, int $offset = null): array
public function findByNotificationAvailable(\DateTimeImmutable $startDate, \DateTimeImmutable $endDate, ?int $limit = null, ?int $offset = null): array
{
$qb = $this->queryByNotificationAvailable($startDate, $endDate)->select('c');
@@ -105,7 +105,7 @@ class CalendarRepository implements ObjectRepository
/**
* @return array|Calendar[]
*/
public function findByUser(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to, int $limit = null, int $offset = null): array
public function findByUser(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to, ?int $limit = null, ?int $offset = null): array
{
$qb = $this->buildQueryByUser($user, $from, $to)->select('c');

View File

@@ -41,7 +41,7 @@ class InviteRepository implements ObjectRepository
/**
* @return array|Invite[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null)
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)
{
return $this->entityRepository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -27,7 +27,9 @@ 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
{

View File

@@ -41,7 +41,8 @@ final readonly class CalendarContext implements CalendarContextInterface
private ThirdPartyRender $thirdPartyRender,
private ThirdPartyRepository $thirdPartyRepository,
private TranslatableStringHelperInterface $translatableStringHelper
) {}
) {
}
public function adminFormReverseTransform(array $data): array
{

View File

@@ -19,4 +19,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
* @extends DocGeneratorContextWithPublicFormInterface<Calendar>
* @extends DocGeneratorContextWithAdminFormInterface<Calendar>
*/
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface {}
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface
{
}

View File

@@ -38,12 +38,13 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen
public function __construct(
private Security $security,
private EntityManagerInterface $em
) {}
) {
}
/**
* @throws MappingException
*/
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
@@ -90,7 +91,7 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen
return $this->security->isGranted(CalendarVoter::SEE, $accompanyingPeriod);
}
public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface
public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);

View File

@@ -37,9 +37,10 @@ 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
private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
{
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
@@ -73,7 +74,7 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe
/**
* @throws MappingException
*/
public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface
public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);

View File

@@ -19,7 +19,9 @@ 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
{

View File

@@ -25,7 +25,9 @@ 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()
{

View File

@@ -24,7 +24,9 @@ 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.

View File

@@ -23,7 +23,9 @@ 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
{

View File

@@ -202,8 +202,8 @@ final class CalendarContextTest extends TestCase
}
private function buildCalendarContext(
EntityManagerInterface $entityManager = null,
NormalizerInterface $normalizer = null
?EntityManagerInterface $entityManager = null,
?NormalizerInterface $normalizer = null
): CalendarContext {
$baseContext = $this->prophesize(BaseContextData::class);
$baseContext->getData(null)->willReturn(['base_context' => 'data']);