DX: apply rector rulesset up to PHP72

This commit is contained in:
2023-03-29 22:32:52 +02:00
parent 64b8ae3df1
commit b9a7530f7a
110 changed files with 194 additions and 229 deletions

View File

@@ -60,7 +60,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
public function execute(InputInterface $input, OutputInterface $output): int
{
$this->logger->info(__CLASS__ . ' execute command');
$this->logger->info(self::class . ' execute command');
$limit = 50;
$offset = 0;
@@ -71,7 +71,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
$created = 0;
$renewed = 0;
$this->logger->info(__CLASS__ . ' the number of user to get - renew', [
$this->logger->info(self::class . ' the number of user to get - renew', [
'total' => $total,
'expiration' => $expiration->format(DateTimeImmutable::ATOM),
]);
@@ -92,7 +92,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
// we first try to renew an existing subscription, if any.
// if not, or if it fails, we try to create a new one
if ($this->mapCalendarToUser->hasActiveSubscription($user)) {
$this->logger->debug(__CLASS__ . ' renew a subscription for', [
$this->logger->debug(self::class . ' renew a subscription for', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -104,7 +104,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
if (0 !== $expirationTs) {
++$renewed;
} else {
$this->logger->warning(__CLASS__ . ' could not renew subscription for a user', [
$this->logger->warning(self::class . ' could not renew subscription for a user', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -112,7 +112,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
}
if (!$this->mapCalendarToUser->hasActiveSubscription($user)) {
$this->logger->debug(__CLASS__ . ' create a subscription for', [
$this->logger->debug(self::class . ' create a subscription for', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -124,7 +124,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
if (0 !== $expirationTs) {
++$created;
} else {
$this->logger->warning(__CLASS__ . ' could not create subscription for a user', [
$this->logger->warning(self::class . ' could not create subscription for a user', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -139,7 +139,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
$this->em->clear();
}
$this->logger->warning(__CLASS__ . ' process executed', [
$this->logger->warning(self::class . ' process executed', [
'created' => $created,
'renewed' => $renewed,
]);

View File

@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_calendar');
$rootNode = $treeBuilder->getRootNode('chill_calendar');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()

View File

@@ -77,7 +77,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$user = $this->userRepository->find($changeNotificationMessage->getUserId());
if (null === $user) {
$this->logger->warning(__CLASS__ . ' notification concern non-existent user, skipping');
$this->logger->warning(self::class . ' notification concern non-existent user, skipping');
return;
}
@@ -86,7 +86,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$secret = $this->mapCalendarToUser->getSubscriptionSecret($user);
if ($secret !== ($notification['clientState'] ?? -1)) {
$this->logger->warning(__CLASS__ . ' could not validate secret, skipping');
$this->logger->warning(self::class . ' could not validate secret, skipping');
continue;
}
@@ -101,7 +101,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$this->calendarSyncer->handleCalendarSync($calendar, $notification, $user);
$this->em->flush();
} else {
$this->logger->info(__CLASS__ . ' id not found in any calendar nor calendar range');
$this->logger->info(self::class . ' id not found in any calendar nor calendar range');
}
}

View File

@@ -59,7 +59,7 @@ class CalendarRangeSyncer
}
$calendarRange->preventEnqueueChanges = true;
$this->logger->info(__CLASS__ . ' remove a calendar range because deleted on remote calendar');
$this->logger->info(self::class . ' remove a calendar range because deleted on remote calendar');
$this->em->remove($calendarRange);
break;
@@ -71,7 +71,7 @@ class CalendarRangeSyncer
$notification['resource']
)->toArray();
} catch (ClientExceptionInterface $clientException) {
$this->logger->warning(__CLASS__ . ' could not retrieve event from ms graph. Already deleted ?', [
$this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
'calendarRangeId' => $calendarRange->getId(),
'remoteEventId' => $notification['resource'],
]);
@@ -82,7 +82,7 @@ class CalendarRangeSyncer
$lastModified = RemoteEventConverter::convertStringDateWithTimezone($new['lastModifiedDateTime']);
if ($calendarRange->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
$this->logger->info(__CLASS__ . ' change key is equals. Source is probably a local update', [
$this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
'calendarRangeId' => $calendarRange->getId(),
'remoteEventId' => $notification['resource'],
]);

View File

@@ -79,7 +79,7 @@ class CalendarSyncer
$notification['resource']
)->toArray();
} catch (ClientExceptionInterface $clientException) {
$this->logger->warning(__CLASS__ . ' could not retrieve event from ms graph. Already deleted ?', [
$this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
'calendarId' => $calendar->getId(),
'remoteEventId' => $notification['resource'],
]);
@@ -96,7 +96,7 @@ class CalendarSyncer
);
if ($calendar->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
$this->logger->info(__CLASS__ . ' change key is equals. Source is probably a local update', [
$this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
'calendarRangeId' => $calendar->getId(),
'remoteEventId' => $notification['resource'],
]);

View File

@@ -66,6 +66,6 @@ class BulkCalendarShortMessageSender
$this->em->refresh($calendar);
}
$this->logger->info(__CLASS__ . 'a bulk of messages was sent', ['count_calendars' => $countCalendars, 'count_sms' => $countSms]);
$this->logger->info(self::class . 'a bulk of messages was sent', ['count_calendars' => $countCalendars, 'count_sms' => $countSms]);
}
}