From 161ceacc22f642dfa9ea8741fc19f8ff94b7049f Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 4 Jun 2024 14:42:51 +0545 Subject: [PATCH] Update to php-cs-fixer 3.58 --- bin/build.php | 2 +- bin/migrateto20.php | 2 +- bin/migrateto21.php | 8 +-- bin/migrateto30.php | 4 +- bin/migrateto32.php | 4 +- composer.json | 2 +- examples/addressbookserver.php | 2 +- examples/fileserver.php | 18 +++--- examples/groupwareserver.php | 44 ++++++------- lib/CalDAV/Backend/PDO.php | 20 +++--- lib/CalDAV/Backend/SimplePDO.php | 2 +- lib/CalDAV/Backend/SubscriptionSupport.php | 2 - lib/CalDAV/Calendar.php | 2 +- lib/CalDAV/ICSExportPlugin.php | 4 +- lib/CalDAV/Plugin.php | 4 +- lib/CalDAV/Schedule/Plugin.php | 18 +++--- lib/CalDAV/SharingPlugin.php | 8 +-- lib/CalDAV/Subscriptions/Subscription.php | 2 +- lib/CalDAV/Xml/Notification/Invite.php | 2 +- lib/CalDAV/Xml/Notification/InviteReply.php | 2 +- lib/CardDAV/Plugin.php | 6 +- .../Xml/Property/SupportedAddressData.php | 4 +- lib/DAV/Auth/Plugin.php | 2 +- lib/DAV/Browser/Plugin.php | 2 +- lib/DAV/CorePlugin.php | 10 +-- lib/DAV/Exception/Locked.php | 4 +- lib/DAV/Server.php | 4 +- lib/DAV/TemporaryFileFilterPlugin.php | 2 +- lib/DAV/Xml/Request/SyncCollectionReport.php | 2 +- lib/DAVACL/Plugin.php | 14 ++--- tests/Sabre/AbstractDAVServerTestCase.php | 18 +++--- .../CalDAV/Backend/AbstractPDOTestCase.php | 4 +- .../Backend/MockSubscriptionSupport.php | 2 - .../CalDAV/CalendarQueryValidatorTest.php | 62 +++++++++---------- .../ExpandEventsDTSTARTandDTENDTest.php | 2 +- .../ExpandEventsDTSTARTandDTENDbyDayTest.php | 2 +- .../CalDAV/ExpandEventsDoubleEventsTest.php | 2 +- .../CalDAV/ExpandEventsFloatingTimeTest.php | 2 +- .../Sabre/CalDAV/GetEventsByTimerangeTest.php | 2 +- .../Sabre/CalDAV/Notifications/PluginTest.php | 4 +- tests/Sabre/CalDAV/PluginTest.php | 4 +- tests/Sabre/CalDAV/SharedCalendarTest.php | 2 +- tests/Sabre/CalDAV/SharingPluginTest.php | 6 +- .../Subscriptions/CreateSubscriptionTest.php | 4 +- .../Xml/Notification/InviteReplyTest.php | 4 +- .../CalDAV/Xml/Notification/InviteTest.php | 4 +- .../Sabre/CardDAV/AbstractPluginTestCase.php | 2 +- tests/Sabre/CardDAV/AddressBookQueryTest.php | 10 +-- .../CardDAV/Backend/AbstractPDOTestCase.php | 2 +- .../DAV/Browser/MapGetToPropFindTest.php | 2 +- tests/Sabre/DAV/ClientTest.php | 6 +- tests/Sabre/DAV/FSExt/ServerTest.php | 6 +- tests/Sabre/DAV/GetIfConditionsTest.php | 12 ++-- tests/Sabre/DAV/HttpMoveTest.php | 2 +- tests/Sabre/DAV/Locks/MSWordTest.php | 22 +++---- tests/Sabre/DAV/Locks/PluginTest.php | 10 +-- tests/Sabre/DAV/Mock/Collection.php | 2 +- tests/Sabre/DAV/Mock/File.php | 2 +- .../DAV/ServerPropsInfiniteDepthTest.php | 10 +-- tests/Sabre/DAV/ServerPropsTest.php | 30 ++++----- tests/Sabre/DAV/ServerRangeTest.php | 16 ++--- tests/Sabre/DAV/ServerSimpleTest.php | 6 +- tests/Sabre/DAV/Sharing/PluginTest.php | 8 +-- tests/Sabre/DAV/Sharing/ShareResourceTest.php | 2 +- tests/Sabre/DAV/Sync/MockSyncCollection.php | 10 +-- tests/Sabre/DAVACL/PrincipalBackend/Mock.php | 2 +- 66 files changed, 241 insertions(+), 247 deletions(-) diff --git a/bin/build.php b/bin/build.php index 4dd25d9c95..230034837f 100755 --- a/bin/build.php +++ b/bin/build.php @@ -14,7 +14,7 @@ ], 'init' => [], 'composerupdate' => [], - ]; +]; $default = 'buildzip'; diff --git a/bin/migrateto20.php b/bin/migrateto20.php index a258f25c73..81d603fcdd 100755 --- a/bin/migrateto20.php +++ b/bin/migrateto20.php @@ -402,7 +402,7 @@ echo "Reading all old vcards and populating etag and size fields.\n"; $result = $pdo->query('SELECT id, carddata FROM cards'); $stmt = $pdo->prepare('UPDATE cards SET etag = ?, size = ? WHERE id = ?'); - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $stmt->execute([ md5($row['carddata']), strlen($row['carddata']), diff --git a/bin/migrateto21.php b/bin/migrateto21.php index a8776f096b..064956353a 100755 --- a/bin/migrateto21.php +++ b/bin/migrateto21.php @@ -80,7 +80,7 @@ $addUid = false; try { $result = $pdo->query('SELECT * FROM calendarobjects LIMIT 1'); - $row = $result->fetch(\PDO::FETCH_ASSOC); + $row = $result->fetch(PDO::FETCH_ASSOC); if (!$row) { echo "No data in table. Going to try to add the uid field anyway.\n"; @@ -111,10 +111,10 @@ $stmt = $pdo->prepare('UPDATE calendarobjects SET uid = ? WHERE id = ?'); $counter = 0; - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $result->fetch(PDO::FETCH_ASSOC)) { try { - $vobj = \Sabre\VObject\Reader::read($row['calendardata']); - } catch (\Exception $e) { + $vobj = Sabre\VObject\Reader::read($row['calendardata']); + } catch (Exception $e) { echo "Warning! Item with id $row[id] could not be parsed!\n"; continue; } diff --git a/bin/migrateto30.php b/bin/migrateto30.php index 5ca99c6476..aadd010b90 100755 --- a/bin/migrateto30.php +++ b/bin/migrateto30.php @@ -79,7 +79,7 @@ $addValueType = false; try { $result = $pdo->query('SELECT * FROM propertystorage LIMIT 1'); - $row = $result->fetch(\PDO::FETCH_ASSOC); + $row = $result->fetch(PDO::FETCH_ASSOC); if (!$row) { echo "No data in table. Going to re-create the table.\n"; @@ -146,7 +146,7 @@ $result = $pdo->query('SELECT id, uri, vcardurl FROM principals WHERE vcardurl IS NOT NULL'); $stmt1 = $pdo->prepare('INSERT INTO propertystorage (path, name, valuetype, value) VALUES (?, ?, 3, ?)'); -while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { +while ($row = $result->fetch(PDO::FETCH_ASSOC)) { // Inserting the new record $stmt1->execute([ 'addressbooks/'.basename($row['uri']), diff --git a/bin/migrateto32.php b/bin/migrateto32.php index 210f1c1818..ede48661f0 100755 --- a/bin/migrateto32.php +++ b/bin/migrateto32.php @@ -82,7 +82,7 @@ $addValueType = false; try { $result = $pdo->query('SELECT * FROM calendarinstances LIMIT 1'); - $result->fetch(\PDO::FETCH_ASSOC); + $result->fetch(PDO::FETCH_ASSOC); echo "calendarinstances exists. Assuming this part of the migration has already been done.\n"; } catch (Exception $e) { echo "calendarinstances does not yet exist. Creating table and migrating data.\n"; @@ -190,7 +190,7 @@ } try { $result = $pdo->query('SELECT * FROM calendars LIMIT 1'); - $row = $result->fetch(\PDO::FETCH_ASSOC); + $row = $result->fetch(PDO::FETCH_ASSOC); if (!$row) { echo "Source table is empty.\n"; diff --git a/composer.json b/composer.json index ad7a913320..b7dfe9b144 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ }, "require-dev" : { "ext-sqlite3": "*", - "friendsofphp/php-cs-fixer": "^3.40", + "friendsofphp/php-cs-fixer": "^3.58", "monolog/monolog": "^2.9", "phpstan/phpstan": "^1.11", "phpstan/phpstan-phpunit": "^1.4", diff --git a/examples/addressbookserver.php b/examples/addressbookserver.php index dcbdf17692..acf739d3c8 100644 --- a/examples/addressbookserver.php +++ b/examples/addressbookserver.php @@ -31,7 +31,7 @@ // Setting up the directory tree // $nodes = [ new Sabre\DAVACL\PrincipalCollection($principalBackend), -// new Sabre\CalDAV\CalendarRoot($authBackend, $caldavBackend), + // new Sabre\CalDAV\CalendarRoot($authBackend, $caldavBackend), new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend), ]; diff --git a/examples/fileserver.php b/examples/fileserver.php index 667f55df1c..ed96e0a8ee 100644 --- a/examples/fileserver.php +++ b/examples/fileserver.php @@ -22,34 +22,34 @@ require_once 'vendor/autoload.php'; // Create the root node -$root = new \Sabre\DAV\FS\Directory($publicDir); +$root = new Sabre\DAV\FS\Directory($publicDir); // The rootnode needs in turn to be passed to the server class -$server = new \Sabre\DAV\Server($root); +$server = new Sabre\DAV\Server($root); if (isset($baseUri)) { $server->setBaseUri($baseUri); } // Support for LOCK and UNLOCK -$lockBackend = new \Sabre\DAV\Locks\Backend\File($tmpDir.'/locksdb'); -$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend); +$lockBackend = new Sabre\DAV\Locks\Backend\File($tmpDir.'/locksdb'); +$lockPlugin = new Sabre\DAV\Locks\Plugin($lockBackend); $server->addPlugin($lockPlugin); // Support for html frontend -$browser = new \Sabre\DAV\Browser\Plugin(); +$browser = new Sabre\DAV\Browser\Plugin(); $server->addPlugin($browser); // Automatically guess (some) contenttypes, based on extension -$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType()); +$server->addPlugin(new Sabre\DAV\Browser\GuessContentType()); // Authentication backend -$authBackend = new \Sabre\DAV\Auth\Backend\File('.htdigest'); -$auth = new \Sabre\DAV\Auth\Plugin($authBackend); +$authBackend = new Sabre\DAV\Auth\Backend\File('.htdigest'); +$auth = new Sabre\DAV\Auth\Plugin($authBackend); $server->addPlugin($auth); // Temporary file filter -$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir); +$tempFF = new Sabre\DAV\TemporaryFileFilterPlugin($tmpDir); $server->addPlugin($tempFF); // And off we go! diff --git a/examples/groupwareserver.php b/examples/groupwareserver.php index 48d9e61852..4f3e747acc 100644 --- a/examples/groupwareserver.php +++ b/examples/groupwareserver.php @@ -32,7 +32,7 @@ * Feel free to switch this to MySQL, it will definitely be better for higher * concurrency. */ -$pdo = new \PDO('sqlite:data/db.sqlite'); +$pdo = new PDO('sqlite:data/db.sqlite'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Autoloader @@ -44,16 +44,16 @@ * This allows any developer to subclass just any of them and hook into their * own backend systems. */ -$authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo); -$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo); -$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo); -$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo); +$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo); +$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo); +$carddavBackend = new Sabre\CardDAV\Backend\PDO($pdo); +$caldavBackend = new Sabre\CalDAV\Backend\PDO($pdo); /** * PSR-3 Logging facility. */ -$logger = new \Monolog\Logger('SabreDav'); -$logger->pushHandler(new \Monolog\Handler\RotatingFileHandler(__DIR__.'/sabredav.log', 3, \Monolog\Logger::DEBUG, true, 0600)); +$logger = new Monolog\Logger('SabreDav'); +$logger->pushHandler(new Monolog\Handler\RotatingFileHandler(__DIR__.'/sabredav.log', 3, Monolog\Logger::DEBUG, true, 0600)); /** * The directory tree. @@ -63,15 +63,15 @@ */ $nodes = [ // /principals - new \Sabre\CalDAV\Principal\Collection($principalBackend), + new Sabre\CalDAV\Principal\Collection($principalBackend), // /calendars - new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend), + new Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend), // /addressbook - new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend), + new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend), ]; // The object tree needs in turn to be passed to the server class -$server = new \Sabre\DAV\Server($nodes); +$server = new Sabre\DAV\Server($nodes); if (isset($baseUri)) { $server->setBaseUri($baseUri); } @@ -81,21 +81,21 @@ // $server->debugExceptions = true; //enable this to include the stacktrace in exception responses // Plugins -$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend)); -$server->addPlugin(new \Sabre\DAV\Browser\Plugin()); -$server->addPlugin(new \Sabre\DAV\Sync\Plugin()); -$server->addPlugin(new \Sabre\DAV\Sharing\Plugin()); -$server->addPlugin(new \Sabre\DAVACL\Plugin()); +$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend)); +$server->addPlugin(new Sabre\DAV\Browser\Plugin()); +$server->addPlugin(new Sabre\DAV\Sync\Plugin()); +$server->addPlugin(new Sabre\DAV\Sharing\Plugin()); +$server->addPlugin(new Sabre\DAVACL\Plugin()); // CalDAV plugins -$server->addPlugin(new \Sabre\CalDAV\Plugin()); -$server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin()); -$server->addPlugin(new \Sabre\CalDAV\SharingPlugin()); -$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); +$server->addPlugin(new Sabre\CalDAV\Plugin()); +$server->addPlugin(new Sabre\CalDAV\Schedule\Plugin()); +$server->addPlugin(new Sabre\CalDAV\SharingPlugin()); +$server->addPlugin(new Sabre\CalDAV\ICSExportPlugin()); // CardDAV plugins -$server->addPlugin(new \Sabre\CardDAV\Plugin()); -$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin()); +$server->addPlugin(new Sabre\CardDAV\Plugin()); +$server->addPlugin(new Sabre\CardDAV\VCFExportPlugin()); // And off we go! $server->start(); diff --git a/lib/CalDAV/Backend/PDO.php b/lib/CalDAV/Backend/PDO.php index 6693627d11..d7fea212ad 100644 --- a/lib/CalDAV/Backend/PDO.php +++ b/lib/CalDAV/Backend/PDO.php @@ -198,7 +198,7 @@ public function getCalendarsForUser($principalUri) // read-only is for backwards compatibility. Might go away in // the future. - $calendar['read-only'] = \Sabre\DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access']; + $calendar['read-only'] = DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access']; } foreach ($this->propertyMap as $xmlName => $dbName) { @@ -341,7 +341,7 @@ public function deleteCalendar($calendarId) $stmt->execute([$instanceId]); $access = (int) $stmt->fetchColumn(); - if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) { + if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) { /** * If the user is the owner of the calendar, we delete all data and all * instances. @@ -461,7 +461,7 @@ public function getCalendarObject($calendarId, $objectUri) 'size' => (int) $row['size'], 'calendardata' => $row['calendardata'], 'component' => strtolower($row['componenttype']), - ]; + ]; } /** @@ -619,7 +619,7 @@ protected function getDenormalizedData($calendarData) } } if (!$componentType) { - throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); + throw new DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); } if ('VEVENT' === $componentType) { $firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp(); @@ -1234,7 +1234,7 @@ public function getSchedulingObject($principalUri, $objectUri) 'lastmodified' => $row['lastmodified'], 'etag' => '"'.$row['etag'].'"', 'size' => (int) $row['size'], - ]; + ]; } /** @@ -1348,7 +1348,7 @@ public function updateInvites($calendarId, array $sharees) FROM '.$this->calendarInstancesTableName.' WHERE id = ?'); foreach ($sharees as $sharee) { - if (\Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS === $sharee->access) { + if (DAV\Sharing\Plugin::ACCESS_NOACCESS === $sharee->access) { // if access was set no NOACCESS, it means access for an // existing sharee was removed. $removeStmt->execute([$calendarId, $sharee->href]); @@ -1358,11 +1358,11 @@ public function updateInvites($calendarId, array $sharees) if (is_null($sharee->principal)) { // If the server could not determine the principal automatically, // we will mark the invite status as invalid. - $sharee->inviteStatus = \Sabre\DAV\Sharing\Plugin::INVITE_INVALID; + $sharee->inviteStatus = DAV\Sharing\Plugin::INVITE_INVALID; } else { // Because sabre/dav does not yet have an invitation system, // every invite is automatically accepted for now. - $sharee->inviteStatus = \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED; + $sharee->inviteStatus = DAV\Sharing\Plugin::INVITE_ACCEPTED; } foreach ($currentInvites as $oldSharee) { @@ -1387,10 +1387,10 @@ public function updateInvites($calendarId, array $sharees) $calendarId, $sharee->principal, $sharee->access, - \Sabre\DAV\UUIDUtil::getUUID(), + DAV\UUIDUtil::getUUID(), $sharee->href, isset($sharee->properties['{DAV:}displayname']) ? $sharee->properties['{DAV:}displayname'] : null, - $sharee->inviteStatus ?: \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, + $sharee->inviteStatus ?: DAV\Sharing\Plugin::INVITE_NORESPONSE, $instanceId, ]); } diff --git a/lib/CalDAV/Backend/SimplePDO.php b/lib/CalDAV/Backend/SimplePDO.php index ae6a12fbe1..764144aad2 100644 --- a/lib/CalDAV/Backend/SimplePDO.php +++ b/lib/CalDAV/Backend/SimplePDO.php @@ -212,7 +212,7 @@ public function getCalendarObject($calendarId, $objectUri) 'calendarid' => $calendarId, 'size' => strlen($row['calendardata']), 'calendardata' => $row['calendardata'], - ]; + ]; } /** diff --git a/lib/CalDAV/Backend/SubscriptionSupport.php b/lib/CalDAV/Backend/SubscriptionSupport.php index d9bcd36c10..bbd0c9589f 100644 --- a/lib/CalDAV/Backend/SubscriptionSupport.php +++ b/lib/CalDAV/Backend/SubscriptionSupport.php @@ -72,8 +72,6 @@ public function createSubscription($principalUri, $uri, array $properties); * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param \Sabre\DAV\PropPatch $propPatch */ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch); diff --git a/lib/CalDAV/Calendar.php b/lib/CalDAV/Calendar.php index 801d8cd0dc..2ebe78c217 100644 --- a/lib/CalDAV/Calendar.php +++ b/lib/CalDAV/Calendar.php @@ -98,7 +98,7 @@ public function getProperties($requestedProperties) * * @param string $name * - * @return \Sabre\CalDAV\ICalendarObject + * @return ICalendarObject */ public function getChild($name) { diff --git a/lib/CalDAV/ICSExportPlugin.php b/lib/CalDAV/ICSExportPlugin.php index 128cc0c602..8f32c3a0cb 100644 --- a/lib/CalDAV/ICSExportPlugin.php +++ b/lib/CalDAV/ICSExportPlugin.php @@ -49,14 +49,12 @@ class ICSExportPlugin extends DAV\ServerPlugin /** * Reference to Server class. * - * @var \Sabre\DAV\Server + * @var DAV\Server */ protected $server; /** * Initializes the plugin and registers event handlers. - * - * @param \Sabre\DAV\Server $server */ public function initialize(DAV\Server $server) { diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php index d1c6b40344..c7ac5aabc1 100644 --- a/lib/CalDAV/Plugin.php +++ b/lib/CalDAV/Plugin.php @@ -316,7 +316,7 @@ public function httpMkCalendar(RequestInterface $request, ResponseInterface $res * resource are fetched. This allows us to add in any CalDAV specific * properties. */ - public function propFind(DAV\PropFind $propFind, DAV\INode $node) + public function propFind(DAV\PropFind $propFind, INode $node) { $ns = '{'.self::NS_CALDAV.'}'; @@ -932,7 +932,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege * * @return bool */ - public function htmlActionsPanel(DAV\INode $node, &$output) + public function htmlActionsPanel(INode $node, &$output) { if (!$node instanceof CalendarHome) { return; diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php index 00725ce9ed..19dae4aed1 100644 --- a/lib/CalDAV/Schedule/Plugin.php +++ b/lib/CalDAV/Schedule/Plugin.php @@ -344,7 +344,7 @@ public function calendarObjectChange(RequestInterface $request, ResponseInterfac /** * This method is responsible for delivering the ITip message. */ - public function deliver(ITip\Message $iTipMessage) + public function deliver(Message $iTipMessage) { $this->server->emit('schedule', [$iTipMessage]); if (!$iTipMessage->scheduleStatus) { @@ -402,7 +402,7 @@ public function beforeUnbind($path) * This handler attempts to look at local accounts to deliver the * scheduling object. */ - public function scheduleLocalDelivery(ITip\Message $iTipMessage) + public function scheduleLocalDelivery(Message $iTipMessage) { $aclPlugin = $this->server->getPlugin('acl'); @@ -432,9 +432,9 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage) $principalUri, [ '{DAV:}principal-URL', - $caldavNS.'calendar-home-set', - $caldavNS.'schedule-inbox-URL', - $caldavNS.'schedule-default-calendar-URL', + $caldavNS.'calendar-home-set', + $caldavNS.'schedule-inbox-URL', + $caldavNS.'schedule-default-calendar-URL', '{http://sabredav.org/ns}email-address', ] ); @@ -688,7 +688,7 @@ public function outboxRequest(IOutbox $outboxNode, RequestInterface $request, Re // Parsing the request body try { - $vObject = VObject\Reader::read($request->getBody()); + $vObject = Reader::read($request->getBody()); } catch (VObject\ParseException $e) { throw new BadRequest('The request body must be a valid iCalendar object. Parse error: '.$e->getMessage()); } @@ -890,7 +890,7 @@ protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateT } if (isset($props[$ctz])) { - $vtimezoneObj = VObject\Reader::read($props[$ctz]); + $vtimezoneObj = Reader::read($props[$ctz]); $calendarTimeZone = $vtimezoneObj->VTIMEZONE->getTimeZone(); // Destroy circular references so PHP can garbage collect the object. @@ -931,7 +931,7 @@ protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateT $caldavNS.'calendar-availability' ); - $vcalendar = new VObject\Component\VCalendar(); + $vcalendar = new VCalendar(); $vcalendar->METHOD = 'REPLY'; $generator = new VObject\FreeBusyGenerator(); @@ -942,7 +942,7 @@ protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateT if ($inboxProps) { $generator->setVAvailability( - VObject\Reader::read( + Reader::read( $inboxProps[$caldavNS.'calendar-availability'] ) ); diff --git a/lib/CalDAV/SharingPlugin.php b/lib/CalDAV/SharingPlugin.php index d6d2b105df..761c58e048 100644 --- a/lib/CalDAV/SharingPlugin.php +++ b/lib/CalDAV/SharingPlugin.php @@ -120,11 +120,11 @@ public function propFindLate(DAV\PropFind $propFind, DAV\INode $node) $shareAccess = $node->getShareAccess(); if ($rt = $propFind->get('{DAV:}resourcetype')) { switch ($shareAccess) { - case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER: + case DAV\Sharing\Plugin::ACCESS_SHAREDOWNER: $rt->add('{'.Plugin::NS_CALENDARSERVER.'}shared-owner'); break; - case \Sabre\DAV\Sharing\Plugin::ACCESS_READ: - case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE: + case DAV\Sharing\Plugin::ACCESS_READ: + case DAV\Sharing\Plugin::ACCESS_READWRITE: $rt->add('{'.Plugin::NS_CALENDARSERVER.'}shared'); break; } @@ -155,7 +155,7 @@ public function propPatch($path, DAV\PropPatch $propPatch) return; } - if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $node->getShareAccess() || \Sabre\DAV\Sharing\Plugin::ACCESS_NOTSHARED === $node->getShareAccess()) { + if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $node->getShareAccess() || DAV\Sharing\Plugin::ACCESS_NOTSHARED === $node->getShareAccess()) { $propPatch->handle('{DAV:}resourcetype', function ($value) use ($node) { if ($value->is('{'.Plugin::NS_CALENDARSERVER.'}shared-owner')) { return false; diff --git a/lib/CalDAV/Subscriptions/Subscription.php b/lib/CalDAV/Subscriptions/Subscription.php index 8d56e64418..ff32cabf99 100644 --- a/lib/CalDAV/Subscriptions/Subscription.php +++ b/lib/CalDAV/Subscriptions/Subscription.php @@ -51,7 +51,7 @@ public function __construct(SubscriptionSupport $caldavBackend, array $subscript 'uri', 'principaluri', 'source', - ]; + ]; foreach ($required as $r) { if (!isset($subscriptionInfo[$r])) { diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php index 28bb00a6b1..d6caaac825 100644 --- a/lib/CalDAV/Xml/Notification/Invite.php +++ b/lib/CalDAV/Xml/Notification/Invite.php @@ -214,7 +214,7 @@ public function xmlSerializeFull(Writer $writer) $writer->writeElement($cs.'hosturl', [ '{DAV:}href' => $writer->contextUri.$this->hostUrl, - ]); + ]); if ($this->summary) { $writer->writeElement($cs.'summary', $this->summary); diff --git a/lib/CalDAV/Xml/Notification/InviteReply.php b/lib/CalDAV/Xml/Notification/InviteReply.php index 60bd0015bb..051661d3f6 100644 --- a/lib/CalDAV/Xml/Notification/InviteReply.php +++ b/lib/CalDAV/Xml/Notification/InviteReply.php @@ -164,7 +164,7 @@ public function xmlSerializeFull(Writer $writer) $writer->writeElement($cs.'hosturl', [ '{DAV:}href' => $writer->contextUri.$this->hostUrl, - ]); + ]); if ($this->summary) { $writer->writeElement($cs.'summary', $this->summary); diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php index afac8494f6..87bcc2b239 100644 --- a/lib/CardDAV/Plugin.php +++ b/lib/CardDAV/Plugin.php @@ -119,8 +119,8 @@ public function getSupportedReportSet($uri) $node = $this->server->tree->getNodeForPath($uri); if ($node instanceof IAddressBook || $node instanceof ICard) { return [ - '{'.self::NS_CARDDAV.'}addressbook-multiget', - '{'.self::NS_CARDDAV.'}addressbook-query', + '{'.self::NS_CARDDAV.'}addressbook-multiget', + '{'.self::NS_CARDDAV.'}addressbook-query', ]; } @@ -798,7 +798,7 @@ protected function negotiateVCard($input, &$mimeType = null) * * @return string */ - protected function convertVCard($data, $target, array $propertiesFilter = null) + protected function convertVCard($data, $target, ?array $propertiesFilter = null) { if (is_resource($data)) { $data = stream_get_contents($data); diff --git a/lib/CardDAV/Xml/Property/SupportedAddressData.php b/lib/CardDAV/Xml/Property/SupportedAddressData.php index a912724bf9..ad4590d2b9 100644 --- a/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/lib/CardDAV/Xml/Property/SupportedAddressData.php @@ -34,7 +34,7 @@ class SupportedAddressData implements XmlSerializable /** * Creates the property. */ - public function __construct(array $supportedData = null) + public function __construct(?array $supportedData = null) { if (is_null($supportedData)) { $supportedData = [ @@ -70,7 +70,7 @@ public function xmlSerialize(Writer $writer): void $writer->writeAttributes([ 'content-type' => $supported['contentType'], 'version' => $supported['version'], - ]); + ]); $writer->endElement(); // address-data-type } } diff --git a/lib/DAV/Auth/Plugin.php b/lib/DAV/Auth/Plugin.php index 86855cca59..4a0552c16f 100644 --- a/lib/DAV/Auth/Plugin.php +++ b/lib/DAV/Auth/Plugin.php @@ -56,7 +56,7 @@ class Plugin extends ServerPlugin /** * Creates the authentication plugin. */ - public function __construct(Backend\BackendInterface $authBackend = null) + public function __construct(?Backend\BackendInterface $authBackend = null) { if (!is_null($authBackend)) { $this->addBackend($authBackend); diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php index 8088135a18..acad643fa3 100644 --- a/lib/DAV/Browser/Plugin.php +++ b/lib/DAV/Browser/Plugin.php @@ -51,7 +51,7 @@ class Plugin extends DAV\ServerPlugin public $uninterestingProperties = [ '{DAV:}supportedlock', '{DAV:}acl-restrictions', -// '{DAV:}supported-privilege-set', + // '{DAV:}supported-privilege-set', '{DAV:}supported-method-set', ]; diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php index de0f90a781..8d5d463b38 100644 --- a/lib/DAV/CorePlugin.php +++ b/lib/DAV/CorePlugin.php @@ -440,7 +440,7 @@ public function httpPut(RequestInterface $request, ResponseInterface $response) Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4 */ - throw new Exception\BadRequest('Content-Range on PUT requests are forbidden.'); + throw new BadRequest('Content-Range on PUT requests are forbidden.'); } // Intercepting the Finder problem @@ -540,14 +540,14 @@ public function httpMkcol(RequestInterface $request, ResponseInterface $response try { $mkcol = $this->server->xml->expect('{DAV:}mkcol', $requestBody); - } catch (\Sabre\Xml\ParseException $e) { - throw new Exception\BadRequest($e->getMessage(), 0, $e); + } catch (ParseException $e) { + throw new BadRequest($e->getMessage(), 0, $e); } $properties = $mkcol->getProperties(); if (!isset($properties['{DAV:}resourcetype'])) { - throw new Exception\BadRequest('The mkcol request must include a {DAV:}resourcetype property'); + throw new BadRequest('The mkcol request must include a {DAV:}resourcetype property'); } $resourceType = $properties['{DAV:}resourcetype']->getValue(); unset($properties['{DAV:}resourcetype']); @@ -862,7 +862,7 @@ public function propFindLate(PropFind $propFind, INode $node) public function exception($e) { $logLevel = \Psr\Log\LogLevel::CRITICAL; - if ($e instanceof \Sabre\DAV\Exception) { + if ($e instanceof Exception) { // If it's a standard sabre/dav exception, it means we have a http // status code available. $code = $e->getHTTPCode(); diff --git a/lib/DAV/Exception/Locked.php b/lib/DAV/Exception/Locked.php index 65bcb4f8b0..e12c83ee2c 100644 --- a/lib/DAV/Exception/Locked.php +++ b/lib/DAV/Exception/Locked.php @@ -20,7 +20,7 @@ class Locked extends DAV\Exception /** * Lock information. * - * @var \Sabre\DAV\Locks\LockInfo + * @var DAV\Locks\LockInfo */ protected $lock; @@ -30,7 +30,7 @@ class Locked extends DAV\Exception * A LockInfo object should be passed if the user should be informed * which lock actually has the file locked. */ - public function __construct(DAV\Locks\LockInfo $lock = null) + public function __construct(?DAV\Locks\LockInfo $lock = null) { parent::__construct(); diff --git a/lib/DAV/Server.php b/lib/DAV/Server.php index 437ac4d0e9..7edf8bb57e 100644 --- a/lib/DAV/Server.php +++ b/lib/DAV/Server.php @@ -211,7 +211,7 @@ class Server implements LoggerAwareInterface, EmitterInterface * * @throws Exception */ - public function __construct($treeOrNode = null, HTTP\Sapi $sapi = null) + public function __construct($treeOrNode = null, ?HTTP\Sapi $sapi = null) { if ($treeOrNode instanceof Tree) { $this->tree = $treeOrNode; @@ -878,7 +878,7 @@ public function getHTTPHeaders($path) * * @return \Traversable */ - private function generatePathNodes(PropFind $propFind, array $yieldFirst = null) + private function generatePathNodes(PropFind $propFind, ?array $yieldFirst = null) { if (null !== $yieldFirst) { yield $yieldFirst; diff --git a/lib/DAV/TemporaryFileFilterPlugin.php b/lib/DAV/TemporaryFileFilterPlugin.php index d61ca5eca0..a9a6dcf4a4 100644 --- a/lib/DAV/TemporaryFileFilterPlugin.php +++ b/lib/DAV/TemporaryFileFilterPlugin.php @@ -53,7 +53,7 @@ class TemporaryFileFilterPlugin extends ServerPlugin /** * A reference to the main Server class. * - * @var \Sabre\DAV\Server + * @var Server */ protected $server; diff --git a/lib/DAV/Xml/Request/SyncCollectionReport.php b/lib/DAV/Xml/Request/SyncCollectionReport.php index c3f1e244eb..de1085afe8 100644 --- a/lib/DAV/Xml/Request/SyncCollectionReport.php +++ b/lib/DAV/Xml/Request/SyncCollectionReport.php @@ -82,7 +82,7 @@ public static function xmlDeserialize(Reader $reader) $required = [ '{DAV:}sync-token', '{DAV:}prop', - ]; + ]; foreach ($required as $elem) { if (!array_key_exists($elem, $elems)) { diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php index 907efb5a12..685c74af80 100644 --- a/lib/DAVACL/Plugin.php +++ b/lib/DAVACL/Plugin.php @@ -559,7 +559,7 @@ final public function getFlatPrivilegeSet($node) * * null will be returned if the node doesn't support ACLs. * - * @param string|DAV\INode $node + * @param string|INode $node * * @return array */ @@ -591,7 +591,7 @@ public function getAcl($node) * * null will be returned if the node doesn't support ACLs. * - * @param string|DAV\INode $node + * @param string|INode $node * * @return array */ @@ -929,7 +929,7 @@ public function beforeUnlock($uri, DAV\Locks\LockInfo $lock) * * @TODO really should be broken into multiple methods, or even a class. */ - public function propFind(DAV\PropFind $propFind, DAV\INode $node) + public function propFind(DAV\PropFind $propFind, INode $node) { $path = $propFind->getPath(); @@ -1110,7 +1110,7 @@ public function httpAcl(RequestInterface $request, ResponseInterface $response) $body = $request->getBodyAsString(); if (!$body) { - throw new DAV\Exception\BadRequest('XML body expected in ACL request'); + throw new BadRequest('XML body expected in ACL request'); } $acl = $this->server->xml->expect('{DAV:}acl', $body); @@ -1332,7 +1332,7 @@ protected function expandProperties($path, array $requestedProperties, $depth) continue; } - if (!$node[200][$propertyName] instanceof DAV\Xml\Property\Href) { + if (!$node[200][$propertyName] instanceof Href) { continue; } @@ -1371,7 +1371,7 @@ protected function principalSearchPropertySetReport($path, $report) { $httpDepth = $this->server->getHTTPDepth(0); if (0 !== $httpDepth) { - throw new DAV\Exception\BadRequest('This report is only defined when Depth: 0'); + throw new BadRequest('This report is only defined when Depth: 0'); } $writer = $this->server->xml->getWriter(); @@ -1502,7 +1502,7 @@ protected function aclPrincipalPropSetReport($path, Xml\Request\AclPrincipalProp * * @return bool */ - public function htmlActionsPanel(DAV\INode $node, &$output) + public function htmlActionsPanel(INode $node, &$output) { if (!$node instanceof PrincipalCollection) { return; diff --git a/tests/Sabre/AbstractDAVServerTestCase.php b/tests/Sabre/AbstractDAVServerTestCase.php index 78833b2118..244c518158 100644 --- a/tests/Sabre/AbstractDAVServerTestCase.php +++ b/tests/Sabre/AbstractDAVServerTestCase.php @@ -59,17 +59,17 @@ abstract class AbstractDAVServerTestCase extends TestCase protected $propertyStorageBackend; /** - * @var \Sabre\CalDAV\Plugin + * @var CalDAV\Plugin */ protected $caldavPlugin; /** - * @var \Sabre\CardDAV\Plugin + * @var CardDAV\Plugin */ protected $carddavPlugin; /** - * @var \Sabre\DAVACL\Plugin + * @var DAVACL\Plugin */ protected $aclPlugin; @@ -91,12 +91,12 @@ abstract class AbstractDAVServerTestCase extends TestCase protected $caldavICSExportPlugin; /** - * @var \Sabre\DAV\Auth\Plugin + * @var DAV\Auth\Plugin */ protected $authPlugin; /** - * @var \Sabre\DAV\Locks\Plugin + * @var DAV\Locks\Plugin */ protected $locksPlugin; @@ -128,7 +128,7 @@ public function initializeEverything() $this->setUpBackends(); $this->setUpTree(); - $this->server = new DAV\Server($this->tree); + $this->server = new Server($this->tree); $this->server->sapi = new HTTP\SapiMock(); $this->server->debugExceptions = true; @@ -137,11 +137,11 @@ public function initializeEverything() $this->server->addPlugin($this->caldavPlugin); } if ($this->setupCalDAVSharing || $this->setupSharing) { - $this->sharingPlugin = new DAV\Sharing\Plugin(); + $this->sharingPlugin = new Plugin(); $this->server->addPlugin($this->sharingPlugin); } if ($this->setupCalDAVSharing) { - $this->caldavSharingPlugin = new CalDAV\SharingPlugin(); + $this->caldavSharingPlugin = new SharingPlugin(); $this->server->addPlugin($this->caldavSharingPlugin); } if ($this->setupCalDAVScheduling) { @@ -301,7 +301,7 @@ public function setUpBackends() } } - public function assertHttpStatus($expectedStatus, HTTP\Request $req) + public function assertHttpStatus($expectedStatus, Request $req) { $resp = $this->request($req); self::assertEquals((int) $expectedStatus, (int) $resp->getStatus(), 'Incorrect HTTP status received: '.$resp->getStatus()); diff --git a/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php index 7ca498c313..03f4be41c4 100644 --- a/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php +++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php @@ -1052,7 +1052,7 @@ public function testUpdateSubscriptions() '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'), ]; - $propPatch = new DAV\PropPatch($newProps); + $propPatch = new PropPatch($newProps); $backend->updateSubscription(1, $propPatch); $result = $propPatch->commit(); @@ -1089,7 +1089,7 @@ public function testUpdateSubscriptionsFail() $backend = new PDO($this->pdo); $backend->createSubscription('principals/user1', 'sub1', $props); - $propPatch = new DAV\PropPatch([ + $propPatch = new PropPatch([ '{DAV:}displayname' => 'new displayname', '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'), '{DAV:}unknown' => 'foo', diff --git a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php index ebe72013cc..88dadfcd5a 100644 --- a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php +++ b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php @@ -104,8 +104,6 @@ public function createSubscription($principalUri, $uri, array $properties) * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param \Sabre\DAV\PropPatch $propPatch */ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) { diff --git a/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php b/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php index 3827cb63b9..ce161761c2 100644 --- a/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php +++ b/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php @@ -509,8 +509,8 @@ public function provider() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), ], ]; // Time range, no end date @@ -524,8 +524,8 @@ public function provider() // Time range, other dates $filter23 = $filter20; $filter23['time-range'] = [ - 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), ]; // Time range $filter24 = [ @@ -534,21 +534,21 @@ public function provider() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), ], ]; // Time range, other dates (1 month in the future) $filter25 = $filter24; $filter25['time-range'] = [ - 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), ]; $filter26 = $filter24; $filter26['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), - ]; + 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), + ]; // Time range for VJOURNAL $filter27 = [ @@ -557,14 +557,14 @@ public function provider() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), ], ]; $filter28 = $filter27; $filter28['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), ]; // Time range for VFREEBUSY $filter29 = [ @@ -573,8 +573,8 @@ public function provider() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), ], ]; // Time range filter on property @@ -587,11 +587,11 @@ public function provider() 'is-not-defined' => false, 'param-filters' => [], 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), - ], + 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), + ], 'text-match' => null, - ], + ], ], 'is-not-defined' => false, 'time-range' => null, @@ -608,20 +608,20 @@ public function provider() 'comp-filters' => [], 'prop-filters' => [], 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 11:15:00', new \DateTimeZone('GMT')), + 'start' => new \DateTime('2011-01-01 10:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 11:15:00', new \DateTimeZone('GMT')), ], 'text-match' => null, - ], + ], ], 'is-not-defined' => false, 'time-range' => null, ]; $filter32 = $filter31; $filter32['comp-filters'][0]['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), - ]; + 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), + ]; $filter33 = $filter31; $filter33['name'] = 'VTODO'; @@ -642,11 +642,11 @@ public function provider() 'is-not-defined' => false, 'param-filters' => [], 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), - ], + 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), + 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), + ], 'text-match' => null, - ], + ], ], 'is-not-defined' => false, 'time-range' => null, diff --git a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 94fa3559b7..c02499c57f 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -29,7 +29,7 @@ class ExpandEventsDTSTARTandDTENDTest extends \Sabre\AbstractDAVServerTestCase protected $caldavCalendarObjects = [ 1 => [ - 'event.ics' => [ + 'event.ics' => [ 'calendardata' => 'BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT diff --git a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php index 00d629aaa3..c723d127c5 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php @@ -29,7 +29,7 @@ class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\AbstractDAVServerTestC protected $caldavCalendarObjects = [ 1 => [ - 'event.ics' => [ + 'event.ics' => [ 'calendardata' => 'BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT diff --git a/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php index 21583ef5d3..61b2ca6ec5 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php @@ -32,7 +32,7 @@ class ExpandEventsDoubleEventsTest extends \Sabre\AbstractDAVServerTestCase protected $caldavCalendarObjects = [ 1 => [ - 'event.ics' => [ + 'event.ics' => [ 'calendardata' => 'BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT diff --git a/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php b/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php index b59e10f567..d17ff97cfe 100644 --- a/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php @@ -49,7 +49,7 @@ class ExpandEventsFloatingTimeTest extends \Sabre\AbstractDAVServerTestCase protected $caldavCalendarObjects = [ 1 => [ - 'event.ics' => [ + 'event.ics' => [ 'calendardata' => 'BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN diff --git a/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php index 02a5f800bb..e4730adef8 100644 --- a/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ b/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php @@ -28,7 +28,7 @@ class GetEventsByTimerangeTest extends \Sabre\AbstractDAVServerTestCase protected $caldavCalendarObjects = [ 1 => [ - 'event.ics' => [ + 'event.ics' => [ 'calendardata' => 'BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT diff --git a/tests/Sabre/CalDAV/Notifications/PluginTest.php b/tests/Sabre/CalDAV/Notifications/PluginTest.php index 6bafe5fbc6..20df558370 100644 --- a/tests/Sabre/CalDAV/Notifications/PluginTest.php +++ b/tests/Sabre/CalDAV/Notifications/PluginTest.php @@ -58,7 +58,7 @@ public function setup(): void $this->server->addPlugin($authPlugin); // This forces a login - $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); + $authPlugin->beforeMethod(new Request('GET', '/'), new HTTP\Response()); $this->response = new HTTP\ResponseMock(); $this->server->httpResponse = $this->response; @@ -156,6 +156,6 @@ public function testGETPassthrough() $server->addPlugin($caldav); - self::assertNull($caldav->httpGet(new HTTP\Request('GET', '/foozz'), $server->httpResponse)); + self::assertNull($caldav->httpGet(new Request('GET', '/foozz'), $server->httpResponse)); } } diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php index ad07c764d8..cfe2358d9e 100644 --- a/tests/Sabre/CalDAV/PluginTest.php +++ b/tests/Sabre/CalDAV/PluginTest.php @@ -89,7 +89,7 @@ public function setup(): void $authBackend = new DAV\Auth\Backend\Mock(); $authBackend->setPrincipal('principals/user1'); $authPlugin = new DAV\Auth\Plugin($authBackend); - $authPlugin->beforeMethod(new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response()); + $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $this->server->addPlugin($authPlugin); // This forces a login @@ -514,7 +514,7 @@ public function testSupportedReportSetProperty() public function testSupportedReportSetUserCalendars() { - $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); + $this->server->addPlugin(new DAV\Sync\Plugin()); $props = $this->server->getPropertiesForPath('/calendars/user1', [ '{DAV:}supported-report-set', diff --git a/tests/Sabre/CalDAV/SharedCalendarTest.php b/tests/Sabre/CalDAV/SharedCalendarTest.php index 7e8d830a26..f5ce9d796c 100644 --- a/tests/Sabre/CalDAV/SharedCalendarTest.php +++ b/tests/Sabre/CalDAV/SharedCalendarTest.php @@ -11,7 +11,7 @@ class SharedCalendarTest extends \PHPUnit\Framework\TestCase { protected $backend; - public function getInstance(array $props = null) + public function getInstance(?array $props = null) { if (is_null($props)) { $props = [ diff --git a/tests/Sabre/CalDAV/SharingPluginTest.php b/tests/Sabre/CalDAV/SharingPluginTest.php index 7cdb287303..25fa76f7d0 100644 --- a/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/tests/Sabre/CalDAV/SharingPluginTest.php @@ -28,7 +28,7 @@ public function setup(): void 'principaluri' => 'principals/user1', 'id' => 2, 'uri' => 'cal2', - 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, + 'share-access' => DAV\Sharing\Plugin::ACCESS_READWRITE, ], [ 'principaluri' => 'principals/user1', @@ -188,8 +188,8 @@ public function testShareRequest() 'properties' => [ '{DAV:}displayname' => 'Joe Shmoe', ], - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, + 'access' => DAV\Sharing\Plugin::ACCESS_READWRITE, + 'inviteStatus' => DAV\Sharing\Plugin::INVITE_NORESPONSE, 'comment' => '', ]), ], diff --git a/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php b/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php index 5b2c1571fa..dac7dc5f7d 100644 --- a/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php +++ b/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php @@ -95,8 +95,8 @@ public function testMKCALENDAR() // Also seeing if it works when calling this as a PROPFIND. self::assertEquals([ - '{http://calendarserver.org/ns/}subscribed-strip-alarms' => '', - ], + '{http://calendarserver.org/ns/}subscribed-strip-alarms' => '', + ], $this->server->getProperties('calendars/user1/subscription1', ['{http://calendarserver.org/ns/}subscribed-strip-alarms']) ); } diff --git a/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php b/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php index 19dfd697fb..2bcd50724d 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php @@ -66,7 +66,7 @@ public function dataProvider() 'type' => DAV\Sharing\Plugin::INVITE_ACCEPTED, 'hostUrl' => 'calendar', ], -<< 20120101T000000Z @@ -94,7 +94,7 @@ public function dataProvider() 'hostUrl' => 'calendar', 'summary' => 'Summary!', ], -<< 20120101T000000Z diff --git a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php index 7933d8f4e7..190601d9dd 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php @@ -53,7 +53,7 @@ public function dataProvider() 'commonName' => 'John Doe', 'summary' => 'Awesome stuff!', ], -<< 20120101T000000Z @@ -91,7 +91,7 @@ public function dataProvider() 'firstName' => 'Foo', 'lastName' => 'Bar', ], -<< 20120101T000000Z diff --git a/tests/Sabre/CardDAV/AbstractPluginTestCase.php b/tests/Sabre/CardDAV/AbstractPluginTestCase.php index 6d5e588cd3..5378bbdc6a 100644 --- a/tests/Sabre/CardDAV/AbstractPluginTestCase.php +++ b/tests/Sabre/CardDAV/AbstractPluginTestCase.php @@ -27,7 +27,7 @@ abstract class AbstractPluginTestCase extends TestCase public function setup(): void { - $this->backend = new Backend\Mock(); + $this->backend = new Mock(); $principalBackend = new DAVACL\PrincipalBackend\Mock(); $tree = [ diff --git a/tests/Sabre/CardDAV/AddressBookQueryTest.php b/tests/Sabre/CardDAV/AddressBookQueryTest.php index ec7a92ca2d..39aa4824f7 100644 --- a/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -49,7 +49,7 @@ public function testQuery() 200 => [ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', ], - ], + ], '/addressbooks/user1/book1/card2' => [ 404 => [ '{DAV:}getetag' => null, @@ -98,7 +98,7 @@ public function testQueryDepth0() 200 => [ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', ], - ], + ], ], $result); } @@ -181,7 +181,7 @@ public function testQueryLimit() 200 => [ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', ], - ], + ], ], $result); } @@ -226,7 +226,7 @@ public function testJson() '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', '{urn:ietf:params:xml:ns:carddav}address-data' => '["vcard",[["version",{},"text","4.0"],["prodid",{},"text","-\/\/Sabre\/\/Sabre VObject '.$vobjVersion.'\/\/EN"],["uid",{},"text","12345"]]]', ], - ], + ], ], $result); } @@ -271,7 +271,7 @@ public function testVCard4() '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', '{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:4.0\r\nPRODID:-//Sabre//Sabre VObject $vobjVersion//EN\r\nUID:12345\r\nEND:VCARD\r\n", ], - ], + ], ], $result); } diff --git a/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php b/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php index aa77b4b1f4..396252c9b1 100644 --- a/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php +++ b/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php @@ -14,7 +14,7 @@ abstract class AbstractPDOTestCase extends TestCase use DbTestHelperTrait; /** - * @var CardDAV\Backend\PDO + * @var PDO */ protected $backend; diff --git a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index c1278f0632..3d3ea1555d 100644 --- a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -33,7 +33,7 @@ public function testCollectionGet() 'Content-Type' => ['application/xml; charset=utf-8'], 'DAV' => ['1, 3, extended-mkcol'], 'Vary' => ['Brief,Prefer'], - ], + ], $this->response->getHeaders() ); } diff --git a/tests/Sabre/DAV/ClientTest.php b/tests/Sabre/DAV/ClientTest.php index e19ec07b44..63a77bb6e0 100644 --- a/tests/Sabre/DAV/ClientTest.php +++ b/tests/Sabre/DAV/ClientTest.php @@ -172,7 +172,7 @@ public function testPropFindDepth1() self::assertEquals([ '/foo' => [ - '{DAV:}displayname' => 'bar', + '{DAV:}displayname' => 'bar', ], ], $result); @@ -250,8 +250,8 @@ public function testPropFindMixedErrors() self::assertEquals([ '/folder1' => [ - '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), - '{DAV:}displayname' => 'Folder1', + '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), + '{DAV:}displayname' => 'Folder1', ], '/folder1/file1.txt' => [ '{DAV:}resourcetype' => null, diff --git a/tests/Sabre/DAV/FSExt/ServerTest.php b/tests/Sabre/DAV/FSExt/ServerTest.php index ecefbd9a17..e9b6dc3182 100644 --- a/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/tests/Sabre/DAV/FSExt/ServerTest.php @@ -28,7 +28,7 @@ public function testGet() 'Content-Length' => [13], 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filename)))], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], + ], $this->response->getHeaders() ); @@ -48,7 +48,7 @@ public function testHEAD() 'Content-Length' => [13], 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($this->tempDir.'/test.txt')))], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], + ], $this->response->getHeaders() ); @@ -209,7 +209,7 @@ public function testMoveOtherObject() $tree = new DAV\Tree(new DAV\SimpleCollection('root', [ new DAV\FS\Directory($this->tempDir.'/tree1'), - new DAV\FSExt\Directory($this->tempDir.'/tree2'), + new Directory($this->tempDir.'/tree2'), ])); $this->server->tree = $tree; diff --git a/tests/Sabre/DAV/GetIfConditionsTest.php b/tests/Sabre/DAV/GetIfConditionsTest.php index afee554377..ab0b0b92d7 100644 --- a/tests/Sabre/DAV/GetIfConditionsTest.php +++ b/tests/Sabre/DAV/GetIfConditionsTest.php @@ -127,7 +127,7 @@ public function test2UriLockTokens() 'token' => 'opaquelocktoken:token1', 'etag' => '', ], - ], + ], ], [ 'uri' => 'node2', @@ -165,7 +165,7 @@ public function test2UriMultiLockTokens() 'token' => 'opaquelocktoken:token2', 'etag' => '', ], - ], + ], ], [ 'uri' => 'node2', @@ -198,7 +198,7 @@ public function testEtag() 'token' => '', 'etag' => '"etag1"', ], - ], + ], ], ]; self::assertEquals($compare, $conditions); @@ -226,7 +226,7 @@ public function test2Etags() 'token' => '', 'etag' => '"etag2"', ], - ], + ], ], ]; self::assertEquals($compare, $conditions); @@ -261,7 +261,7 @@ public function testComplexIf() 'token' => '', 'etag' => '"etag2"', ], - ], + ], ], [ 'uri' => 'node2', @@ -281,7 +281,7 @@ public function testComplexIf() 'token' => '', 'etag' => '"etag3"', ], - ], + ], ], ]; self::assertEquals($compare, $conditions); diff --git a/tests/Sabre/DAV/HttpMoveTest.php b/tests/Sabre/DAV/HttpMoveTest.php index e9ccfa0917..46121bc9b9 100644 --- a/tests/Sabre/DAV/HttpMoveTest.php +++ b/tests/Sabre/DAV/HttpMoveTest.php @@ -94,7 +94,7 @@ public function testMoveToExistingBlockedDeleteSource() { $this->server->on('beforeUnbind', function ($path) { if ('file1' === $path) { - throw new \Sabre\DAV\Exception\Forbidden('uh oh'); + throw new Exception\Forbidden('uh oh'); } }); $request = new HTTP\Request('MOVE', '/file1', [ diff --git a/tests/Sabre/DAV/Locks/MSWordTest.php b/tests/Sabre/DAV/Locks/MSWordTest.php index ae6355348a..1c83a7c02c 100644 --- a/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/tests/Sabre/DAV/Locks/MSWordTest.php @@ -60,10 +60,10 @@ public function testLockEtc() public function getLockRequest() { $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'LOCK', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'HTTP_TIMEOUT' => 'Second-3600', - 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', + 'REQUEST_METHOD' => 'LOCK', + 'HTTP_CONTENT_TYPE' => 'application/xml', + 'HTTP_TIMEOUT' => 'Second-3600', + 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', ]); $request->setBody(' @@ -84,10 +84,10 @@ public function getLockRequest() public function getLockRequest2() { $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'LOCK', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'HTTP_TIMEOUT' => 'Second-3600', - 'REQUEST_URI' => '/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', + 'REQUEST_METHOD' => 'LOCK', + 'HTTP_CONTENT_TYPE' => 'application/xml', + 'HTTP_TIMEOUT' => 'Second-3600', + 'REQUEST_URI' => '/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', ]); $request->setBody(' @@ -108,9 +108,9 @@ public function getLockRequest2() public function getPutRequest($lockToken) { $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - 'HTTP_IF' => 'If: ('.$lockToken.')', + 'REQUEST_METHOD' => 'PUT', + 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', + 'HTTP_IF' => 'If: ('.$lockToken.')', ]); $request->setBody('FAKE BODY'); diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php index 48a0edcfb6..bb5e08c28e 100644 --- a/tests/Sabre/DAV/Locks/PluginTest.php +++ b/tests/Sabre/DAV/Locks/PluginTest.php @@ -50,7 +50,7 @@ public function testLockNoBody() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() ); @@ -266,7 +266,7 @@ public function testUnlockNoToken() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() ); @@ -285,7 +285,7 @@ public function testUnlockBadToken() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() ); @@ -355,7 +355,7 @@ public function testUnlock() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], - ], + ], $this->server->httpResponse->getHeaders() ); } @@ -392,7 +392,7 @@ public function testUnlockWindowsBug() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], - ], + ], $this->server->httpResponse->getHeaders() ); } diff --git a/tests/Sabre/DAV/Mock/Collection.php b/tests/Sabre/DAV/Mock/Collection.php index 4671955997..659c850c0e 100644 --- a/tests/Sabre/DAV/Mock/Collection.php +++ b/tests/Sabre/DAV/Mock/Collection.php @@ -33,7 +33,7 @@ class Collection extends DAV\Collection * * @param string $name */ - public function __construct($name, array $children = [], Collection $parent = null) + public function __construct($name, array $children = [], ?Collection $parent = null) { $this->name = $name; foreach ($children as $key => $value) { diff --git a/tests/Sabre/DAV/Mock/File.php b/tests/Sabre/DAV/Mock/File.php index 620cf49797..728a609d6a 100644 --- a/tests/Sabre/DAV/Mock/File.php +++ b/tests/Sabre/DAV/Mock/File.php @@ -29,7 +29,7 @@ class File extends DAV\File * @param resource $contents * @param int $lastModified */ - public function __construct($name, $contents, Collection $parent = null, $lastModified = -1) + public function __construct($name, $contents, ?Collection $parent = null, $lastModified = -1) { $this->name = $name; $this->put($contents); diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php index f5bc0339a0..d87045bfa3 100644 --- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php +++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php @@ -52,11 +52,11 @@ public function testPropFindEmptyBody() self::assertEquals(207, $this->response->status, 'Incorrect status received. Full response body: '.$bodyAsString); self::assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], + 'X-Sabre-Version' => [Version::VERSION], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'DAV' => ['1, 3, extended-mkcol, 2'], + 'Vary' => ['Brief,Prefer'], + ], $this->response->getHeaders() ); diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index bf2f18e9d6..bee8f5a55a 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -47,11 +47,11 @@ public function testPropFindEmptyBody() self::assertEquals(207, $this->response->status); self::assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], + 'X-Sabre-Version' => [Version::VERSION], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'DAV' => ['1, 3, extended-mkcol, 2'], + 'Vary' => ['Brief,Prefer'], + ], $this->response->getHeaders() ); @@ -76,11 +76,11 @@ public function testPropFindEmptyBodyDepth1Custom() self::assertEquals(207, $this->response->status); self::assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], + 'X-Sabre-Version' => [Version::VERSION], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'DAV' => ['1, 3, extended-mkcol, 2'], + 'Vary' => ['Brief,Prefer'], + ], $this->response->getHeaders() ); @@ -101,11 +101,11 @@ public function testPropFindEmptyBodyFile() self::assertEquals(207, $this->response->status); self::assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], + 'X-Sabre-Version' => [Version::VERSION], + 'Content-Type' => ['application/xml; charset=utf-8'], + 'DAV' => ['1, 3, extended-mkcol, 2'], + 'Vary' => ['Brief,Prefer'], + ], $this->response->getHeaders() ); diff --git a/tests/Sabre/DAV/ServerRangeTest.php b/tests/Sabre/DAV/ServerRangeTest.php index 837868c8e8..7265803fb1 100644 --- a/tests/Sabre/DAV/ServerRangeTest.php +++ b/tests/Sabre/DAV/ServerRangeTest.php @@ -52,7 +52,7 @@ public function testRange() 'Content-Range' => ['bytes 2-5/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); self::assertEquals(206, $response->getStatus()); @@ -74,7 +74,7 @@ public function testStartRange() 'Content-Range' => ['bytes 2-12/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -97,7 +97,7 @@ public function testEndRange() 'Content-Range' => ['bytes 5-12/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -140,7 +140,7 @@ public function testNonSeekableStream() 'Content-Range' => ['bytes 2-5/12'], // 'ETag' => ['"' . md5('Test contents') . '"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -165,7 +165,7 @@ public function testIfRangeEtag() 'Content-Range' => ['bytes 2-5/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -190,7 +190,7 @@ public function testIfRangeEtagIncorrect() 'Content-Length' => [13], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -216,7 +216,7 @@ public function testIfRangeModificationDate() 'Content-Range' => ['bytes 2-5/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -241,7 +241,7 @@ public function testIfRangeModificationDateModified() 'Content-Length' => [13], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php index 2d0fb9f36c..827861689c 100644 --- a/tests/Sabre/DAV/ServerSimpleTest.php +++ b/tests/Sabre/DAV/ServerSimpleTest.php @@ -102,7 +102,7 @@ public function testBaseUri() 'Content-Length' => [13], 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filename)))], 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], + ], $this->response->getHeaders() ); @@ -363,7 +363,7 @@ public function testReportNotFound() self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() ); @@ -386,7 +386,7 @@ public function testReportIntercepted() self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'testheader' => ['testvalue'], - ], + ], $this->response->getHeaders() ); diff --git a/tests/Sabre/DAV/Sharing/PluginTest.php b/tests/Sabre/DAV/Sharing/PluginTest.php index 2da35529c9..1423f48afd 100644 --- a/tests/Sabre/DAV/Sharing/PluginTest.php +++ b/tests/Sabre/DAV/Sharing/PluginTest.php @@ -70,7 +70,7 @@ public function testGetPluginInfo() public function testHtmlActionsPanel() { - $node = new \Sabre\DAV\Mock\Collection('foo'); + $node = new Mock\Collection('foo'); $html = ''; self::assertNull( @@ -82,7 +82,7 @@ public function testHtmlActionsPanel() $html ); - $node = new \Sabre\DAV\Mock\SharedNode('foo', \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER); + $node = new Mock\SharedNode('foo', Plugin::ACCESS_SHAREDOWNER); $html = ''; self::assertNull( @@ -117,8 +117,8 @@ public function testBrowserPostActionSuccess() $expected = [ new \Sabre\DAV\Xml\Element\Sharee([ 'href' => 'mailto:foo@example.org', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_NORESPONSE, ]), ]; self::assertEquals( diff --git a/tests/Sabre/DAV/Sharing/ShareResourceTest.php b/tests/Sabre/DAV/Sharing/ShareResourceTest.php index aa1092e906..6bbe8e7e25 100644 --- a/tests/Sabre/DAV/Sharing/ShareResourceTest.php +++ b/tests/Sabre/DAV/Sharing/ShareResourceTest.php @@ -51,7 +51,7 @@ public function testShareResource() ], 'access' => Plugin::ACCESS_READWRITE, 'comment' => 'Shared workspace', - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, + 'inviteStatus' => Plugin::INVITE_NORESPONSE, ]), ]; diff --git a/tests/Sabre/DAV/Sync/MockSyncCollection.php b/tests/Sabre/DAV/Sync/MockSyncCollection.php index 383ab2ab3a..f26c1b0b4c 100644 --- a/tests/Sabre/DAV/Sync/MockSyncCollection.php +++ b/tests/Sabre/DAV/Sync/MockSyncCollection.php @@ -105,11 +105,11 @@ public function getChanges($syncToken, $syncLevel, $limit = null) // This is an initial sync if (is_null($syncToken)) { return [ - 'added' => array_map( - function ($item) { - return $item->getName(); - }, $this->getChildren() - ), + 'added' => array_map( + function ($item) { + return $item->getName(); + }, $this->getChildren() + ), 'modified' => [], 'deleted' => [], 'syncToken' => $this->getSyncToken(), diff --git a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php index 359e678197..4a721dd6ba 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php @@ -9,7 +9,7 @@ class Mock extends AbstractBackend public $groupMembers = []; public $principals; - public function __construct(array $principals = null) + public function __construct(?array $principals = null) { $this->principals = $principals;