diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..34568c64a --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,7 @@ +# .git-blame-ignore-revs + +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +# Update to coding-standard 1.2.3 +3b3935b4e754ccbc00d3abb71ab6836f3db5b026 diff --git a/.nextcloudignore b/.nextcloudignore index 0c75b3337..0420a7fde 100644 --- a/.nextcloudignore +++ b/.nextcloudignore @@ -3,6 +3,7 @@ .editorconfig .eslintrc.js .git +.git-blame-ignore-revs .github .gitignore .gitlab-ci.yml diff --git a/lib/Controller/ViewController.php b/lib/Controller/ViewController.php index 220c34422..0969090ba 100644 --- a/lib/Controller/ViewController.php +++ b/lib/Controller/ViewController.php @@ -77,7 +77,7 @@ public function index():TemplateResponse { * @return FileDisplayResponse * @throws NotPermittedException */ - public function getCalendarDotSvg(string $color = "#0082c9"): FileDisplayResponse { + public function getCalendarDotSvg(string $color = '#0082c9'): FileDisplayResponse { $validColor = '#0082c9'; $color = trim(urldecode($color), '#'); if (preg_match('/^([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) { diff --git a/lib/Dashboard/CalendarWidget.php b/lib/Dashboard/CalendarWidget.php index a092d5da4..f6094278f 100644 --- a/lib/Dashboard/CalendarWidget.php +++ b/lib/Dashboard/CalendarWidget.php @@ -146,7 +146,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7): $this->dateTimeFormatter->formatTimeSpan(DateTime::createFromImmutable($startDate)), $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('calendar.view.index', ['objectId' => $calendarEvent['uid']])), $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('calendar.view.getCalendarDotSvg', ['color' => $calendar->getDisplayColor() ?? '#0082c9'])), // default NC blue fallback - (string) $startDate->getTimestamp(), + (string)$startDate->getTimestamp(), ); $widgetItems[] = $widget; } diff --git a/lib/Db/AppointmentConfig.php b/lib/Db/AppointmentConfig.php index a6b17ffb0..2bdd4778f 100644 --- a/lib/Db/AppointmentConfig.php +++ b/lib/Db/AppointmentConfig.php @@ -138,7 +138,7 @@ public function __construct() { * Total length of one slot of the appointment config * in minutes * - * @return int Minutes of Appointment slot length + * @return int Minutes of Appointment slot length */ public function getTotalLength(): int { return $this->getLength() + $this->getPreparationDuration() + $this->getFollowupDuration(); diff --git a/lib/Exception/ClientException.php b/lib/Exception/ClientException.php index 2f6b6cf55..343910c01 100644 --- a/lib/Exception/ClientException.php +++ b/lib/Exception/ClientException.php @@ -16,7 +16,7 @@ class ClientException extends Exception { /** @var int|null */ private $httpCode; - public function __construct($message = "", + public function __construct($message = '', $code = 0, ?Throwable $previous = null, ?int $httpCode = null) { diff --git a/lib/Exception/ServiceException.php b/lib/Exception/ServiceException.php index d8514a503..ed7cc8591 100644 --- a/lib/Exception/ServiceException.php +++ b/lib/Exception/ServiceException.php @@ -14,7 +14,7 @@ class ServiceException extends Exception { /** @var int|null */ private $httpCode; - public function __construct($message = "", + public function __construct($message = '', $code = 0, ?Throwable $previous = null, ?int $httpCode = null) { diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index 62a5282b5..89e130f24 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -45,6 +45,6 @@ public function handle(Event $event): void { $this->bookingService->deleteByUser($event->getUser()); $this->appointmentConfigService->deleteByUser($event->getUser()); - $this->logger->info("Calendar appointments cleaned up for deleted user " . $event->getUser()->getUID()); + $this->logger->info('Calendar appointments cleaned up for deleted user ' . $event->getUser()->getUID()); } } diff --git a/lib/Service/Appointments/AppointmentConfigService.php b/lib/Service/Appointments/AppointmentConfigService.php index b3f946cb4..d7e275f64 100644 --- a/lib/Service/Appointments/AppointmentConfigService.php +++ b/lib/Service/Appointments/AppointmentConfigService.php @@ -84,7 +84,7 @@ public function update(AppointmentConfig $appointmentConfig): AppointmentConfig public function findById(int $id): AppointmentConfig { try { return $this->mapper->findById($id); - } catch (DbException | DoesNotExistException | MultipleObjectsReturnedException $e) { + } catch (DbException|DoesNotExistException|MultipleObjectsReturnedException $e) { throw new ClientException( 'Could not find a record for id', $e->getCode(), diff --git a/lib/Service/Appointments/BookingCalendarWriter.php b/lib/Service/Appointments/BookingCalendarWriter.php index fc6147f96..e18a9e2c7 100644 --- a/lib/Service/Appointments/BookingCalendarWriter.php +++ b/lib/Service/Appointments/BookingCalendarWriter.php @@ -156,7 +156,7 @@ public function write(AppointmentConfig $config, ); if ($defaultReminder !== 'none') { $alarm = $vcalendar->createComponent('VALARM'); - $alarm->add($vcalendar->createProperty('TRIGGER', '-' . $this->secondsToIso8601Duration(abs((int) $defaultReminder)), ['RELATED' => 'START'])); + $alarm->add($vcalendar->createProperty('TRIGGER', '-' . $this->secondsToIso8601Duration(abs((int)$defaultReminder)), ['RELATED' => 'START'])); $alarm->add($vcalendar->createProperty('ACTION', 'DISPLAY')); $vcalendar->VEVENT->add($alarm); } diff --git a/lib/Service/Appointments/MailService.php b/lib/Service/Appointments/MailService.php index 568216f93..1a19e4e19 100644 --- a/lib/Service/Appointments/MailService.php +++ b/lib/Service/Appointments/MailService.php @@ -101,7 +101,7 @@ public function sendConfirmationEmail(Booking $booking, AppointmentConfig $confi $template->setSubject($subject); // Heading - $summary = $this->l10n->t("Dear %s, please confirm your booking", [$booking->getDisplayName()]); + $summary = $this->l10n->t('Dear %s, please confirm your booking', [$booking->getDisplayName()]); $template->addHeading($summary); $bookingUrl = $this->urlGenerator->linkToRouteAbsolute('calendar.booking.confirmBooking', ['token' => $booking->getToken()]); @@ -190,7 +190,7 @@ public function sendBookingInformationEmail(Booking $booking, AppointmentConfig $template->addFooter(); - $attachment = $this->mailer->createAttachment($calendar, "appointment.ics", "text/calendar"); + $attachment = $this->mailer->createAttachment($calendar, 'appointment.ics', 'text/calendar'); $message->attach($attachment); $message->useTemplate($template); @@ -219,7 +219,7 @@ private function addBulletList(IEMailTemplate $template, // determain timezone depending on who is getting the message (Requestee/Requester) $tzid = ($recipient) ? $config->getAvailabilityAsArray()['timezoneId'] : $booking->getTimezone(); - $dtstart = new \DateTime("now", new \DateTimeZone($booking->getTimezone())); // generate DateTime with booking time zone + $dtstart = new \DateTime('now', new \DateTimeZone($booking->getTimezone())); // generate DateTime with booking time zone $dtstart->setTimestamp($booking->getStart()); // set booking time stamp $l = $this->lFactory->findGenericLanguage(); @@ -324,7 +324,7 @@ public function sendOrganizerBookingInformationEmail(Booking $booking, Appointme public function sendOrganizerBookingInformationNotification(Booking $booking, AppointmentConfig $config): void { $tzid = $config->getAvailabilityAsArray()['timezoneId']; // extract time zone from appointment configuration - $dtstart = new \DateTime("now", new \DateTimeZone($booking->getTimezone())); // generate DateTime with booking time zone + $dtstart = new \DateTime('now', new \DateTimeZone($booking->getTimezone())); // generate DateTime with booking time zone $dtstart->setTimestamp($booking->getStart()); // set booking time stamp $relativeDateTime = $this->dateFormatter->formatDateTimeRelativeDay( @@ -339,7 +339,7 @@ public function sendOrganizerBookingInformationNotification(Booking $booking, Ap $notification ->setApp('calendar') ->setUser($config->getUserId()) - ->setObject('booking', (string) $booking->getId()) + ->setObject('booking', (string)$booking->getId()) ->setSubject('booking_accepted', [ 'type' => 'highlight', diff --git a/lib/Service/Appointments/TimezoneGenerator.php b/lib/Service/Appointments/TimezoneGenerator.php index b39f4ba1e..8d7ac406d 100644 --- a/lib/Service/Appointments/TimezoneGenerator.php +++ b/lib/Service/Appointments/TimezoneGenerator.php @@ -27,7 +27,7 @@ class TimezoneGenerator { * @psalm-suppress NoValue * * @return null|VTimeZone A Sabre\VObject\Component object representing a VTIMEZONE definition - * or null if no timezone information is available + * or null if no timezone information is available */ public function generateVtimezone(string $timezone, int $from, int $to): ?VTimeZone { try { diff --git a/tests/php/integration/Composer/AutoloaderTest.php b/tests/php/integration/Composer/AutoloaderTest.php index 42d1bc72f..344bf7a8c 100644 --- a/tests/php/integration/Composer/AutoloaderTest.php +++ b/tests/php/integration/Composer/AutoloaderTest.php @@ -38,7 +38,7 @@ protected function tearDown(): void { public function testLoadDynamicClass(): void { $rand = Server::get(ISecureRandom::class); $className = ucfirst($rand->generate(10, ISecureRandom::CHAR_LOWER)); - $namespace = "OCA\\Calendar"; + $namespace = 'OCA\\Calendar'; file_put_contents(self::getClassPath($className), <<getTimestamp(), + (string)$start->getTimestamp(), ); $widgets = $this->widget->getItems($userId); diff --git a/tests/php/unit/Service/Appointments/MailServiceTest.php b/tests/php/unit/Service/Appointments/MailServiceTest.php index 6580bd984..2369b8844 100644 --- a/tests/php/unit/Service/Appointments/MailServiceTest.php +++ b/tests/php/unit/Service/Appointments/MailServiceTest.php @@ -54,7 +54,7 @@ class MailServiceTest extends TestCase { /** @var mixed|IFactory|MockObject */ private $lFactory; - /** @var IManager|MockObject */ + /** @var IManager|MockObject */ private $notificationManager; /** @var MailService */ @@ -333,15 +333,15 @@ public function testSendBookingInformationEmail(): void { $config->setLocation('Test'); $config->setAvailabilityAsArray( [ - "timezoneId" => "Europe/Berlin", - "slots" => [ - "MO" => [["start" => 1713153660, "end" => 1713239940]], - "TU" => [["start" => 1713153660, "end" => 1713239940]], - "WE" => [["start" => 1713153660, "end" => 1713239940]], - "TH" => [["start" => 1713153660, "end" => 1713239940]], - "FR" => [["start" => 1713153660, "end" => 1713239940]], - "SA" => [["start" => 1713153660, "end" => 1713239940]], - "SU" => [["start" => 1713153660, "end" => 1713239940]] + 'timezoneId' => 'Europe/Berlin', + 'slots' => [ + 'MO' => [['start' => 1713153660, 'end' => 1713239940]], + 'TU' => [['start' => 1713153660, 'end' => 1713239940]], + 'WE' => [['start' => 1713153660, 'end' => 1713239940]], + 'TH' => [['start' => 1713153660, 'end' => 1713239940]], + 'FR' => [['start' => 1713153660, 'end' => 1713239940]], + 'SA' => [['start' => 1713153660, 'end' => 1713239940]], + 'SU' => [['start' => 1713153660, 'end' => 1713239940]] ] ] ); @@ -506,15 +506,15 @@ public function testSendOrganizerBookingInformationEmail(): void { $config->setLocation('Test'); $config->setAvailabilityAsArray( [ - "timezoneId" => "Europe/Berlin", - "slots" => [ - "MO" => [["start" => 1713153660, "end" => 1713239940]], - "TU" => [["start" => 1713153660, "end" => 1713239940]], - "WE" => [["start" => 1713153660, "end" => 1713239940]], - "TH" => [["start" => 1713153660, "end" => 1713239940]], - "FR" => [["start" => 1713153660, "end" => 1713239940]], - "SA" => [["start" => 1713153660, "end" => 1713239940]], - "SU" => [["start" => 1713153660, "end" => 1713239940]] + 'timezoneId' => 'Europe/Berlin', + 'slots' => [ + 'MO' => [['start' => 1713153660, 'end' => 1713239940]], + 'TU' => [['start' => 1713153660, 'end' => 1713239940]], + 'WE' => [['start' => 1713153660, 'end' => 1713239940]], + 'TH' => [['start' => 1713153660, 'end' => 1713239940]], + 'FR' => [['start' => 1713153660, 'end' => 1713239940]], + 'SA' => [['start' => 1713153660, 'end' => 1713239940]], + 'SU' => [['start' => 1713153660, 'end' => 1713239940]] ] ] ); @@ -592,15 +592,15 @@ public function testSendOrganizerBookingInformationEmailDifferentTZ(): void { $config->setLocation('Test'); $config->setAvailabilityAsArray( [ - "timezoneId" => "Europe/Berlin", - "slots" => [ - "MO" => [["start" => 1713153660, "end" => 1713239940]], - "TU" => [["start" => 1713153660, "end" => 1713239940]], - "WE" => [["start" => 1713153660, "end" => 1713239940]], - "TH" => [["start" => 1713153660, "end" => 1713239940]], - "FR" => [["start" => 1713153660, "end" => 1713239940]], - "SA" => [["start" => 1713153660, "end" => 1713239940]], - "SU" => [["start" => 1713153660, "end" => 1713239940]] + 'timezoneId' => 'Europe/Berlin', + 'slots' => [ + 'MO' => [['start' => 1713153660, 'end' => 1713239940]], + 'TU' => [['start' => 1713153660, 'end' => 1713239940]], + 'WE' => [['start' => 1713153660, 'end' => 1713239940]], + 'TH' => [['start' => 1713153660, 'end' => 1713239940]], + 'FR' => [['start' => 1713153660, 'end' => 1713239940]], + 'SA' => [['start' => 1713153660, 'end' => 1713239940]], + 'SU' => [['start' => 1713153660, 'end' => 1713239940]] ] ] ); @@ -680,15 +680,15 @@ public function testSendOrganizerBookingInformationEmailFailed(): void { $config->setLocation('Test'); $config->setAvailabilityAsArray( [ - "timezoneId" => "Europe/Berlin", - "slots" => [ - "MO" => [["start" => 1713153660, "end" => 1713239940]], - "TU" => [["start" => 1713153660, "end" => 1713239940]], - "WE" => [["start" => 1713153660, "end" => 1713239940]], - "TH" => [["start" => 1713153660, "end" => 1713239940]], - "FR" => [["start" => 1713153660, "end" => 1713239940]], - "SA" => [["start" => 1713153660, "end" => 1713239940]], - "SU" => [["start" => 1713153660, "end" => 1713239940]] + 'timezoneId' => 'Europe/Berlin', + 'slots' => [ + 'MO' => [['start' => 1713153660, 'end' => 1713239940]], + 'TU' => [['start' => 1713153660, 'end' => 1713239940]], + 'WE' => [['start' => 1713153660, 'end' => 1713239940]], + 'TH' => [['start' => 1713153660, 'end' => 1713239940]], + 'FR' => [['start' => 1713153660, 'end' => 1713239940]], + 'SA' => [['start' => 1713153660, 'end' => 1713239940]], + 'SU' => [['start' => 1713153660, 'end' => 1713239940]] ] ] ); @@ -779,15 +779,15 @@ public function testSendOrganizerBookingNotification(): void { $config->setLocation('Test'); $config->setAvailabilityAsArray( [ - "timezoneId" => "Europe/Berlin", - "slots" => [ - "MO" => [["start" => 1713153660, "end" => 1713239940]], - "TU" => [["start" => 1713153660, "end" => 1713239940]], - "WE" => [["start" => 1713153660, "end" => 1713239940]], - "TH" => [["start" => 1713153660, "end" => 1713239940]], - "FR" => [["start" => 1713153660, "end" => 1713239940]], - "SA" => [["start" => 1713153660, "end" => 1713239940]], - "SU" => [["start" => 1713153660, "end" => 1713239940]] + 'timezoneId' => 'Europe/Berlin', + 'slots' => [ + 'MO' => [['start' => 1713153660, 'end' => 1713239940]], + 'TU' => [['start' => 1713153660, 'end' => 1713239940]], + 'WE' => [['start' => 1713153660, 'end' => 1713239940]], + 'TH' => [['start' => 1713153660, 'end' => 1713239940]], + 'FR' => [['start' => 1713153660, 'end' => 1713239940]], + 'SA' => [['start' => 1713153660, 'end' => 1713239940]], + 'SU' => [['start' => 1713153660, 'end' => 1713239940]] ] ] ); diff --git a/tests/php/unit/Service/CalendarInitialStateServiceTest.php b/tests/php/unit/Service/CalendarInitialStateServiceTest.php index a274fbf02..2689d292d 100755 --- a/tests/php/unit/Service/CalendarInitialStateServiceTest.php +++ b/tests/php/unit/Service/CalendarInitialStateServiceTest.php @@ -39,7 +39,7 @@ class CalendarInitialStateServiceTest extends TestCase { /** @var CalendarInitialStateService */ private $service; - /** @var CompareVersion|MockObject*/ + /** @var CompareVersion|MockObject */ private $compareVersion; protected function setUp(): void { diff --git a/vendor-bin/cs-fixer/composer.lock b/vendor-bin/cs-fixer/composer.lock index 9557a5ad1..02d3cb72b 100644 --- a/vendor-bin/cs-fixer/composer.lock +++ b/vendor-bin/cs-fixer/composer.lock @@ -9,16 +9,16 @@ "packages-dev": [ { "name": "nextcloud/coding-standard", - "version": "v1.2.1", + "version": "v1.2.3", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e" + "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", - "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/bc9c53a5306114b60c4363057aff9c2ed10a54da", + "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da", "shasum": "" }, "require": { @@ -44,22 +44,22 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.3" }, - "time": "2024-02-01T14:54:37+00:00" + "time": "2024-08-23T14:32:32+00:00" }, { "name": "php-cs-fixer/shim", - "version": "v3.49.0", + "version": "v3.62.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/shim.git", - "reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52" + "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", - "reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/7a91d5ce45c486f5b445d95901228507a02f60ae", + "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae", "shasum": "" }, "require": { @@ -96,9 +96,9 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/PHP-CS-Fixer/shim/issues", - "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.49.0" + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.62.0" }, - "time": "2024-02-02T00:42:09+00:00" + "time": "2024-08-07T17:03:46+00:00" } ], "aliases": [],