apply rules rector up to php82

This commit is contained in:
2023-05-01 21:39:45 +02:00
parent 81e8928344
commit 6d63177ff4
733 changed files with 1257 additions and 1322 deletions

View File

@@ -29,7 +29,7 @@ use TheNetworg\OAuth2\Client\Provider\Azure;
class AzureGrantAdminConsentAndAcquireToken extends Command
{
public function __construct(private Azure $azure, private ClientRegistry $clientRegistry, private MachineTokenStorage $machineTokenStorage)
public function __construct(private readonly Azure $azure, private readonly ClientRegistry $clientRegistry, private readonly MachineTokenStorage $machineTokenStorage)
{
parent::__construct('chill:calendar:msgraph-grant-admin-consent');
}

View File

@@ -33,11 +33,11 @@ use Symfony\Component\Console\Output\OutputInterface;
class MapAndSubscribeUserCalendarCommand extends Command
{
public function __construct(
private EntityManagerInterface $em,
private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
private LoggerInterface $logger,
private MapCalendarToUser $mapCalendarToUser,
private MSGraphUserRepository $userRepository
private readonly EntityManagerInterface $em,
private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
private readonly LoggerInterface $logger,
private readonly MapCalendarToUser $mapCalendarToUser,
private readonly MSGraphUserRepository $userRepository
) {
parent::__construct('chill:calendar:msgraph-user-map-subscribe');
}

View File

@@ -25,7 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class SendShortMessageOnEligibleCalendar extends Command
{
public function __construct(private BulkCalendarShortMessageSender $messageSender)
public function __construct(private readonly BulkCalendarShortMessageSender $messageSender)
{
parent::__construct();
}

View File

@@ -44,12 +44,12 @@ use function count;
class SendTestShortMessageOnCalendarCommand extends Command
{
public function __construct(
private PersonRepository $personRepository,
private PhoneNumberUtil $phoneNumberUtil,
private PhoneNumberHelperInterface $phoneNumberHelper,
private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
private ShortMessageTransporterInterface $transporter,
private UserRepositoryInterface $userRepository
private readonly PersonRepository $personRepository,
private readonly PhoneNumberUtil $phoneNumberUtil,
private readonly PhoneNumberHelperInterface $phoneNumberHelper,
private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
private readonly ShortMessageTransporterInterface $transporter,
private readonly UserRepositoryInterface $userRepository
) {
parent::__construct();
}

View File

@@ -24,7 +24,7 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarAPIController extends ApiController
{
public function __construct(private CalendarRepository $calendarRepository)
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}

View File

@@ -49,7 +49,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class CalendarController extends AbstractController
{
public function __construct(private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private LoggerInterface $logger, private PaginatorFactory $paginator, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer, private TranslatableStringHelperInterface $translatableStringHelper, private PersonRepository $personRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private UserRepositoryInterface $userRepository, private TranslatorInterface $translator)
public function __construct(private readonly CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly LoggerInterface $logger, private readonly PaginatorFactory $paginator, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly PersonRepository $personRepository, private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly UserRepositoryInterface $userRepository, private readonly TranslatorInterface $translator)
{
}

View File

@@ -33,9 +33,7 @@ use UnexpectedValueException;
class CalendarDocController
{
private SerializerInterface $serializer;
public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EngineInterface $engine, private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator)
public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EngineInterface $engine, private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator)
{
}

View File

@@ -25,7 +25,7 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarRangeAPIController extends ApiController
{
public function __construct(private CalendarRangeRepository $calendarRangeRepository)
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository)
{
}

View File

@@ -35,7 +35,7 @@ use function in_array;
class InviteApiController
{
public function __construct(private EntityManagerInterface $entityManager, private MessageBusInterface $messageBus, private Security $security)
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}

View File

@@ -30,7 +30,7 @@ use TheNetworg\OAuth2\Client\Token\AccessToken;
class RemoteCalendarConnectAzureController
{
public function __construct(private ClientRegistry $clientRegistry, private OnBehalfOfUserTokenStorage $MSGraphTokenStorage)
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage)
{
}

View File

@@ -29,7 +29,7 @@ use const JSON_THROW_ON_ERROR;
class RemoteCalendarMSGraphSyncController
{
public function __construct(private MessageBusInterface $messageBus)
public function __construct(private readonly MessageBusInterface $messageBus)
{
}

View File

@@ -36,7 +36,7 @@ use function count;
*/
class RemoteCalendarProxyController
{
public function __construct(private PaginatorFactory $paginatorFactory, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer)
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer)
{
}

View File

@@ -29,7 +29,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
{
public static array $references = [];
public function __construct(private UserRepository $userRepository)
public function __construct(private readonly UserRepository $userRepository)
{
}

View File

@@ -58,20 +58,20 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
use TrackUpdateTrait;
public const SMS_CANCEL_PENDING = 'sms_cancel_pending';
final public const SMS_CANCEL_PENDING = 'sms_cancel_pending';
public const SMS_PENDING = 'sms_pending';
final public const SMS_PENDING = 'sms_pending';
public const SMS_SENT = 'sms_sent';
final public const SMS_SENT = 'sms_sent';
public const STATUS_CANCELED = 'canceled';
final public const STATUS_CANCELED = 'canceled';
/**
* @deprecated
*/
public const STATUS_MOVED = 'moved';
final public const STATUS_MOVED = 'moved';
public const STATUS_VALID = 'valid';
final public const STATUS_VALID = 'valid';
/**
* a list of invite which have been added during this session.

View File

@@ -20,11 +20,11 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CancelReason
{
public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT';
final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT';
public const CANCELEDBY_PERSON = 'CANCELEDBY_PERSON';
final public const CANCELEDBY_PERSON = 'CANCELEDBY_PERSON';
public const CANCELEDBY_USER = 'CANCELEDBY_USER';
final public const CANCELEDBY_USER = 'CANCELEDBY_USER';
/**
* @ORM\Column(type="boolean")

View File

@@ -40,23 +40,23 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
use TrackUpdateTrait;
public const ACCEPTED = 'accepted';
final public const ACCEPTED = 'accepted';
public const DECLINED = 'declined';
final public const DECLINED = 'declined';
public const PENDING = 'pending';
final public const PENDING = 'pending';
/**
* all statuses in one const.
*/
public const STATUSES = [
final public const STATUSES = [
self::ACCEPTED,
self::DECLINED,
self::PENDING,
self::TENTATIVELY_ACCEPTED,
];
public const TENTATIVELY_ACCEPTED = 'tentative';
final public const TENTATIVELY_ACCEPTED = 'tentative';
/**
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites")

View File

@@ -19,7 +19,7 @@ use function array_key_exists;
class ListenToActivityCreate
{
public function __construct(private RequestStack $requestStack)
public function __construct(private readonly RequestStack $requestStack)
{
}

View File

@@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class AgentAggregator implements AggregatorInterface
final readonly class AgentAggregator implements AggregatorInterface
{
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
{

View File

@@ -22,7 +22,7 @@ use function in_array;
class CancelReasonAggregator implements AggregatorInterface
{
public function __construct(private CancelReasonRepository $cancelReasonRepository, private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class JobAggregator implements AggregatorInterface
final readonly class JobAggregator implements AggregatorInterface
{
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
{

View File

@@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class LocationAggregator implements AggregatorInterface
final readonly class LocationAggregator implements AggregatorInterface
{
public function __construct(private LocationRepository $locationRepository)
{

View File

@@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class LocationTypeAggregator implements AggregatorInterface
final readonly class LocationTypeAggregator implements AggregatorInterface
{
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
{

View File

@@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class ScopeAggregator implements AggregatorInterface
final readonly class ScopeAggregator implements AggregatorInterface
{
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
{

View File

@@ -28,7 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UrgencyAggregator implements AggregatorInterface
{
public function __construct(private TranslatorInterface $translator)
public function __construct(private readonly TranslatorInterface $translator)
{
}

View File

@@ -16,5 +16,5 @@ namespace Chill\CalendarBundle\Export;
*/
abstract class Declarations
{
public const CALENDAR_TYPE = 'calendar';
final public const CALENDAR_TYPE = 'calendar';
}

View File

@@ -25,7 +25,7 @@ use Symfony\Component\Validator\Exception\LogicException;
class CountCalendars implements ExportInterface, GroupedExportInterface
{
public function __construct(private CalendarRepository $calendarRepository)
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}

View File

@@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private CalendarRepository $calendarRepository)
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}

View File

@@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private CalendarRepository $calendarRepository)
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}

View File

@@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class AgentFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
public function __construct(private readonly UserRender $userRender)
{
}

View File

@@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class BetweenDatesFilter implements FilterInterface
{
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter)
{
}

View File

@@ -35,7 +35,7 @@ class CalendarRangeFilter implements FilterInterface
private const DEFAULT_CHOICE = false;
public function __construct(private TranslatorInterface $translator)
public function __construct(private readonly TranslatorInterface $translator)
{
}

View File

@@ -24,7 +24,7 @@ use function in_array;
class JobFilter implements FilterInterface
{
public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper)
public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -24,7 +24,7 @@ use function in_array;
class ScopeFilter implements FilterInterface
{
public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper)
public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -32,7 +32,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class CalendarType extends AbstractType
{
public function __construct(private PersonsToIdDataTransformer $personsToIdDataTransformer, private IdToUserDataTransformer $idToUserDataTransformer, private IdToUsersDataTransformer $idToUsersDataTransformer, private IdToLocationDataTransformer $idToLocationDataTransformer, private ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private IdToCalendarRangeDataTransformer $calendarRangeDataTransformer)
public function __construct(private readonly PersonsToIdDataTransformer $personsToIdDataTransformer, private readonly IdToUserDataTransformer $idToUserDataTransformer, private readonly IdToUsersDataTransformer $idToUsersDataTransformer, private readonly IdToLocationDataTransformer $idToLocationDataTransformer, private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer)
{
}

View File

@@ -19,7 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private Security $security, protected TranslatorInterface $translator)
public function __construct(private readonly Security $security, protected TranslatorInterface $translator)
{
}

View File

@@ -19,7 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class PersonMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private Security $security, protected TranslatorInterface $translator)
public function __construct(private readonly Security $security, protected TranslatorInterface $translator)
{
}

View File

@@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private Security $security, public TranslatorInterface $translator)
public function __construct(private readonly Security $security, public TranslatorInterface $translator)
{
}

View File

@@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Security;
class CalendarEntityListener
{
public function __construct(private MessageBusInterface $messageBus, private Security $security)
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}

View File

@@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Security;
class CalendarRangeEntityListener
{
public function __construct(private MessageBusInterface $messageBus, private Security $security)
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}

View File

@@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private UserRepository $userRepository)
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository)
{
}

View File

@@ -32,7 +32,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRangeToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private CalendarRangeRepository $calendarRangeRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private EntityManagerInterface $entityManager)
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager)
{
}

View File

@@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRemoveHandler implements MessageHandlerInterface
{
public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private CalendarRangeRepository $calendarRangeRepository, private UserRepositoryInterface $userRepository)
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository)
{
}

View File

@@ -37,7 +37,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRepository $calendarRepository, private EntityManagerInterface $entityManager, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $calendarConnector, private 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)
{
}

View File

@@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class InviteUpdateHandler implements MessageHandlerInterface
{
public function __construct(private EntityManagerInterface $em, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector)
public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector)
{
}

View File

@@ -36,7 +36,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class MSGraphChangeNotificationHandler implements MessageHandlerInterface
{
public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRangeSyncer $calendarRangeSyncer, private CalendarRepository $calendarRepository, private CalendarSyncer $calendarSyncer, private EntityManagerInterface $em, private LoggerInterface $logger, private MapCalendarToUser $mapCalendarToUser, private 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)
{
}

View File

@@ -24,13 +24,13 @@ use Chill\MainBundle\Entity\User;
class CalendarMessage
{
public const CALENDAR_PERSIST = 'CHILL_CALENDAR_CALENDAR_PERSIST';
final public const CALENDAR_PERSIST = 'CHILL_CALENDAR_CALENDAR_PERSIST';
public const CALENDAR_UPDATE = 'CHILL_CALENDAR_CALENDAR_UPDATE';
final public const CALENDAR_UPDATE = 'CHILL_CALENDAR_CALENDAR_UPDATE';
private int $byUserId;
private readonly int $byUserId;
private int $calendarId;
private readonly int $calendarId;
private array $newInvitesIds = [];
@@ -45,7 +45,7 @@ class CalendarMessage
public function __construct(
Calendar $calendar,
private string $action,
private readonly string $action,
User $byUser
) {
$this->calendarId = $calendar->getId();

View File

@@ -23,15 +23,15 @@ use Chill\MainBundle\Entity\User;
class CalendarRangeMessage
{
public const CALENDAR_RANGE_PERSIST = 'CHILL_CALENDAR_CALENDAR_RANGE_PERSIST';
final public const CALENDAR_RANGE_PERSIST = 'CHILL_CALENDAR_CALENDAR_RANGE_PERSIST';
public const CALENDAR_RANGE_UPDATE = 'CHILL_CALENDAR_CALENDAR_RANGE_UPDATE';
final public const CALENDAR_RANGE_UPDATE = 'CHILL_CALENDAR_CALENDAR_RANGE_UPDATE';
private ?int $byUserId = null;
private int $calendarRangeId;
private readonly int $calendarRangeId;
public function __construct(CalendarRange $calendarRange, private string $action, ?User $byUser)
public function __construct(CalendarRange $calendarRange, private readonly string $action, ?User $byUser)
{
$this->calendarRangeId = $calendarRange->getId();

View File

@@ -25,11 +25,11 @@ class CalendarRangeRemovedMessage
{
private ?int $byUserId = null;
private int $calendarRangeUserId;
private readonly int $calendarRangeUserId;
private array $remoteAttributes;
private readonly array $remoteAttributes;
private string $remoteId;
private readonly string $remoteId;
public function __construct(CalendarRange $calendarRange, ?User $byUser)
{

View File

@@ -27,11 +27,11 @@ class CalendarRemovedMessage
private ?int $byUserId = null;
private int $calendarUserId;
private readonly int $calendarUserId;
private array $remoteAttributes;
private readonly array $remoteAttributes;
private string $remoteId;
private readonly string $remoteId;
public function __construct(Calendar $calendar, ?User $byUser)
{

View File

@@ -23,9 +23,9 @@ use Chill\MainBundle\Entity\User;
class InviteUpdateMessage
{
private int $byUserId;
private readonly int $byUserId;
private int $inviteId;
private readonly int $inviteId;
public function __construct(Invite $invite, User $byUser)
{

View File

@@ -20,7 +20,7 @@ namespace Chill\CalendarBundle\Messenger\Message;
class MSGraphChangeNotificationMessage
{
public function __construct(private array $content, private int $userId)
public function __construct(private readonly array $content, private readonly int $userId)
{
}

View File

@@ -24,7 +24,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
class AddressConverter
{
public function __construct(private AddressRender $addressRender, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -30,7 +30,7 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
*/
class EventsOnUserSubscriptionCreator
{
public function __construct(private LoggerInterface $logger, private MachineHttpClient $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private UrlGeneratorInterface $urlGenerator)
public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator)
{
}

View File

@@ -22,7 +22,7 @@ use Chill\MainBundle\Entity\Location;
class LocationConverter
{
public function __construct(private AddressConverter $addressConverter)
public function __construct(private readonly AddressConverter $addressConverter)
{
}

View File

@@ -42,7 +42,7 @@ class MSGraphUserRepository
;
SQL;
public function __construct(private EntityManagerInterface $entityManager)
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}

View File

@@ -28,12 +28,12 @@ class MachineHttpClient implements HttpClientInterface
{
use BearerAuthorizationTrait;
private HttpClientInterface $decoratedClient;
private readonly HttpClientInterface $decoratedClient;
/**
* @param HttpClientInterface $decoratedClient
*/
public function __construct(private MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null)
public function __construct(private readonly MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null)
{
$this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create();
}

View File

@@ -29,7 +29,7 @@ class MachineTokenStorage
private ?AccessTokenInterface $accessToken = null;
public function __construct(private Azure $azure, private ChillRedis $chillRedis)
public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis)
{
}

View File

@@ -31,15 +31,15 @@ use function array_key_exists;
*/
class MapCalendarToUser
{
public const EXPIRATION_SUBSCRIPTION_EVENT = 'subscription_events_expiration';
final public const EXPIRATION_SUBSCRIPTION_EVENT = 'subscription_events_expiration';
public const ID_SUBSCRIPTION_EVENT = 'subscription_events_id';
final public const ID_SUBSCRIPTION_EVENT = 'subscription_events_id';
public const METADATA_KEY = 'msgraph';
final public const METADATA_KEY = 'msgraph';
public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret';
final public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret';
public function __construct(private HttpClientInterface $machineHttpClient, private LoggerInterface $logger)
public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger)
{
}

View File

@@ -28,12 +28,12 @@ class OnBehalfOfUserHttpClient
{
use BearerAuthorizationTrait;
private HttpClientInterface $decoratedClient;
private readonly HttpClientInterface $decoratedClient;
/**
* @param HttpClientInterface $decoratedClient
*/
public function __construct(private OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null)
public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null)
{
$this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create();
}

View File

@@ -28,9 +28,9 @@ use TheNetworg\OAuth2\Client\Token\AccessToken;
*/
class OnBehalfOfUserTokenStorage
{
public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token';
final public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token';
public function __construct(private Azure $azure, private SessionInterface $session)
public function __construct(private readonly Azure $azure, private readonly SessionInterface $session)
{
}

View File

@@ -41,27 +41,27 @@ class RemoteEventConverter
* valid when the remote string contains also a timezone, like in
* lastModifiedDate.
*/
public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\\TH:i:s.u?P';
final public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\\TH:i:s.u?P';
/**
* Same as above, but sometimes the date is expressed with only 6 milliseconds.
*/
public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\\TH:i:s.uP';
final public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\\TH:i:s.uP';
private const REMOTE_DATE_FORMAT = 'Y-m-d\TH:i:s.u0';
private const REMOTE_DATETIME_WITHOUT_TZ_FORMAT = 'Y-m-d\TH:i:s.u?';
private DateTimeZone $defaultDateTimeZone;
private readonly DateTimeZone $defaultDateTimeZone;
private DateTimeZone $remoteDateTimeZone;
private readonly DateTimeZone $remoteDateTimeZone;
public function __construct(
private EngineInterface $engine,
private LocationConverter $locationConverter,
private LoggerInterface $logger,
private PersonRenderInterface $personRender,
private TranslatorInterface $translator
private readonly EngineInterface $engine,
private readonly LocationConverter $locationConverter,
private readonly LoggerInterface $logger,
private readonly PersonRenderInterface $personRender,
private readonly TranslatorInterface $translator
) {
$this->defaultDateTimeZone = (new DateTimeImmutable())->getTimezone();
$this->remoteDateTimeZone = self::getRemoteTimeZone();

View File

@@ -33,7 +33,7 @@ class CalendarRangeSyncer
/**
* @param MachineHttpClient $machineHttpClient
*/
public function __construct(private EntityManagerInterface $em, private LoggerInterface $logger, private HttpClientInterface $machineHttpClient)
public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient)
{
}

View File

@@ -32,7 +32,7 @@ use function in_array;
class CalendarSyncer
{
public function __construct(private LoggerInterface $logger, private HttpClientInterface $machineHttpClient, private UserRepositoryInterface $userRepository)
public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository)
{
}
@@ -119,7 +119,7 @@ class CalendarSyncer
}
$email = $attendee['emailAddress']['address'];
$emails[] = strtolower($email);
$emails[] = strtolower((string) $email);
$user = $this->userRepository->findOneByUsernameOrEmail($email);
if (null === $user) {

View File

@@ -45,7 +45,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
{
private array $cacheScheduleTimeForUser = [];
public function __construct(private CalendarRepository $calendarRepository, private CalendarRangeRepository $calendarRangeRepository, private HttpClientInterface $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private LoggerInterface $logger, private OnBehalfOfUserTokenStorage $tokenStorage, private OnBehalfOfUserHttpClient $userHttpClient, private RemoteEventConverter $remoteEventConverter, private TranslatorInterface $translator, private UrlGeneratorInterface $urlGenerator, private 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)
{
}

View File

@@ -29,7 +29,7 @@ use Doctrine\ORM\QueryBuilder;
class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
{
public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EntityManagerInterface $em)
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em)
{
}

View File

@@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository;
class CalendarDocRepository implements ObjectRepository, CalendarDocRepositoryInterface
{
private EntityRepository $repository;
private readonly EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -24,9 +24,9 @@ use function count;
class CalendarRangeRepository implements ObjectRepository
{
private EntityRepository $repository;
private readonly EntityRepository $repository;
public function __construct(private EntityManagerInterface $em)
public function __construct(private readonly EntityManagerInterface $em)
{
$this->repository = $em->getRepository(CalendarRange::class);
}

View File

@@ -25,9 +25,9 @@ use function count;
class CalendarRepository implements ObjectRepository
{
private EntityManagerInterface $em;
private readonly EntityManagerInterface $em;
private EntityRepository $repository;
private readonly EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository;
class InviteRepository implements ObjectRepository
{
private EntityRepository $entityRepository;
private readonly EntityRepository $entityRepository;
public function __construct(EntityManagerInterface $em)
{

View File

@@ -20,16 +20,16 @@ use function in_array;
class CalendarDocVoter extends Voter
{
public const EDIT = 'CHILL_CALENDAR_DOC_EDIT';
final public const EDIT = 'CHILL_CALENDAR_DOC_EDIT';
public const SEE = 'CHILL_CALENDAR_DOC_SEE';
final public const SEE = 'CHILL_CALENDAR_DOC_SEE';
private const ALL = [
'CHILL_CALENDAR_DOC_EDIT',
'CHILL_CALENDAR_DOC_SEE',
];
public function __construct(private Security $security)
public function __construct(private readonly Security $security)
{
}

View File

@@ -34,22 +34,18 @@ use Symfony\Component\Security\Core\Security;
class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
public const CREATE = 'CHILL_CALENDAR_CALENDAR_CREATE';
final public const CREATE = 'CHILL_CALENDAR_CALENDAR_CREATE';
public const DELETE = 'CHILL_CALENDAR_CALENDAR_DELETE';
final public const DELETE = 'CHILL_CALENDAR_CALENDAR_DELETE';
public const EDIT = 'CHILL_CALENDAR_CALENDAR_EDIT';
final public const EDIT = 'CHILL_CALENDAR_CALENDAR_EDIT';
public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE';
final public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE';
private AuthorizationHelperInterface $authorizationHelper;
private CenterResolverManagerInterface $centerResolverManager;
private VoterHelperInterface $voterHelper;
private readonly VoterHelperInterface $voterHelper;
public function __construct(
private Security $security,
private readonly Security $security,
VoterHelperFactoryInterface $voterHelperFactory
) {
$this->voterHelper = $voterHelperFactory

View File

@@ -24,7 +24,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
class InviteVoter extends Voter
{
public const ANSWER = 'CHILL_CALENDAR_INVITE_ANSWER';
final public const ANSWER = 'CHILL_CALENDAR_INVITE_ANSWER';
protected function supports($attribute, $subject): bool
{

View File

@@ -31,7 +31,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function count;
final class CalendarContext implements CalendarContextInterface
final readonly class CalendarContext implements CalendarContextInterface
{
public function __construct(private BaseContextData $baseContextData, private EntityManagerInterface $entityManager, private NormalizerInterface $normalizer, private PersonRender $personRender, private PersonRepository $personRepository, private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper)
{

View File

@@ -26,7 +26,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
class BulkCalendarShortMessageSender
{
public function __construct(private CalendarForShortMessageProvider $provider, private EntityManagerInterface $em, private LoggerInterface $logger, private MessageBusInterface $messageBus, private 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)
{
}

View File

@@ -26,7 +26,7 @@ use function count;
class CalendarForShortMessageProvider
{
public function __construct(private CalendarRepository $calendarRepository, private EntityManagerInterface $em, private RangeGeneratorInterface $rangeGenerator)
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator)
{
}

View File

@@ -24,7 +24,7 @@ use Symfony\Component\Templating\EngineInterface;
class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface
{
public function __construct(private EngineInterface $engine)
public function __construct(private readonly EngineInterface $engine)
{
}

View File

@@ -170,7 +170,7 @@ final class CalendarTypeTest extends TypeTestCase
return $obj;
},
explode(',', $args[0])
explode(',', (string) $args[0])
);
});