diff options
author | Pytal <24800714+Pytal@users.noreply.github.com> | 2021-06-23 09:56:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 09:56:28 -0700 |
commit | 9ed379da22e4dd0b54fed4241798aec47d6e3f2c (patch) | |
tree | 279fb154fc813240ba34fa4cbbe525e9627e76b5 /apps | |
parent | 19a84512d688ae899f0f8efc37b89d2a9676cc48 (diff) | |
parent | 6d5cfe0c66f7010d552f0aa234a13c2e91a933bd (diff) | |
download | nextcloud-server-9ed379da22e4dd0b54fed4241798aec47d6e3f2c.tar.gz nextcloud-server-9ed379da22e4dd0b54fed4241798aec47d6e3f2c.zip |
Merge pull request #27635 from nextcloud/fix/datetime-constants
Fix usage of DateTime constants
Diffstat (limited to 'apps')
8 files changed, 15 insertions, 15 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 71cdd2cdd69..456b9f8b42d 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -390,8 +390,8 @@ class EmailProvider extends AbstractProvider { $diff = $dtstartDt->diff($dtendDt); - $dtstartDt = new \DateTime($dtstartDt->format(\DateTime::ATOM)); - $dtendDt = new \DateTime($dtendDt->format(\DateTime::ATOM)); + $dtstartDt = new \DateTime($dtstartDt->format(\DateTimeInterface::ATOM)); + $dtendDt = new \DateTime($dtendDt->format(\DateTimeInterface::ATOM)); if ($isAllDay) { // One day event diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index 7b53fac766a..fb123960df8 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -137,10 +137,10 @@ class PushProvider extends AbstractProvider { ? ((string) $vevent->LOCATION) : null, 'all_day' => $start instanceof Property\ICalendar\Date, - 'start_atom' => $start->getDateTime()->format(\DateTime::ATOM), + 'start_atom' => $start->getDateTime()->format(\DateTimeInterface::ATOM), 'start_is_floating' => $start->isFloating(), 'start_timezone' => $start->getDateTime()->getTimezone()->getName(), - 'end_atom' => $end->getDateTime()->format(\DateTime::ATOM), + 'end_atom' => $end->getDateTime()->format(\DateTimeInterface::ATOM), 'end_is_floating' => $end->isFloating(), 'end_timezone' => $end->getDateTime()->getTimezone()->getName(), ]; diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index 6dbe95db244..8535c55054a 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -144,7 +144,7 @@ class Notifier implements INotifier { private function prepareNotificationSubject(INotification $notification): void { $parameters = $notification->getSubjectParameters(); - $startTime = \DateTime::createFromFormat(\DateTime::ATOM, $parameters['start_atom']); + $startTime = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['start_atom']); $now = $this->timeFactory->getDateTime(); $title = $this->getTitleFromParameters($parameters); @@ -221,8 +221,8 @@ class Notifier implements INotifier { * @throws \Exception */ private function generateDateString(array $parameters):string { - $startDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['start_atom']); - $endDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['end_atom']); + $startDateTime = DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['start_atom']); + $endDateTime = DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['end_atom']); // If the event has already ended, dismiss the notification if ($endDateTime < $this->timeFactory->getDateTime()) { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 63290e76e61..18efe618483 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -441,8 +441,8 @@ class IMipPlugin extends SabreIMipPlugin { $diff = $dtstartDt->diff($dtendDt); - $dtstartDt = new \DateTime($dtstartDt->format(\DateTime::ATOM)); - $dtendDt = new \DateTime($dtendDt->format(\DateTime::ATOM)); + $dtstartDt = new \DateTime($dtstartDt->format(\DateTimeInterface::ATOM)); + $dtendDt = new \DateTime($dtendDt->format(\DateTimeInterface::ATOM)); if ($isAllDay) { // One day event diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 71231f65c24..45e911db182 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -376,7 +376,7 @@ class FileSearchBackend implements ISearchBackend { if (is_numeric($value)) { return max(0, 0 + $value); } - $date = \DateTime::createFromFormat(\DateTime::ATOM, $value); + $date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $value); return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0; default: return $value; diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php index 4d33367b345..614ddabb7ef 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php @@ -76,7 +76,7 @@ class AppleProvisioningNode implements INode, IProperties { return [ '{DAV:}getcontentlength' => 42, - '{DAV:}getlastmodified' => $datetime->format(\DateTime::RFC2822), + '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822), ]; } diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 5cfa7d30c5a..07fc90397ed 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -181,8 +181,8 @@ class EventsSearchProvider extends ACalendarSearchProvider { $dtStart = $eventComponent->DTSTART; $dtEnd = $this->getDTEndForEvent($eventComponent); $isAllDayEvent = $dtStart instanceof Property\ICalendar\Date; - $startDateTime = new \DateTime($dtStart->getDateTime()->format(\DateTime::ATOM)); - $endDateTime = new \DateTime($dtEnd->getDateTime()->format(\DateTime::ATOM)); + $startDateTime = new \DateTime($dtStart->getDateTime()->format(\DateTimeInterface::ATOM)); + $endDateTime = new \DateTime($dtEnd->getDateTime()->format(\DateTimeInterface::ATOM)); if ($isAllDayEvent) { $endDateTime->modify('-1 day'); diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index c8f1d0d288b..763720ee4ae 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -153,13 +153,13 @@ class TasksSearchProvider extends ACalendarSearchProvider { */ protected function generateSubline(Component $taskComponent): string { if ($taskComponent->COMPLETED) { - $completedDateTime = new \DateTime($taskComponent->COMPLETED->getDateTime()->format(\DateTime::ATOM)); + $completedDateTime = new \DateTime($taskComponent->COMPLETED->getDateTime()->format(\DateTimeInterface::ATOM)); $formattedDate = $this->l10n->l('date', $completedDateTime, ['width' => 'medium']); return $this->l10n->t('Completed on %s', [$formattedDate]); } if ($taskComponent->DUE) { - $dueDateTime = new \DateTime($taskComponent->DUE->getDateTime()->format(\DateTime::ATOM)); + $dueDateTime = new \DateTime($taskComponent->DUE->getDateTime()->format(\DateTimeInterface::ATOM)); $formattedDate = $this->l10n->l('date', $dueDateTime, ['width' => 'medium']); if ($taskComponent->DUE->hasTime()) { |