From d4e758f7f41347f5a0515bf827926f4928a33641 Mon Sep 17 00:00:00 2001 From: Ren Xie Liu Date: Wed, 8 May 2024 16:41:59 +0800 Subject: [PATCH 1/2] Fix customized timezone guesser --- .../GuessFromCustomizedTimeZone.php | 5 ++- tests/VObject/TimeZoneUtilTest.php | 45 ++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lib/TimezoneGuesser/GuessFromCustomizedTimeZone.php b/lib/TimezoneGuesser/GuessFromCustomizedTimeZone.php index 61d531cdf..f1f4f6899 100644 --- a/lib/TimezoneGuesser/GuessFromCustomizedTimeZone.php +++ b/lib/TimezoneGuesser/GuessFromCustomizedTimeZone.php @@ -45,11 +45,12 @@ public function guess(VTimeZone $vtimezone, ?bool $failIfUncertain = false): ?\D $daylightIterator = $daylight ? new RRuleIterator($daylightRRule, $standardIterator->current()) : null; $daylightIterator && $daylightIterator->next(); + $day = 24 * 60 * 60; foreach ($timezones as $timezone) { $tz = new \DateTimeZone($timezone); // check standard $timestamp = $standardIterator->current()->getTimestamp(); - $transitions = $tz->getTransitions($timestamp, $timestamp + 1); + $transitions = $tz->getTransitions($timestamp + $day, $timestamp + $day + 1); if (empty($transitions)) { continue; } @@ -66,7 +67,7 @@ public function guess(VTimeZone $vtimezone, ?bool $failIfUncertain = false): ?\D // check daylight $timestamp = $daylightIterator->current()->getTimestamp(); - $transitions = $tz->getTransitions($timestamp, $timestamp + 1); + $transitions = $tz->getTransitions($timestamp + $day, $timestamp + $day + 1); if (empty($transitions)) { continue; } diff --git a/tests/VObject/TimeZoneUtilTest.php b/tests/VObject/TimeZoneUtilTest.php index 1069b437a..b82556219 100644 --- a/tests/VObject/TimeZoneUtilTest.php +++ b/tests/VObject/TimeZoneUtilTest.php @@ -671,11 +671,54 @@ public function testCustomizedTimeZone(): void self::assertSame(11 * 60 * 60, $tz->getOffset($start)); } + public function testCustomizedTimeZone2(): void + { + $ics = <<getName()); + $start = new \DateTimeImmutable('2022-04-25'); + self::assertSame(2 * 60 * 60, $tz->getOffset($start)); + + $start = new \DateTimeImmutable('2022-11-10'); + self::assertSame(60 * 60, $tz->getOffset($start)); + } + public function testCustomizedTimeZoneWithoutDaylight(): void { $ics = $this->getCustomizedICS(); $tz = TimeZoneUtil::getTimeZone('Customized Time Zone', Reader::read($ics)); - self::assertSame('Asia/Brunei', $tz->getName()); + self::assertSame('Antarctica/Casey', $tz->getName()); $start = new \DateTimeImmutable('2022-04-25'); self::assertSame(8 * 60 * 60, $tz->getOffset($start)); } From 8595cf9db942f3d229c3341929cdd88a809ee325 Mon Sep 17 00:00:00 2001 From: Ren Xie Liu Date: Wed, 8 May 2024 17:29:57 +0800 Subject: [PATCH 2/2] Run phpcs fixer --- bin/bench_freebusygenerator.php | 6 +- lib/Component.php | 3 +- lib/Component/VCalendar.php | 150 +++--- lib/Component/VCard.php | 2 +- lib/DateTimeParser.php | 16 +- lib/Document.php | 8 +- lib/FreeBusyGenerator.php | 4 +- lib/ITip/Broker.php | 8 +- lib/Property.php | 2 +- lib/Property/ICalendar/DateTime.php | 4 +- lib/Property/Text.php | 2 +- lib/Recur/EventIterator.php | 2 +- lib/Splitter/ICalendar.php | 2 +- lib/Splitter/VCard.php | 2 +- lib/TimeZoneUtil.php | 4 +- lib/VCardConverter.php | 14 +- lib/timezonedata/windowszones.php | 450 +++++++++--------- tests/VObject/Component/VCalendarTest.php | 4 +- tests/VObject/Component/VCardTest.php | 4 +- tests/VObject/Component/VFreeBusyTest.php | 3 +- tests/VObject/ComponentTest.php | 12 +- tests/VObject/FreeBusyGeneratorTest.php | 2 +- .../VObject/ITip/BrokerAttendeeReplyTest.php | 18 +- tests/VObject/JCardTest.php | 18 +- tests/VObject/Parser/JsonTest.php | 18 +- tests/VObject/PropertyTest.php | 2 +- tests/VObject/Recur/RRuleIteratorTest.php | 12 +- tests/VObject/VCardConverterTest.php | 2 +- 28 files changed, 384 insertions(+), 390 deletions(-) diff --git a/bin/bench_freebusygenerator.php b/bin/bench_freebusygenerator.php index 891335190..ae859f487 100644 --- a/bin/bench_freebusygenerator.php +++ b/bin/bench_freebusygenerator.php @@ -24,9 +24,9 @@ $bench->parse->stop(); $repeat = 100; -$start = new \DateTime('2000-01-01'); -$end = new \DateTime('2020-01-01'); -$timeZone = new \DateTimeZone('America/Toronto'); +$start = new DateTime('2000-01-01'); +$end = new DateTime('2020-01-01'); +$timeZone = new DateTimeZone('America/Toronto'); $bench->fb->start(); diff --git a/lib/Component.php b/lib/Component.php index 426695470..2bcf21917 100644 --- a/lib/Component.php +++ b/lib/Component.php @@ -2,7 +2,6 @@ namespace Sabre\VObject; -use Sabre\VObject; use Sabre\Xml; /** @@ -15,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License * - * @property VObject\Property\FlatText UID + * @property Property\FlatText UID */ class Component extends Node { diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php index b317e02c8..7b6e66e88 100644 --- a/lib/Component/VCalendar.php +++ b/lib/Component/VCalendar.php @@ -20,8 +20,8 @@ * * @property VEvent VEVENT * @property VJournal VJOURNAL - * @property VObject\Property\Text ORG - * @property VObject\Property\FlatText METHOD + * @property Property\Text ORG + * @property Property\FlatText METHOD */ class VCalendar extends VObject\Document { @@ -51,21 +51,21 @@ class VCalendar extends VObject\Document * List of value-types, and which classes they map to. */ public static array $valueMap = [ - 'BINARY' => VObject\Property\Binary::class, - 'BOOLEAN' => VObject\Property\Boolean::class, - 'CAL-ADDRESS' => VObject\Property\ICalendar\CalAddress::class, - 'DATE' => VObject\Property\ICalendar\Date::class, - 'DATE-TIME' => VObject\Property\ICalendar\DateTime::class, - 'DURATION' => VObject\Property\ICalendar\Duration::class, - 'FLOAT' => VObject\Property\FloatValue::class, - 'INTEGER' => VObject\Property\IntegerValue::class, - 'PERIOD' => VObject\Property\ICalendar\Period::class, - 'RECUR' => VObject\Property\ICalendar\Recur::class, - 'TEXT' => VObject\Property\Text::class, - 'TIME' => VObject\Property\Time::class, - 'UNKNOWN' => VObject\Property\Unknown::class, // jCard / jCal-only. - 'URI' => VObject\Property\Uri::class, - 'UTC-OFFSET' => VObject\Property\UtcOffset::class, + 'BINARY' => Property\Binary::class, + 'BOOLEAN' => Property\Boolean::class, + 'CAL-ADDRESS' => Property\ICalendar\CalAddress::class, + 'DATE' => Property\ICalendar\Date::class, + 'DATE-TIME' => Property\ICalendar\DateTime::class, + 'DURATION' => Property\ICalendar\Duration::class, + 'FLOAT' => Property\FloatValue::class, + 'INTEGER' => Property\IntegerValue::class, + 'PERIOD' => Property\ICalendar\Period::class, + 'RECUR' => Property\ICalendar\Recur::class, + 'TEXT' => Property\Text::class, + 'TIME' => Property\Time::class, + 'UNKNOWN' => Property\Unknown::class, // jCard / jCal-only. + 'URI' => Property\Uri::class, + 'UTC-OFFSET' => Property\UtcOffset::class, ]; /** @@ -73,78 +73,78 @@ class VCalendar extends VObject\Document */ public static array $propertyMap = [ // Calendar properties - 'CALSCALE' => VObject\Property\FlatText::class, - 'METHOD' => VObject\Property\FlatText::class, - 'PRODID' => VObject\Property\FlatText::class, - 'VERSION' => VObject\Property\FlatText::class, + 'CALSCALE' => Property\FlatText::class, + 'METHOD' => Property\FlatText::class, + 'PRODID' => Property\FlatText::class, + 'VERSION' => Property\FlatText::class, // Component properties - 'ATTACH' => VObject\Property\Uri::class, - 'CATEGORIES' => VObject\Property\Text::class, - 'CLASS' => VObject\Property\FlatText::class, - 'COMMENT' => VObject\Property\FlatText::class, - 'DESCRIPTION' => VObject\Property\FlatText::class, - 'GEO' => VObject\Property\FloatValue::class, - 'LOCATION' => VObject\Property\FlatText::class, - 'PERCENT-COMPLETE' => VObject\Property\IntegerValue::class, - 'PRIORITY' => VObject\Property\IntegerValue::class, - 'RESOURCES' => VObject\Property\Text::class, - 'STATUS' => VObject\Property\FlatText::class, - 'SUMMARY' => VObject\Property\FlatText::class, + 'ATTACH' => Property\Uri::class, + 'CATEGORIES' => Property\Text::class, + 'CLASS' => Property\FlatText::class, + 'COMMENT' => Property\FlatText::class, + 'DESCRIPTION' => Property\FlatText::class, + 'GEO' => Property\FloatValue::class, + 'LOCATION' => Property\FlatText::class, + 'PERCENT-COMPLETE' => Property\IntegerValue::class, + 'PRIORITY' => Property\IntegerValue::class, + 'RESOURCES' => Property\Text::class, + 'STATUS' => Property\FlatText::class, + 'SUMMARY' => Property\FlatText::class, // Date and Time Component Properties - 'COMPLETED' => VObject\Property\ICalendar\DateTime::class, - 'DTEND' => VObject\Property\ICalendar\DateTime::class, - 'DUE' => VObject\Property\ICalendar\DateTime::class, - 'DTSTART' => VObject\Property\ICalendar\DateTime::class, - 'DURATION' => VObject\Property\ICalendar\Duration::class, - 'FREEBUSY' => VObject\Property\ICalendar\Period::class, - 'TRANSP' => VObject\Property\FlatText::class, + 'COMPLETED' => Property\ICalendar\DateTime::class, + 'DTEND' => Property\ICalendar\DateTime::class, + 'DUE' => Property\ICalendar\DateTime::class, + 'DTSTART' => Property\ICalendar\DateTime::class, + 'DURATION' => Property\ICalendar\Duration::class, + 'FREEBUSY' => Property\ICalendar\Period::class, + 'TRANSP' => Property\FlatText::class, // Time Zone Component Properties - 'TZID' => VObject\Property\FlatText::class, - 'TZNAME' => VObject\Property\FlatText::class, - 'TZOFFSETFROM' => VObject\Property\UtcOffset::class, - 'TZOFFSETTO' => VObject\Property\UtcOffset::class, - 'TZURL' => VObject\Property\Uri::class, + 'TZID' => Property\FlatText::class, + 'TZNAME' => Property\FlatText::class, + 'TZOFFSETFROM' => Property\UtcOffset::class, + 'TZOFFSETTO' => Property\UtcOffset::class, + 'TZURL' => Property\Uri::class, // Relationship Component Properties - 'ATTENDEE' => VObject\Property\ICalendar\CalAddress::class, - 'CONTACT' => VObject\Property\FlatText::class, - 'ORGANIZER' => VObject\Property\ICalendar\CalAddress::class, - 'RECURRENCE-ID' => VObject\Property\ICalendar\DateTime::class, - 'RELATED-TO' => VObject\Property\FlatText::class, - 'URL' => VObject\Property\Uri::class, - 'UID' => VObject\Property\FlatText::class, + 'ATTENDEE' => Property\ICalendar\CalAddress::class, + 'CONTACT' => Property\FlatText::class, + 'ORGANIZER' => Property\ICalendar\CalAddress::class, + 'RECURRENCE-ID' => Property\ICalendar\DateTime::class, + 'RELATED-TO' => Property\FlatText::class, + 'URL' => Property\Uri::class, + 'UID' => Property\FlatText::class, // Recurrence Component Properties - 'EXDATE' => VObject\Property\ICalendar\DateTime::class, - 'RDATE' => VObject\Property\ICalendar\DateTime::class, - 'RRULE' => VObject\Property\ICalendar\Recur::class, - 'EXRULE' => VObject\Property\ICalendar\Recur::class, // Deprecated since rfc5545 + 'EXDATE' => Property\ICalendar\DateTime::class, + 'RDATE' => Property\ICalendar\DateTime::class, + 'RRULE' => Property\ICalendar\Recur::class, + 'EXRULE' => Property\ICalendar\Recur::class, // Deprecated since rfc5545 // Alarm Component Properties - 'ACTION' => VObject\Property\FlatText::class, - 'REPEAT' => VObject\Property\IntegerValue::class, - 'TRIGGER' => VObject\Property\ICalendar\Duration::class, + 'ACTION' => Property\FlatText::class, + 'REPEAT' => Property\IntegerValue::class, + 'TRIGGER' => Property\ICalendar\Duration::class, // Change Management Component Properties - 'CREATED' => VObject\Property\ICalendar\DateTime::class, - 'DTSTAMP' => VObject\Property\ICalendar\DateTime::class, - 'LAST-MODIFIED' => VObject\Property\ICalendar\DateTime::class, - 'SEQUENCE' => VObject\Property\IntegerValue::class, + 'CREATED' => Property\ICalendar\DateTime::class, + 'DTSTAMP' => Property\ICalendar\DateTime::class, + 'LAST-MODIFIED' => Property\ICalendar\DateTime::class, + 'SEQUENCE' => Property\IntegerValue::class, // Request Status - 'REQUEST-STATUS' => VObject\Property\Text::class, + 'REQUEST-STATUS' => Property\Text::class, // Additions from draft-daboo-valarm-extensions-04 - 'ALARM-AGENT' => VObject\Property\Text::class, - 'ACKNOWLEDGED' => VObject\Property\ICalendar\DateTime::class, - 'PROXIMITY' => VObject\Property\Text::class, - 'DEFAULT-ALARM' => VObject\Property\Boolean::class, + 'ALARM-AGENT' => Property\Text::class, + 'ACKNOWLEDGED' => Property\ICalendar\DateTime::class, + 'PROXIMITY' => Property\Text::class, + 'DEFAULT-ALARM' => Property\Boolean::class, // Additions from draft-daboo-calendar-availability-05 - 'BUSYTYPE' => VObject\Property\Text::class, + 'BUSYTYPE' => Property\Text::class, ]; /** @@ -166,10 +166,10 @@ public function getDocumentType(): int * * @return VObject\Component[] */ - public function getBaseComponents(string $componentName = null): array + public function getBaseComponents(?string $componentName = null): array { $isBaseComponent = function ($component): bool { - if (!$component instanceof VObject\Component) { + if (!$component instanceof Component) { return false; } if ('VTIMEZONE' === $component->name) { @@ -214,13 +214,11 @@ public function getBaseComponents(string $componentName = null): array * If there is no such component, null will be returned. * * @param string|null $componentName filter by component name - * - * @return VObject\Component|null */ - public function getBaseComponent(string $componentName = null): ?Component + public function getBaseComponent(?string $componentName = null): ?Component { $isBaseComponent = function ($component): bool { - if (!$component instanceof VObject\Component) { + if (!$component instanceof Component) { return false; } if ('VTIMEZONE' === $component->name) { @@ -275,7 +273,7 @@ public function getBaseComponent(string $componentName = null): ?Component * @throws InvalidDataException * @throws VObject\Recur\MaxInstancesExceededException */ - public function expand(\DateTimeInterface $start, \DateTimeInterface $end, \DateTimeZone $timeZone = null): VCalendar + public function expand(\DateTimeInterface $start, \DateTimeInterface $end, ?\DateTimeZone $timeZone = null): VCalendar { $newChildren = []; $recurringEvents = []; diff --git a/lib/Component/VCard.php b/lib/Component/VCard.php index 0f2a5e266..6bbec5717 100644 --- a/lib/Component/VCard.php +++ b/lib/Component/VCard.php @@ -82,7 +82,7 @@ class VCard extends VObject\Document 'ROLE' => VObject\Property\FlatText::class, 'LOGO' => VObject\Property\Binary::class, // 'AGENT' => 'Sabre\\VObject\\Property\\', // Todo: is an embedded vCard. Probably rare, so - // not supported at the moment + // not supported at the moment 'ORG' => VObject\Property\Text::class, 'NOTE' => VObject\Property\FlatText::class, 'REV' => VObject\Property\VCard\TimeStamp::class, diff --git a/lib/DateTimeParser.php b/lib/DateTimeParser.php index 5ce9f207a..a8130b8bc 100644 --- a/lib/DateTimeParser.php +++ b/lib/DateTimeParser.php @@ -27,7 +27,7 @@ class DateTimeParser * * @throws InvalidDataException */ - public static function parseDateTime(string $dt, \DateTimeZone $tz = null): \DateTimeImmutable + public static function parseDateTime(string $dt, ?\DateTimeZone $tz = null): \DateTimeImmutable { // Format is YYYYMMDD + "T" + hhmmss $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/', $dt, $matches); @@ -54,7 +54,7 @@ public static function parseDateTime(string $dt, \DateTimeZone $tz = null): \Dat * * @throws InvalidDataException */ - public static function parseDate(string $date, \DateTimeZone $tz = null): \DateTimeImmutable + public static function parseDate(string $date, ?\DateTimeZone $tz = null): \DateTimeImmutable { // Format is YYYYMMDD $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches); @@ -98,12 +98,12 @@ public static function parseDuration(string $duration): \DateInterval } $parts = [ - 'week', - 'day', - 'hour', - 'minute', - 'second', - ]; + 'week', + 'day', + 'hour', + 'minute', + 'second', + ]; foreach ($parts as $part) { $matches[$part] = isset($matches[$part]) && $matches[$part] ? (int) $matches[$part] : 0; diff --git a/lib/Document.php b/lib/Document.php index 2a249580b..fa789a8de 100644 --- a/lib/Document.php +++ b/lib/Document.php @@ -2,8 +2,6 @@ namespace Sabre\VObject; -use Sabre\VObject; - /** * Document. * @@ -18,7 +16,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License * - * @property VObject\Property\FlatText VERSION + * @property Property\FlatText VERSION */ abstract class Document extends Component { @@ -140,7 +138,7 @@ public function create(string $name) * an iCalendar object, this may be something like CALSCALE:GREGORIAN. To * ensure that this does not happen, set $defaults to false. */ - public function createComponent(string $name, array $children = null, bool $defaults = true): Component + public function createComponent(string $name, ?array $children = null, bool $defaults = true): Component { $name = strtoupper($name); $class = Component::class; @@ -169,7 +167,7 @@ public function createComponent(string $name, array $children = null, bool $defa * * @throws InvalidDataException */ - public function createProperty(string $name, $value = null, array $parameters = null, string $valueType = null): Property + public function createProperty(string $name, $value = null, ?array $parameters = null, ?string $valueType = null): Property { // If there's a . in the name, it means it's prefixed by a group name. if (false !== ($i = strpos($name, '.'))) { diff --git a/lib/FreeBusyGenerator.php b/lib/FreeBusyGenerator.php index 2f222e4e5..424826034 100644 --- a/lib/FreeBusyGenerator.php +++ b/lib/FreeBusyGenerator.php @@ -72,7 +72,7 @@ class FreeBusyGenerator * Check the setTimeRange and setObjects methods for details about the * arguments. */ - public function __construct(\DateTimeInterface $start = null, \DateTimeInterface $end = null, $objects = null, \DateTimeZone $timeZone = null) + public function __construct(?\DateTimeInterface $start = null, ?\DateTimeInterface $end = null, $objects = null, ?\DateTimeZone $timeZone = null) { $this->setTimeRange($start, $end); @@ -138,7 +138,7 @@ public function setObjects($objects): void * * @throws \Exception */ - public function setTimeRange(\DateTimeInterface $start = null, \DateTimeInterface $end = null): void + public function setTimeRange(?\DateTimeInterface $start = null, ?\DateTimeInterface $end = null): void { if (!$start) { $start = new \DateTimeImmutable(Settings::$minDate); diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php index f792fd990..9cbc3f72b 100644 --- a/lib/ITip/Broker.php +++ b/lib/ITip/Broker.php @@ -113,7 +113,7 @@ class Broker * @throws MaxInstancesExceededException * @throws NoInstancesException */ - public function processMessage(Message $itipMessage, VCalendar $existingObject = null) + public function processMessage(Message $itipMessage, ?VCalendar $existingObject = null) { // We only support events at the moment. if ('VEVENT' !== $itipMessage->component) { @@ -268,7 +268,7 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null): array * This is message from an organizer, and is either a new event * invite, or an update to an existing one. */ - protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar + protected function processMessageRequest(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar { if (!$existingObject) { // This is a new invite, and we're just going to copy over @@ -296,7 +296,7 @@ protected function processMessageRequest(Message $itipMessage, VCalendar $existi * attendee got removed from an event, or an event got cancelled * altogether. */ - protected function processMessageCancel(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar + protected function processMessageCancel(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar { if (!$existingObject) { // The event didn't exist in the first place, so we're just @@ -321,7 +321,7 @@ protected function processMessageCancel(Message $itipMessage, VCalendar $existin * @throws MaxInstancesExceededException * @throws NoInstancesException */ - protected function processMessageReply(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar + protected function processMessageReply(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar { // A reply can only be processed based on an existing object. // If the object is not available, the reply is ignored. diff --git a/lib/Property.php b/lib/Property.php index 53a252fb2..574099e65 100644 --- a/lib/Property.php +++ b/lib/Property.php @@ -61,7 +61,7 @@ abstract class Property extends Node * @param array $parameters List of parameters * @param string|null $group The vcard property group */ - public function __construct(Component $root, ?string $name, $value = null, array $parameters = [], string $group = null) + public function __construct(Component $root, ?string $name, $value = null, array $parameters = [], ?string $group = null) { $this->name = $name; $this->group = $group; diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php index 1892991a2..b506bc6be 100644 --- a/lib/Property/ICalendar/DateTime.php +++ b/lib/Property/ICalendar/DateTime.php @@ -127,7 +127,7 @@ public function isFloating(): bool * * @throws InvalidDataException */ - public function getDateTime(\DateTimeZone $timeZone = null, bool $activeCustomizedGuesser = true): ?\DateTimeImmutable + public function getDateTime(?\DateTimeZone $timeZone = null, bool $activeCustomizedGuesser = true): ?\DateTimeImmutable { $dt = $this->getDateTimes($timeZone, $activeCustomizedGuesser); if (!$dt) { @@ -148,7 +148,7 @@ public function getDateTime(\DateTimeZone $timeZone = null, bool $activeCustomiz * * @throws InvalidDataException */ - public function getDateTimes(\DateTimeZone $timeZone = null, bool $activeCustomizedGuesser = true): array + public function getDateTimes(?\DateTimeZone $timeZone = null, bool $activeCustomizedGuesser = true): array { // Does the property have a TZID? /** @var Property\FlatText $tzid */ diff --git a/lib/Property/Text.php b/lib/Property/Text.php index c606ad812..c59029059 100644 --- a/lib/Property/Text.php +++ b/lib/Property/Text.php @@ -64,7 +64,7 @@ class Text extends Property * @param array $parameters List of parameters * @param string|null $group The vcard property group */ - public function __construct(Component $root, string $name, $value = null, array $parameters = [], string $group = null) + public function __construct(Component $root, string $name, $value = null, array $parameters = [], ?string $group = null) { // There's two types of multi-valued text properties: // 1. multivalue properties. diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php index d79cf3132..2c93bcf4e 100644 --- a/lib/Recur/EventIterator.php +++ b/lib/Recur/EventIterator.php @@ -89,7 +89,7 @@ class EventIterator implements \Iterator * @throws NoInstancesException * @throws InvalidDataException */ - public function __construct($input, string $uid = null, \DateTimeZone $timeZone = null) + public function __construct($input, ?string $uid = null, ?\DateTimeZone $timeZone = null) { if (is_null($timeZone)) { $timeZone = new \DateTimeZone('UTC'); diff --git a/lib/Splitter/ICalendar.php b/lib/Splitter/ICalendar.php index ccf0d1add..79f0bd443 100644 --- a/lib/Splitter/ICalendar.php +++ b/lib/Splitter/ICalendar.php @@ -46,7 +46,7 @@ public function __construct($input, int $options = 0) { $data = VObject\Reader::read($input, $options); - if (!$data instanceof VObject\Component\VCalendar) { + if (!$data instanceof VCalendar) { throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.'); } diff --git a/lib/Splitter/VCard.php b/lib/Splitter/VCard.php index e63ae837d..40775a335 100644 --- a/lib/Splitter/VCard.php +++ b/lib/Splitter/VCard.php @@ -61,7 +61,7 @@ public function getNext(): ?Component try { $object = $this->parser->parse(); - if (!$object instanceof VObject\Component\VCard) { + if (!$object instanceof Component\VCard) { throw new VObject\ParseException('The supplied input contained non-VCARD data.'); } } catch (VObject\EofException $e) { diff --git a/lib/TimeZoneUtil.php b/lib/TimeZoneUtil.php index 79a5920af..b75a6310d 100644 --- a/lib/TimeZoneUtil.php +++ b/lib/TimeZoneUtil.php @@ -81,7 +81,7 @@ private function addFinder(string $key, TimezoneFinder $finder): void * Alternatively, if $failIfUncertain is set to true, it will throw an * exception if we cannot accurately determine the timezone. */ - private function findTimeZone(string $tzid, Component $vcalendar = null, bool $failIfUncertain = false, bool $activeCustomizedGuesser = false): \DateTimeZone + private function findTimeZone(string $tzid, ?Component $vcalendar = null, bool $failIfUncertain = false, bool $activeCustomizedGuesser = false): \DateTimeZone { foreach ($this->timezoneFinders as $timezoneFinder) { $timezone = $timezoneFinder->find($tzid, $failIfUncertain); @@ -136,7 +136,7 @@ public static function addTimezoneFinder(string $key, TimezoneFinder $finder): v self::getInstance()->addFinder($key, $finder); } - public static function getTimeZone(string $tzid, Component $vcalendar = null, bool $failIfUncertain = false, bool $activeCustomizedGuesser = true): \DateTimeZone + public static function getTimeZone(string $tzid, ?Component $vcalendar = null, bool $failIfUncertain = false, bool $activeCustomizedGuesser = true): \DateTimeZone { return self::getInstance()->findTimeZone($tzid, $vcalendar, $failIfUncertain, $activeCustomizedGuesser); } diff --git a/lib/VCardConverter.php b/lib/VCardConverter.php index 88d74602c..ff8fe3f81 100644 --- a/lib/VCardConverter.php +++ b/lib/VCardConverter.php @@ -93,8 +93,8 @@ protected function convertProperty(Component\VCard $input, Component\VCard $outp ); if (Document::VCARD30 === $targetVersion) { - if ($property instanceof Property\Uri && in_array($property->name, ['PHOTO', 'LOGO', 'SOUND'])) { - /** @var Property\Uri $newProperty */ + if ($property instanceof Uri && in_array($property->name, ['PHOTO', 'LOGO', 'SOUND'])) { + /** @var Uri $newProperty */ $newProperty = $this->convertUriToBinary($output, $newProperty); } elseif ($property instanceof Property\VCard\DateAndOrTime) { // In vCard 4, the birth year may be optional. This is not the @@ -153,8 +153,8 @@ protected function convertProperty(Component\VCard $input, Component\VCard $outp return; } - if ($property instanceof Property\Binary) { - /** @var Property\Binary $newProperty */ + if ($property instanceof Binary) { + /** @var Binary $newProperty */ $newProperty = $this->convertBinaryToUri($output, $newProperty, $parameters); } elseif ($property instanceof Property\VCard\DateAndOrTime && isset($parameters['X-APPLE-OMIT-YEAR'])) { // If a property such as BDAY contained 'X-APPLE-OMIT-YEAR', @@ -256,7 +256,7 @@ protected function convertProperty(Component\VCard $input, Component\VCard $outp * * @throws InvalidDataException */ - protected function convertBinaryToUri(Component\VCard $output, Property\Binary $newProperty, array &$parameters): Uri + protected function convertBinaryToUri(Component\VCard $output, Binary $newProperty, array &$parameters): Uri { $value = $newProperty->getValue(); /** @var Uri $newProperty */ @@ -304,11 +304,11 @@ protected function convertBinaryToUri(Component\VCard $output, Property\Binary $ * be valid in vCard 3.0 as well, we should convert those to BINARY if * possible, to improve compatibility. * - * @return Property\Binary|Property\Uri|null + * @return Binary|Uri|null * * @throws InvalidDataException */ - protected function convertUriToBinary(Component\VCard $output, Property\Uri $newProperty): Property + protected function convertUriToBinary(Component\VCard $output, Uri $newProperty): Property { $value = $newProperty->getValue(); diff --git a/lib/timezonedata/windowszones.php b/lib/timezonedata/windowszones.php index c1bd8026f..209a9141b 100644 --- a/lib/timezonedata/windowszones.php +++ b/lib/timezonedata/windowszones.php @@ -11,229 +11,229 @@ */ return [ - 'AUS Central Standard Time' => 'Australia/Darwin', - 'AUS Eastern Standard Time' => 'Australia/Sydney', - 'Afghanistan Standard Time' => 'Asia/Kabul', - 'Alaskan Standard Time' => 'America/Anchorage', - 'Aleutian Standard Time' => 'America/Adak', - 'Altai Standard Time' => 'Asia/Barnaul', - 'Arab Standard Time' => 'Asia/Riyadh', - 'Arabian Standard Time' => 'Asia/Dubai', - 'Arabic Standard Time' => 'Asia/Baghdad', - 'Argentina Standard Time' => 'America/Buenos_Aires', - 'Astrakhan Standard Time' => 'Europe/Astrakhan', - 'Atlantic Standard Time' => 'America/Halifax', - 'Aus Central W. Standard Time' => 'Australia/Eucla', - 'Azerbaijan Standard Time' => 'Asia/Baku', - 'Azores Standard Time' => 'Atlantic/Azores', - 'Bahia Standard Time' => 'America/Bahia', - 'Bangladesh Standard Time' => 'Asia/Dhaka', - 'Belarus Standard Time' => 'Europe/Minsk', - 'Bougainville Standard Time' => 'Pacific/Bougainville', - 'Canada Central Standard Time' => 'America/Regina', - 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde', - 'Caucasus Standard Time' => 'Asia/Yerevan', - 'Cen. Australia Standard Time' => 'Australia/Adelaide', - 'Central America Standard Time' => 'America/Guatemala', - 'Central Asia Standard Time' => 'Asia/Almaty', - 'Central Brazilian Standard Time' => 'America/Cuiaba', - 'Central Europe Standard Time' => 'Europe/Budapest', - 'Central European Standard Time' => 'Europe/Warsaw', - 'Central Pacific Standard Time' => 'Pacific/Guadalcanal', - 'Central Standard Time' => 'America/Chicago', - 'Central Standard Time (Mexico)' => 'America/Mexico_City', - 'Chatham Islands Standard Time' => 'Pacific/Chatham', - 'China Standard Time' => 'Asia/Shanghai', - 'Cuba Standard Time' => 'America/Havana', - 'Dateline Standard Time' => 'Etc/GMT+12', - 'E. Africa Standard Time' => 'Africa/Nairobi', - 'E. Australia Standard Time' => 'Australia/Brisbane', - 'E. Europe Standard Time' => 'Europe/Chisinau', - 'E. South America Standard Time' => 'America/Sao_Paulo', - 'Easter Island Standard Time' => 'Pacific/Easter', - 'Eastern Standard Time' => 'America/New_York', - 'Eastern Standard Time (Mexico)' => 'America/Cancun', - 'Egypt Standard Time' => 'Africa/Cairo', - 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg', - 'FLE Standard Time' => 'Europe/Kiev', - 'Fiji Standard Time' => 'Pacific/Fiji', - 'GMT Standard Time' => 'Europe/London', - 'GTB Standard Time' => 'Europe/Bucharest', - 'Georgian Standard Time' => 'Asia/Tbilisi', - 'Greenland Standard Time' => 'Atlantic/Stanley', - 'Greenwich Standard Time' => 'Atlantic/Reykjavik', - 'Haiti Standard Time' => 'America/Port-au-Prince', - 'Hawaiian Standard Time' => 'Pacific/Honolulu', - 'India Standard Time' => 'Asia/Calcutta', - 'Iran Standard Time' => 'Asia/Tehran', - 'Israel Standard Time' => 'Asia/Jerusalem', - 'Jordan Standard Time' => 'Asia/Amman', - 'Kaliningrad Standard Time' => 'Europe/Kaliningrad', - 'Korea Standard Time' => 'Asia/Seoul', - 'Libya Standard Time' => 'Africa/Tripoli', - 'Line Islands Standard Time' => 'Pacific/Kiritimati', - 'Lord Howe Standard Time' => 'Australia/Lord_Howe', - 'Magadan Standard Time' => 'Asia/Magadan', - 'Magallanes Standard Time' => 'America/Punta_Arenas', - 'Marquesas Standard Time' => 'Pacific/Marquesas', - 'Mauritius Standard Time' => 'Indian/Mauritius', - 'Middle East Standard Time' => 'Asia/Beirut', - 'Montevideo Standard Time' => 'America/Montevideo', - 'Morocco Standard Time' => 'Africa/Casablanca', - 'Mountain Standard Time' => 'America/Denver', - 'Mountain Standard Time (Mexico)' => 'America/Chihuahua', - 'Myanmar Standard Time' => 'Asia/Rangoon', - 'N. Central Asia Standard Time' => 'Asia/Novosibirsk', - 'Namibia Standard Time' => 'Africa/Windhoek', - 'Nepal Standard Time' => 'Asia/Katmandu', - 'New Zealand Standard Time' => 'Pacific/Auckland', - 'Newfoundland Standard Time' => 'America/St_Johns', - 'Norfolk Standard Time' => 'Pacific/Norfolk', - 'North Asia East Standard Time' => 'Asia/Irkutsk', - 'North Asia Standard Time' => 'Asia/Krasnoyarsk', - 'North Korea Standard Time' => 'Asia/Pyongyang', - 'Omsk Standard Time' => 'Asia/Omsk', - 'Pacific SA Standard Time' => 'America/Santiago', - 'Pacific Standard Time' => 'America/Los_Angeles', - 'Pacific Standard Time (Mexico)' => 'America/Tijuana', - 'Pakistan Standard Time' => 'Asia/Karachi', - 'Paraguay Standard Time' => 'America/Asuncion', - 'Qyzylorda Standard Time' => 'Asia/Qyzylorda', - 'Romance Standard Time' => 'Europe/Paris', - 'Russia Time Zone 10' => 'Asia/Srednekolymsk', - 'Russia Time Zone 11' => 'Asia/Kamchatka', - 'Russia Time Zone 3' => 'Europe/Samara', - 'Russian Standard Time' => 'Europe/Moscow', - 'SA Eastern Standard Time' => 'America/Cayenne', - 'SA Pacific Standard Time' => 'America/Bogota', - 'SA Western Standard Time' => 'America/La_Paz', - 'SE Asia Standard Time' => 'Asia/Bangkok', - 'Saint Pierre Standard Time' => 'America/Miquelon', - 'Sakhalin Standard Time' => 'Asia/Sakhalin', - 'Samoa Standard Time' => 'Pacific/Apia', - 'Sao Tome Standard Time' => 'Africa/Sao_Tome', - 'Saratov Standard Time' => 'Europe/Saratov', - 'Singapore Standard Time' => 'Asia/Singapore', - 'South Africa Standard Time' => 'Africa/Johannesburg', - 'Sri Lanka Standard Time' => 'Asia/Colombo', - 'Sudan Standard Time' => 'Africa/Khartoum', - 'Syria Standard Time' => 'Asia/Damascus', - 'Taipei Standard Time' => 'Asia/Taipei', - 'Tasmania Standard Time' => 'Australia/Hobart', - 'Tocantins Standard Time' => 'America/Araguaina', - 'Tokyo Standard Time' => 'Asia/Tokyo', - 'Tomsk Standard Time' => 'Asia/Tomsk', - 'Tonga Standard Time' => 'Pacific/Tongatapu', - 'Transbaikal Standard Time' => 'Asia/Chita', - 'Turkey Standard Time' => 'Europe/Istanbul', - 'Turks And Caicos Standard Time' => 'America/Grand_Turk', - 'US Eastern Standard Time' => 'America/Indianapolis', - 'US Mountain Standard Time' => 'America/Phoenix', - 'UTC' => 'Etc/GMT', - 'UTC+12' => 'Etc/GMT-12', - 'UTC+13' => 'Etc/GMT-13', - 'UTC-02' => 'Etc/GMT+2', - 'UTC-08' => 'Etc/GMT+8', - 'UTC-09' => 'Etc/GMT+9', - 'UTC-11' => 'Etc/GMT+11', - 'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar', - 'Venezuela Standard Time' => 'America/Caracas', - 'Vladivostok Standard Time' => 'Asia/Vladivostok', - 'Volgograd Standard Time' => 'Europe/Volgograd', - 'W. Australia Standard Time' => 'Australia/Perth', - 'W. Central Africa Standard Time' => 'Africa/Lagos', - 'W. Europe Standard Time' => 'Europe/Berlin', - 'W. Mongolia Standard Time' => 'Asia/Hovd', - 'West Asia Standard Time' => 'Asia/Tashkent', - 'West Bank Standard Time' => 'Asia/Hebron', - 'West Pacific Standard Time' => 'Pacific/Port_Moresby', - 'Yakutsk Standard Time' => 'Asia/Yakutsk', - 'Yukon Standard Time' => 'America/Whitehorse', - 'coordinated universal time-11' => 'Pacific/Pago_Pago', - 'aleutian islands' => 'America/Adak', - 'marquesas islands' => 'Pacific/Marquesas', - 'coordinated universal time-09' => 'America/Anchorage', - 'baja california' => 'America/Tijuana', - 'coordinated universal time-08' => 'Pacific/Pitcairn', - 'chihuahua, la paz, mazatlan' => 'America/Chihuahua', - 'easter island' => 'Pacific/Easter', - 'guadalajara, mexico city, monterrey' => 'America/Mexico_City', - 'bogota, lima, quito, rio branco' => 'America/Bogota', - 'chetumal' => 'America/Cancun', - 'haiti' => 'America/Port-au-Prince', - 'havana' => 'America/Havana', - 'turks and caicos' => 'America/Grand_Turk', - 'asuncion' => 'America/Asuncion', - 'caracas' => 'America/Caracas', - 'cuiaba' => 'America/Cuiaba', - 'georgetown, la paz, manaus, san juan' => 'America/La_Paz', - 'araguaina' => 'America/Araguaina', - 'cayenne, fortaleza' => 'America/Cayenne', - 'city of buenos aires' => 'America/Argentina/Buenos_Aires', - 'punta arenas' => 'America/Punta_Arenas', - 'saint pierre and miquelon' => 'America/Miquelon', - 'salvador' => 'America/Bahia', - 'coordinated universal time-02' => 'America/Noronha', - 'mid-atlantic - old' => 'America/Noronha', - 'cabo verde is' => 'Atlantic/Cape_Verde', - 'coordinated universal time' => 'UTC', - 'dublin, edinburgh, lisbon, london' => 'Europe/London', - 'monrovia, reykjavik' => 'Atlantic/Reykjavik', - 'belgrade, bratislava, budapest, ljubljana, prague' => 'Europe/Budapest', - 'casablanca' => 'Africa/Casablanca', - 'sao tome' => 'Africa/Sao_Tome', - 'sarajevo, skopje, warsaw, zagreb' => 'Europe/Warsaw', - 'amman' => 'Asia/Amman', - 'athens, bucharest' => 'Europe/Bucharest', - 'beirut' => 'Asia/Beirut', - 'chisinau' => 'Europe/Chisinau', - 'damascus' => 'Asia/Damascus', - 'gaza, hebron' => 'Asia/Hebron', - 'jerusalem' => 'Asia/Jerusalem', - 'kaliningrad' => 'Europe/Kaliningrad', - 'khartoum' => 'Africa/Khartoum', - 'tripoli' => 'Africa/Tripoli', - 'windhoek' => 'Africa/Windhoek', - 'istanbul' => 'Europe/Istanbul', - 'kuwait, riyadh' => 'Asia/Riyadh', - 'minsk' => 'Europe/Minsk', - 'moscow, st petersburg' => 'Europe/Moscow', - 'nairobi' => 'Africa/Nairobi', - 'astrakhan, ulyanovsk' => 'Europe/Astrakhan', - 'izhevsk, samara' => 'Europe/Samara', - 'port louis' => 'Indian/Mauritius', - 'saratov' => 'Europe/Saratov', - 'ashgabat, tashkent' => 'Asia/Tashkent', - 'islamabad, karachi' => 'Asia/Karachi', - 'chennai, kolkata, mumbai, new delhi' => 'Asia/Kolkata', - 'sri jayawardenepura' => 'Asia/Colombo', - 'kathmandu' => 'Asia/Kathmandu', - 'astana' => 'Asia/Almaty', - 'dhaka' => 'Asia/Dhaka', - 'yangon (rangoon)' => 'Asia/Rangoon', - 'barnaul, gorno-altaysk' => 'Asia/Barnaul', - 'tomsk' => 'Asia/Tomsk', - 'beijing, chongqing, hong kong, urumqi' => 'Asia/Shanghai', - 'perth' => 'Australia/Perth', - 'ulaanbaatar' => 'Asia/Ulaanbaatar', - 'eucla' => 'Australia/Eucla', - 'chita' => 'Asia/Chita', - 'seoul' => 'Asia/Seoul', - 'adelaide' => 'Australia/Adelaide', - 'brisbane' => 'Australia/Brisbane', - 'canberra, melbourne, sydney' => 'Australia/Sydney', - 'hobart' => 'Australia/Hobart', - 'lord howe island' => 'Australia/Lord_Howe', - 'bougainville island' => 'Pacific/Bougainville', - 'chokurdakh' => 'Asia/Srednekolymsk', - 'norfolk island' => 'Pacific/Norfolk', - 'solomon is, new caledonia' => 'Pacific/Guadalcanal', - 'anadyr, petropavlovsk-kamchatsky' => 'Asia/Kamchatka', - 'coordinated universal time+12' => 'Pacific/Tarawa', - 'petropavlovsk-kamchatsky - old' => 'Asia/Anadyr', - 'chatham islands' => 'Pacific/Chatham', - 'coordinated universal time+13' => 'Pacific/Fakaofo', - "nuku'alofa" => 'Pacific/Tongatapu', - 'kiritimati island' => 'Pacific/Kiritimati', - 'helsinki, kyiv, riga, sofia, tallinn, vilnius' => 'Europe/Helsinki', + 'AUS Central Standard Time' => 'Australia/Darwin', + 'AUS Eastern Standard Time' => 'Australia/Sydney', + 'Afghanistan Standard Time' => 'Asia/Kabul', + 'Alaskan Standard Time' => 'America/Anchorage', + 'Aleutian Standard Time' => 'America/Adak', + 'Altai Standard Time' => 'Asia/Barnaul', + 'Arab Standard Time' => 'Asia/Riyadh', + 'Arabian Standard Time' => 'Asia/Dubai', + 'Arabic Standard Time' => 'Asia/Baghdad', + 'Argentina Standard Time' => 'America/Buenos_Aires', + 'Astrakhan Standard Time' => 'Europe/Astrakhan', + 'Atlantic Standard Time' => 'America/Halifax', + 'Aus Central W. Standard Time' => 'Australia/Eucla', + 'Azerbaijan Standard Time' => 'Asia/Baku', + 'Azores Standard Time' => 'Atlantic/Azores', + 'Bahia Standard Time' => 'America/Bahia', + 'Bangladesh Standard Time' => 'Asia/Dhaka', + 'Belarus Standard Time' => 'Europe/Minsk', + 'Bougainville Standard Time' => 'Pacific/Bougainville', + 'Canada Central Standard Time' => 'America/Regina', + 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde', + 'Caucasus Standard Time' => 'Asia/Yerevan', + 'Cen. Australia Standard Time' => 'Australia/Adelaide', + 'Central America Standard Time' => 'America/Guatemala', + 'Central Asia Standard Time' => 'Asia/Almaty', + 'Central Brazilian Standard Time' => 'America/Cuiaba', + 'Central Europe Standard Time' => 'Europe/Budapest', + 'Central European Standard Time' => 'Europe/Warsaw', + 'Central Pacific Standard Time' => 'Pacific/Guadalcanal', + 'Central Standard Time' => 'America/Chicago', + 'Central Standard Time (Mexico)' => 'America/Mexico_City', + 'Chatham Islands Standard Time' => 'Pacific/Chatham', + 'China Standard Time' => 'Asia/Shanghai', + 'Cuba Standard Time' => 'America/Havana', + 'Dateline Standard Time' => 'Etc/GMT+12', + 'E. Africa Standard Time' => 'Africa/Nairobi', + 'E. Australia Standard Time' => 'Australia/Brisbane', + 'E. Europe Standard Time' => 'Europe/Chisinau', + 'E. South America Standard Time' => 'America/Sao_Paulo', + 'Easter Island Standard Time' => 'Pacific/Easter', + 'Eastern Standard Time' => 'America/New_York', + 'Eastern Standard Time (Mexico)' => 'America/Cancun', + 'Egypt Standard Time' => 'Africa/Cairo', + 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg', + 'FLE Standard Time' => 'Europe/Kiev', + 'Fiji Standard Time' => 'Pacific/Fiji', + 'GMT Standard Time' => 'Europe/London', + 'GTB Standard Time' => 'Europe/Bucharest', + 'Georgian Standard Time' => 'Asia/Tbilisi', + 'Greenland Standard Time' => 'Atlantic/Stanley', + 'Greenwich Standard Time' => 'Atlantic/Reykjavik', + 'Haiti Standard Time' => 'America/Port-au-Prince', + 'Hawaiian Standard Time' => 'Pacific/Honolulu', + 'India Standard Time' => 'Asia/Calcutta', + 'Iran Standard Time' => 'Asia/Tehran', + 'Israel Standard Time' => 'Asia/Jerusalem', + 'Jordan Standard Time' => 'Asia/Amman', + 'Kaliningrad Standard Time' => 'Europe/Kaliningrad', + 'Korea Standard Time' => 'Asia/Seoul', + 'Libya Standard Time' => 'Africa/Tripoli', + 'Line Islands Standard Time' => 'Pacific/Kiritimati', + 'Lord Howe Standard Time' => 'Australia/Lord_Howe', + 'Magadan Standard Time' => 'Asia/Magadan', + 'Magallanes Standard Time' => 'America/Punta_Arenas', + 'Marquesas Standard Time' => 'Pacific/Marquesas', + 'Mauritius Standard Time' => 'Indian/Mauritius', + 'Middle East Standard Time' => 'Asia/Beirut', + 'Montevideo Standard Time' => 'America/Montevideo', + 'Morocco Standard Time' => 'Africa/Casablanca', + 'Mountain Standard Time' => 'America/Denver', + 'Mountain Standard Time (Mexico)' => 'America/Chihuahua', + 'Myanmar Standard Time' => 'Asia/Rangoon', + 'N. Central Asia Standard Time' => 'Asia/Novosibirsk', + 'Namibia Standard Time' => 'Africa/Windhoek', + 'Nepal Standard Time' => 'Asia/Katmandu', + 'New Zealand Standard Time' => 'Pacific/Auckland', + 'Newfoundland Standard Time' => 'America/St_Johns', + 'Norfolk Standard Time' => 'Pacific/Norfolk', + 'North Asia East Standard Time' => 'Asia/Irkutsk', + 'North Asia Standard Time' => 'Asia/Krasnoyarsk', + 'North Korea Standard Time' => 'Asia/Pyongyang', + 'Omsk Standard Time' => 'Asia/Omsk', + 'Pacific SA Standard Time' => 'America/Santiago', + 'Pacific Standard Time' => 'America/Los_Angeles', + 'Pacific Standard Time (Mexico)' => 'America/Tijuana', + 'Pakistan Standard Time' => 'Asia/Karachi', + 'Paraguay Standard Time' => 'America/Asuncion', + 'Qyzylorda Standard Time' => 'Asia/Qyzylorda', + 'Romance Standard Time' => 'Europe/Paris', + 'Russia Time Zone 10' => 'Asia/Srednekolymsk', + 'Russia Time Zone 11' => 'Asia/Kamchatka', + 'Russia Time Zone 3' => 'Europe/Samara', + 'Russian Standard Time' => 'Europe/Moscow', + 'SA Eastern Standard Time' => 'America/Cayenne', + 'SA Pacific Standard Time' => 'America/Bogota', + 'SA Western Standard Time' => 'America/La_Paz', + 'SE Asia Standard Time' => 'Asia/Bangkok', + 'Saint Pierre Standard Time' => 'America/Miquelon', + 'Sakhalin Standard Time' => 'Asia/Sakhalin', + 'Samoa Standard Time' => 'Pacific/Apia', + 'Sao Tome Standard Time' => 'Africa/Sao_Tome', + 'Saratov Standard Time' => 'Europe/Saratov', + 'Singapore Standard Time' => 'Asia/Singapore', + 'South Africa Standard Time' => 'Africa/Johannesburg', + 'Sri Lanka Standard Time' => 'Asia/Colombo', + 'Sudan Standard Time' => 'Africa/Khartoum', + 'Syria Standard Time' => 'Asia/Damascus', + 'Taipei Standard Time' => 'Asia/Taipei', + 'Tasmania Standard Time' => 'Australia/Hobart', + 'Tocantins Standard Time' => 'America/Araguaina', + 'Tokyo Standard Time' => 'Asia/Tokyo', + 'Tomsk Standard Time' => 'Asia/Tomsk', + 'Tonga Standard Time' => 'Pacific/Tongatapu', + 'Transbaikal Standard Time' => 'Asia/Chita', + 'Turkey Standard Time' => 'Europe/Istanbul', + 'Turks And Caicos Standard Time' => 'America/Grand_Turk', + 'US Eastern Standard Time' => 'America/Indianapolis', + 'US Mountain Standard Time' => 'America/Phoenix', + 'UTC' => 'Etc/GMT', + 'UTC+12' => 'Etc/GMT-12', + 'UTC+13' => 'Etc/GMT-13', + 'UTC-02' => 'Etc/GMT+2', + 'UTC-08' => 'Etc/GMT+8', + 'UTC-09' => 'Etc/GMT+9', + 'UTC-11' => 'Etc/GMT+11', + 'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar', + 'Venezuela Standard Time' => 'America/Caracas', + 'Vladivostok Standard Time' => 'Asia/Vladivostok', + 'Volgograd Standard Time' => 'Europe/Volgograd', + 'W. Australia Standard Time' => 'Australia/Perth', + 'W. Central Africa Standard Time' => 'Africa/Lagos', + 'W. Europe Standard Time' => 'Europe/Berlin', + 'W. Mongolia Standard Time' => 'Asia/Hovd', + 'West Asia Standard Time' => 'Asia/Tashkent', + 'West Bank Standard Time' => 'Asia/Hebron', + 'West Pacific Standard Time' => 'Pacific/Port_Moresby', + 'Yakutsk Standard Time' => 'Asia/Yakutsk', + 'Yukon Standard Time' => 'America/Whitehorse', + 'coordinated universal time-11' => 'Pacific/Pago_Pago', + 'aleutian islands' => 'America/Adak', + 'marquesas islands' => 'Pacific/Marquesas', + 'coordinated universal time-09' => 'America/Anchorage', + 'baja california' => 'America/Tijuana', + 'coordinated universal time-08' => 'Pacific/Pitcairn', + 'chihuahua, la paz, mazatlan' => 'America/Chihuahua', + 'easter island' => 'Pacific/Easter', + 'guadalajara, mexico city, monterrey' => 'America/Mexico_City', + 'bogota, lima, quito, rio branco' => 'America/Bogota', + 'chetumal' => 'America/Cancun', + 'haiti' => 'America/Port-au-Prince', + 'havana' => 'America/Havana', + 'turks and caicos' => 'America/Grand_Turk', + 'asuncion' => 'America/Asuncion', + 'caracas' => 'America/Caracas', + 'cuiaba' => 'America/Cuiaba', + 'georgetown, la paz, manaus, san juan' => 'America/La_Paz', + 'araguaina' => 'America/Araguaina', + 'cayenne, fortaleza' => 'America/Cayenne', + 'city of buenos aires' => 'America/Argentina/Buenos_Aires', + 'punta arenas' => 'America/Punta_Arenas', + 'saint pierre and miquelon' => 'America/Miquelon', + 'salvador' => 'America/Bahia', + 'coordinated universal time-02' => 'America/Noronha', + 'mid-atlantic - old' => 'America/Noronha', + 'cabo verde is' => 'Atlantic/Cape_Verde', + 'coordinated universal time' => 'UTC', + 'dublin, edinburgh, lisbon, london' => 'Europe/London', + 'monrovia, reykjavik' => 'Atlantic/Reykjavik', + 'belgrade, bratislava, budapest, ljubljana, prague' => 'Europe/Budapest', + 'casablanca' => 'Africa/Casablanca', + 'sao tome' => 'Africa/Sao_Tome', + 'sarajevo, skopje, warsaw, zagreb' => 'Europe/Warsaw', + 'amman' => 'Asia/Amman', + 'athens, bucharest' => 'Europe/Bucharest', + 'beirut' => 'Asia/Beirut', + 'chisinau' => 'Europe/Chisinau', + 'damascus' => 'Asia/Damascus', + 'gaza, hebron' => 'Asia/Hebron', + 'jerusalem' => 'Asia/Jerusalem', + 'kaliningrad' => 'Europe/Kaliningrad', + 'khartoum' => 'Africa/Khartoum', + 'tripoli' => 'Africa/Tripoli', + 'windhoek' => 'Africa/Windhoek', + 'istanbul' => 'Europe/Istanbul', + 'kuwait, riyadh' => 'Asia/Riyadh', + 'minsk' => 'Europe/Minsk', + 'moscow, st petersburg' => 'Europe/Moscow', + 'nairobi' => 'Africa/Nairobi', + 'astrakhan, ulyanovsk' => 'Europe/Astrakhan', + 'izhevsk, samara' => 'Europe/Samara', + 'port louis' => 'Indian/Mauritius', + 'saratov' => 'Europe/Saratov', + 'ashgabat, tashkent' => 'Asia/Tashkent', + 'islamabad, karachi' => 'Asia/Karachi', + 'chennai, kolkata, mumbai, new delhi' => 'Asia/Kolkata', + 'sri jayawardenepura' => 'Asia/Colombo', + 'kathmandu' => 'Asia/Kathmandu', + 'astana' => 'Asia/Almaty', + 'dhaka' => 'Asia/Dhaka', + 'yangon (rangoon)' => 'Asia/Rangoon', + 'barnaul, gorno-altaysk' => 'Asia/Barnaul', + 'tomsk' => 'Asia/Tomsk', + 'beijing, chongqing, hong kong, urumqi' => 'Asia/Shanghai', + 'perth' => 'Australia/Perth', + 'ulaanbaatar' => 'Asia/Ulaanbaatar', + 'eucla' => 'Australia/Eucla', + 'chita' => 'Asia/Chita', + 'seoul' => 'Asia/Seoul', + 'adelaide' => 'Australia/Adelaide', + 'brisbane' => 'Australia/Brisbane', + 'canberra, melbourne, sydney' => 'Australia/Sydney', + 'hobart' => 'Australia/Hobart', + 'lord howe island' => 'Australia/Lord_Howe', + 'bougainville island' => 'Pacific/Bougainville', + 'chokurdakh' => 'Asia/Srednekolymsk', + 'norfolk island' => 'Pacific/Norfolk', + 'solomon is, new caledonia' => 'Pacific/Guadalcanal', + 'anadyr, petropavlovsk-kamchatsky' => 'Asia/Kamchatka', + 'coordinated universal time+12' => 'Pacific/Tarawa', + 'petropavlovsk-kamchatsky - old' => 'Asia/Anadyr', + 'chatham islands' => 'Pacific/Chatham', + 'coordinated universal time+13' => 'Pacific/Fakaofo', + "nuku'alofa" => 'Pacific/Tongatapu', + 'kiritimati island' => 'Pacific/Kiritimati', + 'helsinki, kyiv, riga, sofia, tallinn, vilnius' => 'Europe/Helsinki', ]; diff --git a/tests/VObject/Component/VCalendarTest.php b/tests/VObject/Component/VCalendarTest.php index 1893a9ac7..bde6a4fa5 100644 --- a/tests/VObject/Component/VCalendarTest.php +++ b/tests/VObject/Component/VCalendarTest.php @@ -756,7 +756,7 @@ public function testCalDAVMETHOD(): void ); } - public function assertValidate($ics, $options, $expectedLevel, string $expectedMessage = null): void + public function assertValidate($ics, $options, $expectedLevel, ?string $expectedMessage = null): void { $vcal = VObject\Reader::read($ics); $result = $vcal->validate($options); @@ -764,7 +764,7 @@ public function assertValidate($ics, $options, $expectedLevel, string $expectedM self::assertValidateResult($result, $expectedLevel, $expectedMessage); } - public function assertValidateResult($input, $expectedLevel, string $expectedMessage = null): void + public function assertValidateResult($input, $expectedLevel, ?string $expectedMessage = null): void { $messages = []; foreach ($input as $warning) { diff --git a/tests/VObject/Component/VCardTest.php b/tests/VObject/Component/VCardTest.php index b71b30856..3851d97d9 100644 --- a/tests/VObject/Component/VCardTest.php +++ b/tests/VObject/Component/VCardTest.php @@ -283,7 +283,7 @@ public function testVCard21NoCardDAV(): void ); } - public function assertValidate($vcf, $options, int $expectedLevel, string $expectedMessage = null): void + public function assertValidate($vcf, $options, int $expectedLevel, ?string $expectedMessage = null): void { $vcal = VObject\Reader::read($vcf); $result = $vcal->validate($options); @@ -291,7 +291,7 @@ public function assertValidate($vcf, $options, int $expectedLevel, string $expec self::assertValidateResult($result, $expectedLevel, $expectedMessage); } - public function assertValidateResult($input, int $expectedLevel, string $expectedMessage = null): void + public function assertValidateResult($input, int $expectedLevel, ?string $expectedMessage = null): void { $messages = []; foreach ($input as $warning) { diff --git a/tests/VObject/Component/VFreeBusyTest.php b/tests/VObject/Component/VFreeBusyTest.php index f3a521f95..f2f97ebe1 100644 --- a/tests/VObject/Component/VFreeBusyTest.php +++ b/tests/VObject/Component/VFreeBusyTest.php @@ -3,7 +3,6 @@ namespace Sabre\VObject\Component; use PHPUnit\Framework\TestCase; -use Sabre\VObject; use Sabre\VObject\Reader; class VFreeBusyTest extends TestCase @@ -23,7 +22,7 @@ public function testIsFree(): void END:VCALENDAR BLA; - $obj = VObject\Reader::read($input); + $obj = Reader::read($input); $vfb = $obj->VFREEBUSY; $tz = new \DateTimeZone('UTC'); diff --git a/tests/VObject/ComponentTest.php b/tests/VObject/ComponentTest.php index 4a247d906..c48480983 100644 --- a/tests/VObject/ComponentTest.php +++ b/tests/VObject/ComponentTest.php @@ -463,7 +463,7 @@ public function testRemoveNotFound(): void */ public function testValidateRules(array $componentList, int $errorCount): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'Hi', [], false); foreach ($componentList as $v) { @@ -475,7 +475,7 @@ public function testValidateRules(array $componentList, int $errorCount): void public function testValidateRepair(): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'Hi', [], false); $component->validate(Component::REPAIR); @@ -484,7 +484,7 @@ public function testValidateRepair(): void public function testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer(): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'WithDuplicateGIR', []); $component->add('BAZ', 'BAZ'); @@ -500,7 +500,7 @@ public function testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer public function testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer(): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'WithDuplicateGIR', []); $component->add('BAZ', 'BAZ'); @@ -516,7 +516,7 @@ public function testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDi public function testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual(): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'WithDuplicateGIR', []); $component->add('BAZ', 'BAZ'); @@ -532,7 +532,7 @@ public function testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParame public function testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual(): void { - $vcard = new Component\VCard(); + $vcard = new VCard(); $component = new FakeComponent($vcard, 'WithDuplicateGIR', []); $component->add('BAZ', 'BAZ'); diff --git a/tests/VObject/FreeBusyGeneratorTest.php b/tests/VObject/FreeBusyGeneratorTest.php index 47283eafb..a4946cc10 100644 --- a/tests/VObject/FreeBusyGeneratorTest.php +++ b/tests/VObject/FreeBusyGeneratorTest.php @@ -46,7 +46,7 @@ public function testInvalidArg(): void * * @throws ParseException */ - public function assertFreeBusyReport(string $expected, $input, \DateTimeZone $timeZone = null, string $vavailability = null): void + public function assertFreeBusyReport(string $expected, $input, ?\DateTimeZone $timeZone = null, ?string $vavailability = null): void { $gen = new FreeBusyGenerator( new \DateTime('20110101T110000Z', new \DateTimeZone('UTC')), diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php index 98942af41..6590356bb 100644 --- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php +++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php @@ -404,15 +404,15 @@ public function testRecurringAllDay(): void $version = \Sabre\VObject\Version::VERSION; $expected = [ - [ - 'uid' => 'foobar', - 'method' => 'REPLY', - 'component' => 'VEVENT', - 'sender' => 'mailto:one@example.org', - 'senderName' => 'One', - 'recipient' => 'mailto:strunk@example.org', - 'recipientName' => 'Strunk', - 'message' => << 'foobar', + 'method' => 'REPLY', + 'component' => 'VEVENT', + 'sender' => 'mailto:one@example.org', + 'senderName' => 'One', + 'recipient' => 'mailto:strunk@example.org', + 'recipientName' => 'Strunk', + 'message' => <<convert(Document::VCARD40); $vcard = $vcard->serialize();