apply rector rules: php up to php82

This commit is contained in:
2023-07-19 23:16:01 +02:00
parent 7b637d1287
commit 023a29cb78
744 changed files with 1369 additions and 1381 deletions

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

@@ -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)
{
}