diff --git a/.gitignore b/.gitignore index f287cca1af..db1c54bc57 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,6 @@ bin/vobject bin/generate_vcards bin/phpdocmd -# Assuming every .php file in the root is for testing -/*.php - # Other testing stuff /tmpdata /data @@ -37,4 +34,4 @@ build.properties docs/api docs/wikidocs -.php_cs.cache +.php-cs-fixer.cache diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 52% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index c5c78a971d..5051da5cf5 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -1,12 +1,13 @@ getFinder() ->exclude('vendor') ->in(__DIR__); $config->setRules([ '@PSR1' => true, - '@Symfony' => true + '@Symfony' => true, + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true] ]); return $config; \ No newline at end of file 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 fb24fe599d..81d603fcdd 100755 --- a/bin/migrateto20.php +++ b/bin/migrateto20.php @@ -34,7 +34,7 @@ HELLO; - exit(); + exit; } // There's a bunch of places where the autoloader could be, so we'll try all of @@ -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 2c15b0a217..064956353a 100755 --- a/bin/migrateto21.php +++ b/bin/migrateto21.php @@ -35,7 +35,7 @@ HELLO; - exit(); + exit; } // There's a bunch of places where the autoloader could be, so we'll try all of @@ -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 9798cadd25..aadd010b90 100755 --- a/bin/migrateto30.php +++ b/bin/migrateto30.php @@ -34,7 +34,7 @@ HELLO; - exit(); + exit; } // There's a bunch of places where the autoloader could be, so we'll try all of @@ -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 09ac55d13e..ede48661f0 100755 --- a/bin/migrateto32.php +++ b/bin/migrateto32.php @@ -35,7 +35,7 @@ HELLO; - exit(); + exit; } // There's a bunch of places where the autoloader could be, so we'll try all of @@ -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"; @@ -110,7 +110,7 @@ UNIQUE(calendarid, share_href) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; SQL - ); + ); $pdo->exec(' INSERT INTO calendarinstances ( @@ -159,7 +159,7 @@ UNIQUE (calendarid, share_href) ); SQL - ); + ); $pdo->exec(' INSERT INTO calendarinstances ( @@ -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"; @@ -233,7 +233,7 @@ components VARBINARY(21) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; SQL -); + ); break; case 'sqlite': $pdo->exec(<<addPlugin(new Sabre\DAV\Auth\Plugin($authBackend)); $server->addPlugin(new Sabre\DAV\Browser\Plugin()); -//$server->addPlugin(new Sabre\CalDAV\Plugin()); +// $server->addPlugin(new Sabre\CalDAV\Plugin()); $server->addPlugin(new Sabre\CardDAV\Plugin()); $server->addPlugin(new Sabre\DAVACL\Plugin()); $server->addPlugin(new Sabre\DAV\Sync\Plugin()); 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 2c3eb6ee79..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,39 +63,39 @@ */ $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); } // Logging $server->setLogger($logger); -//$server->debugExceptions = true; //enable this to include the stacktrace in exception responses +// $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/AbstractBackend.php b/lib/CalDAV/Backend/AbstractBackend.php index c761bff51b..2d7a6515be 100644 --- a/lib/CalDAV/Backend/AbstractBackend.php +++ b/lib/CalDAV/Backend/AbstractBackend.php @@ -29,8 +29,6 @@ abstract class AbstractBackend implements BackendInterface * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param mixed $calendarId */ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) { @@ -44,8 +42,6 @@ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $calendarId - * * @return array */ public function getMultipleCalendarObjects($calendarId, array $uris) @@ -100,8 +96,6 @@ public function getMultipleCalendarObjects($calendarId, array $uris) * as possible, so it gives you a good idea on what type of stuff you need * to think of. * - * @param mixed $calendarId - * * @return array */ public function calendarQuery($calendarId, array $filters) diff --git a/lib/CalDAV/Backend/BackendInterface.php b/lib/CalDAV/Backend/BackendInterface.php index ccaa2519ac..4fae92b924 100644 --- a/lib/CalDAV/Backend/BackendInterface.php +++ b/lib/CalDAV/Backend/BackendInterface.php @@ -51,8 +51,6 @@ public function getCalendarsForUser($principalUri); * * @param string $principalUri * @param string $calendarUri - * - * @return mixed */ public function createCalendar($principalUri, $calendarUri, array $properties); @@ -67,15 +65,11 @@ public function createCalendar($principalUri, $calendarUri, array $properties); * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param mixed $calendarId */ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch); /** * Delete a calendar and all its objects. - * - * @param mixed $calendarId */ public function deleteCalendar($calendarId); @@ -107,8 +101,6 @@ public function deleteCalendar($calendarId); * used/fetched to determine these numbers. If both are specified the * amount of times this is needed is reduced by a great degree. * - * @param mixed $calendarId - * * @return array */ public function getCalendarObjects($calendarId); @@ -125,7 +117,6 @@ public function getCalendarObjects($calendarId); * * This method must return null if the object did not exist. * - * @param mixed $calendarId * @param string $objectUri * * @return array|null @@ -140,8 +131,6 @@ public function getCalendarObject($calendarId, $objectUri); * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $calendarId - * * @return array */ public function getMultipleCalendarObjects($calendarId, array $uris); @@ -159,7 +148,6 @@ public function getMultipleCalendarObjects($calendarId, array $uris); * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * @@ -180,7 +168,6 @@ public function createCalendarObject($calendarId, $objectUri, $calendarData); * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * @@ -193,7 +180,6 @@ public function updateCalendarObject($calendarId, $objectUri, $calendarData); * * The object uri is only the basename, or filename and not a full path. * - * @param mixed $calendarId * @param string $objectUri */ public function deleteCalendarObject($calendarId, $objectUri); @@ -243,8 +229,6 @@ public function deleteCalendarObject($calendarId, $objectUri); * as possible, so it gives you a good idea on what type of stuff you need * to think of. * - * @param mixed $calendarId - * * @return array */ public function calendarQuery($calendarId, array $filters); diff --git a/lib/CalDAV/Backend/PDO.php b/lib/CalDAV/Backend/PDO.php index 634b9828c5..d7fea212ad 100644 --- a/lib/CalDAV/Backend/PDO.php +++ b/lib/CalDAV/Backend/PDO.php @@ -31,7 +31,7 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S * in 2038-01-19 to avoid problems when the date is converted * to a unix timestamp. */ - const MAX_DATE = '2038-01-01'; + public const MAX_DATE = '2038-01-01'; /** * pdo. @@ -193,12 +193,12 @@ public function getCalendarsForUser($principalUri) // 1 = owner, 2 = readonly, 3 = readwrite if ($row['access'] > 1) { // We need to find more information about the original owner. - //$stmt2 = $this->pdo->prepare('SELECT principaluri FROM ' . $this->calendarInstancesTableName . ' WHERE access = 1 AND id = ?'); - //$stmt2->execute([$row['id']]); + // $stmt2 = $this->pdo->prepare('SELECT principaluri FROM ' . $this->calendarInstancesTableName . ' WHERE access = 1 AND id = ?'); + // $stmt2->execute([$row['id']]); // 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) { @@ -287,8 +287,6 @@ public function createCalendar($principalUri, $calendarUri, array $properties) * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param mixed $calendarId */ public function updateCalendar($calendarId, PropPatch $propPatch) { @@ -331,8 +329,6 @@ public function updateCalendar($calendarId, PropPatch $propPatch) /** * Delete a calendar and all it's objects. - * - * @param mixed $calendarId */ public function deleteCalendar($calendarId) { @@ -345,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. @@ -399,8 +395,6 @@ public function deleteCalendar($calendarId) * used/fetched to determine these numbers. If both are specified the * amount of times this is needed is reduced by a great degree. * - * @param mixed $calendarId - * * @return array */ public function getCalendarObjects($calendarId) @@ -440,7 +434,6 @@ public function getCalendarObjects($calendarId) * * This method must return null if the object did not exist. * - * @param mixed $calendarId * @param string $objectUri * * @return array|null @@ -468,7 +461,7 @@ public function getCalendarObject($calendarId, $objectUri) 'size' => (int) $row['size'], 'calendardata' => $row['calendardata'], 'component' => strtolower($row['componenttype']), - ]; + ]; } /** @@ -479,8 +472,6 @@ public function getCalendarObject($calendarId, $objectUri) * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $calendarId - * * @return array */ public function getMultipleCalendarObjects($calendarId, array $uris) @@ -529,7 +520,6 @@ public function getMultipleCalendarObjects($calendarId, array $uris) * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * @@ -575,7 +565,6 @@ public function createCalendarObject($calendarId, $objectUri, $calendarData) * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * @@ -630,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(); @@ -691,7 +680,6 @@ protected function getDenormalizedData($calendarData) * * The object uri is only the basename, or filename and not a full path. * - * @param mixed $calendarId * @param string $objectUri */ public function deleteCalendarObject($calendarId, $objectUri) @@ -755,8 +743,6 @@ public function deleteCalendarObject($calendarId, $objectUri) * This specific implementation (for the PDO) backend optimizes filters on * specific components, and VEVENT time-ranges. * - * @param mixed $calendarId - * * @return array */ public function calendarQuery($calendarId, array $filters) @@ -934,7 +920,6 @@ public function getCalendarObjectByUID($principalUri, $uid) * * The limit is 'suggestive'. You are free to ignore it. * - * @param mixed $calendarId * @param string $syncToken * @param int $syncLevel * @param int $limit @@ -1031,9 +1016,8 @@ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limi /** * Adds a change record to the calendarchanges table. * - * @param mixed $calendarId * @param string $objectUri - * @param int $operation 1 = add, 2 = modify, 3 = delete + * @param int $operation 1 = add, 2 = modify, 3 = delete */ protected function addChange($calendarId, $objectUri, $operation) { @@ -1128,8 +1112,6 @@ public function getSubscriptionsForUser($principalUri) * * @param string $principalUri * @param string $uri - * - * @return mixed */ public function createSubscription($principalUri, $uri, array $properties) { @@ -1177,8 +1159,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 mixed $subscriptionId */ public function updateSubscription($subscriptionId, PropPatch $propPatch) { @@ -1214,8 +1194,6 @@ public function updateSubscription($subscriptionId, PropPatch $propPatch) /** * Deletes a subscription. - * - * @param mixed $subscriptionId */ public function deleteSubscription($subscriptionId) { @@ -1256,7 +1234,7 @@ public function getSchedulingObject($principalUri, $objectUri) 'lastmodified' => $row['lastmodified'], 'etag' => '"'.$row['etag'].'"', 'size' => (int) $row['size'], - ]; + ]; } /** @@ -1323,7 +1301,6 @@ public function createSchedulingObject($principalUri, $objectUri, $objectData) /** * Updates the list of shares. * - * @param mixed $calendarId * @param \Sabre\DAV\Xml\Element\Sharee[] $sharees */ public function updateInvites($calendarId, array $sharees) @@ -1371,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]); @@ -1381,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) { @@ -1410,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, ]); } @@ -1431,8 +1408,6 @@ public function updateInvites($calendarId, array $sharees) * and optionally: * $properties * - * @param mixed $calendarId - * * @return \Sabre\DAV\Xml\Element\Sharee[] */ public function getInvites($calendarId) @@ -1462,7 +1437,7 @@ public function getInvites($calendarId) $result[] = new Sharee([ 'href' => isset($row['share_href']) ? $row['share_href'] : \Sabre\HTTP\encodePath($row['principaluri']), 'access' => (int) $row['access'], - /// Everyone is always immediately accepted, for now. + // Everyone is always immediately accepted, for now. 'inviteStatus' => (int) $row['share_invitestatus'], 'properties' => !empty($row['share_displayname']) ? ['{DAV:}displayname' => $row['share_displayname']] @@ -1477,8 +1452,7 @@ public function getInvites($calendarId) /** * Publishes a calendar. * - * @param mixed $calendarId - * @param bool $value + * @param bool $value */ public function setPublishStatus($calendarId, $value) { diff --git a/lib/CalDAV/Backend/SharingSupport.php b/lib/CalDAV/Backend/SharingSupport.php index ce61059902..c5847896f2 100644 --- a/lib/CalDAV/Backend/SharingSupport.php +++ b/lib/CalDAV/Backend/SharingSupport.php @@ -27,7 +27,6 @@ interface SharingSupport extends BackendInterface /** * Updates the list of shares. * - * @param mixed $calendarId * @param \Sabre\DAV\Xml\Element\Sharee[] $sharees */ public function updateInvites($calendarId, array $sharees); @@ -44,8 +43,6 @@ public function updateInvites($calendarId, array $sharees); * and optionally: * $properties * - * @param mixed $calendarId - * * @return \Sabre\DAV\Xml\Element\Sharee[] */ public function getInvites($calendarId); @@ -53,8 +50,7 @@ public function getInvites($calendarId); /** * Publishes a calendar. * - * @param mixed $calendarId - * @param bool $value + * @param bool $value */ public function setPublishStatus($calendarId, $value); } diff --git a/lib/CalDAV/Backend/SimplePDO.php b/lib/CalDAV/Backend/SimplePDO.php index 8f42072c9e..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'], - ]; + ]; } /** @@ -228,7 +228,6 @@ public function getCalendarObject($calendarId, $objectUri) * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * @@ -259,7 +258,6 @@ public function createCalendarObject($calendarId, $objectUri, $calendarData) * calendar-data. If the result of a subsequent GET to this object is not * the exact same as this request body, you should omit the ETag. * - * @param mixed $calendarId * @param string $objectUri * @param string $calendarData * diff --git a/lib/CalDAV/Backend/SubscriptionSupport.php b/lib/CalDAV/Backend/SubscriptionSupport.php index 7655c2e11a..bbd0c9589f 100644 --- a/lib/CalDAV/Backend/SubscriptionSupport.php +++ b/lib/CalDAV/Backend/SubscriptionSupport.php @@ -58,8 +58,6 @@ public function getSubscriptionsForUser($principalUri); * * @param string $principalUri * @param string $uri - * - * @return mixed */ public function createSubscription($principalUri, $uri, array $properties); @@ -74,16 +72,11 @@ public function createSubscription($principalUri, $uri, array $properties); * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param mixed $subscriptionId - * @param \Sabre\DAV\PropPatch $propPatch */ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch); /** * Deletes a subscription. - * - * @param mixed $subscriptionId */ public function deleteSubscription($subscriptionId); } diff --git a/lib/CalDAV/Calendar.php b/lib/CalDAV/Calendar.php index ba8c704a5d..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) { @@ -366,14 +366,14 @@ public function calendarQuery(array $filters) public function getSyncToken() { if ( - $this->caldavBackend instanceof Backend\SyncSupport && - isset($this->calendarInfo['{DAV:}sync-token']) + $this->caldavBackend instanceof Backend\SyncSupport + && isset($this->calendarInfo['{DAV:}sync-token']) ) { return $this->calendarInfo['{DAV:}sync-token']; } if ( - $this->caldavBackend instanceof Backend\SyncSupport && - isset($this->calendarInfo['{http://sabredav.org/ns}sync-token']) + $this->caldavBackend instanceof Backend\SyncSupport + && isset($this->calendarInfo['{http://sabredav.org/ns}sync-token']) ) { return $this->calendarInfo['{http://sabredav.org/ns}sync-token']; } diff --git a/lib/CalDAV/CalendarQueryValidator.php b/lib/CalDAV/CalendarQueryValidator.php index ee525da7a5..0cbdf3aa5a 100644 --- a/lib/CalDAV/CalendarQueryValidator.php +++ b/lib/CalDAV/CalendarQueryValidator.php @@ -4,7 +4,6 @@ namespace Sabre\CalDAV; -use DateTime; use Sabre\VObject; /** @@ -38,8 +37,8 @@ public function validate(VObject\Component\VCalendar $vObject, array $filters) } return - $this->validateCompFilters($vObject, $filters['comp-filters']) && - $this->validatePropFilters($vObject, $filters['prop-filters']); + $this->validateCompFilters($vObject, $filters['comp-filters']) + && $this->validatePropFilters($vObject, $filters['prop-filters']); } /** @@ -93,8 +92,8 @@ protected function validateCompFilters(VObject\Component $parent, array $filters // for which the subfilters hold true. foreach ($parent->{$filter['name']} as $subComponent) { if ( - $this->validateCompFilters($subComponent, $filter['comp-filters']) && - $this->validatePropFilters($subComponent, $filter['prop-filters'])) { + $this->validateCompFilters($subComponent, $filter['comp-filters']) + && $this->validatePropFilters($subComponent, $filter['prop-filters'])) { // We had a match, so this comp-filter succeeds continue 2; } @@ -162,8 +161,8 @@ protected function validatePropFilters(VObject\Component $parent, array $filters // for which the subfilters hold true. foreach ($parent->{$filter['name']} as $subComponent) { if ( - $this->validateParamFilters($subComponent, $filter['param-filters']) && - (!$filter['text-match'] || $this->validateTextMatch($subComponent, $filter['text-match'])) + $this->validateParamFilters($subComponent, $filter['param-filters']) + && (!$filter['text-match'] || $this->validateTextMatch($subComponent, $filter['text-match'])) ) { // We had a match, so this prop-filter succeeds continue 2; @@ -256,18 +255,18 @@ protected function validateTextMatch($check, array $textMatch) * This is all based on the rules specified in rfc4791, which are quite * complex. * - * @param DateTime $start - * @param DateTime $end + * @param \DateTime $start + * @param \DateTime $end * * @return bool */ protected function validateTimeRange(VObject\Node $component, $start, $end) { if (is_null($start)) { - $start = new DateTime('1900-01-01'); + $start = new \DateTime('1900-01-01'); } if (is_null($end)) { - $end = new DateTime('3000-01-01'); + $end = new \DateTime('3000-01-01'); } switch ($component->name) { diff --git a/lib/CalDAV/ICSExportPlugin.php b/lib/CalDAV/ICSExportPlugin.php index 9171e36e79..8f32c3a0cb 100644 --- a/lib/CalDAV/ICSExportPlugin.php +++ b/lib/CalDAV/ICSExportPlugin.php @@ -4,8 +4,6 @@ namespace Sabre\CalDAV; -use DateTime; -use DateTimeZone; use Sabre\DAV; use Sabre\DAV\Exception\BadRequest; use Sabre\HTTP\RequestInterface; @@ -51,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) { @@ -74,11 +70,11 @@ public function initialize(DAV\Server $server) /** * Intercepts GET requests on calendar urls ending with ?export. * + * @return bool + * * @throws BadRequest * @throws DAV\Exception\NotFound * @throws VObject\InvalidDataException - * - * @return bool */ public function httpGet(RequestInterface $request, ResponseInterface $response) { @@ -113,13 +109,13 @@ public function httpGet(RequestInterface $request, ResponseInterface $response) if (!ctype_digit($queryParams['start'])) { throw new BadRequest('The start= parameter must contain a unix timestamp'); } - $start = DateTime::createFromFormat('U', $queryParams['start']); + $start = \DateTime::createFromFormat('U', $queryParams['start']); } if (isset($queryParams['end'])) { if (!ctype_digit($queryParams['end'])) { throw new BadRequest('The end= parameter must contain a unix timestamp'); } - $end = DateTime::createFromFormat('U', $queryParams['end']); + $end = \DateTime::createFromFormat('U', $queryParams['end']); } if (isset($queryParams['expand']) && (bool) $queryParams['expand']) { if (!$start || !$end) { @@ -161,13 +157,13 @@ public function httpGet(RequestInterface $request, ResponseInterface $response) /** * This method is responsible for generating the actual, full response. * - * @param string $path - * @param DateTime|null $start - * @param DateTime|null $end - * @param bool $expand - * @param string $componentType - * @param string $format - * @param array $properties + * @param string $path + * @param \DateTime|null $start + * @param \DateTime|null $end + * @param bool $expand + * @param string $componentType + * @param string $format + * @param array $properties * * @throws DAV\Exception\NotFound * @throws VObject\InvalidDataException @@ -243,7 +239,7 @@ function ($item) use ($path) { unset($vtimezoneObj); } else { // Defaulting to UTC. - $calendarTimeZone = new DateTimeZone('UTC'); + $calendarTimeZone = new \DateTimeZone('UTC'); } $mergedCalendar = $mergedCalendar->expand($start, $end, $calendarTimeZone); @@ -315,7 +311,7 @@ public function mergeObjects(array $properties, array $inputObjects) $objects[] = clone $child; break; - // VTIMEZONE is special, because we need to filter out the duplicates + // VTIMEZONE is special, because we need to filter out the duplicates case 'VTIMEZONE': // Naively just checking tzid. if (in_array((string) $child->TZID, $collectedTimezones)) { diff --git a/lib/CalDAV/Notifications/Plugin.php b/lib/CalDAV/Notifications/Plugin.php index 56b2fe9384..c1db94cc73 100644 --- a/lib/CalDAV/Notifications/Plugin.php +++ b/lib/CalDAV/Notifications/Plugin.php @@ -31,7 +31,7 @@ class Plugin extends ServerPlugin /** * This is the namespace for the proprietary calendarserver extensions. */ - const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; + public const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; /** * Reference to the main server object. diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php index ccb722f857..c7ac5aabc1 100644 --- a/lib/CalDAV/Plugin.php +++ b/lib/CalDAV/Plugin.php @@ -4,7 +4,6 @@ namespace Sabre\CalDAV; -use DateTimeZone; use Sabre\CalDAV\Xml\Request\CalendarMultiGetReport; use Sabre\DAV; use Sabre\DAV\Exception\BadRequest; @@ -33,18 +32,18 @@ class Plugin extends DAV\ServerPlugin /** * This is the official CalDAV namespace. */ - const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav'; + public const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav'; /** * This is the namespace for the proprietary calendarserver extensions. */ - const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; + public const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; /** * The hardcoded root for calendar objects. It is unfortunate * that we're stuck with it, but it will have to do for now. */ - const CALENDAR_ROOT = 'calendars'; + public const CALENDAR_ROOT = 'calendars'; /** * Reference to server object. @@ -240,8 +239,6 @@ public function initialize(DAV\Server $server) * This functions handles REPORT requests specific to CalDAV. * * @param string $reportName - * @param mixed $report - * @param mixed $path * * @return bool|null */ @@ -319,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.'}'; @@ -453,7 +450,7 @@ public function calendarMultiGetReport($report) $timeZone = $vtimezoneObj->VTIMEZONE->getTimeZone(); } else { // Defaulting to UTC. - $timeZone = new DateTimeZone('UTC'); + $timeZone = new \DateTimeZone('UTC'); } $timeZones[$calendarPath] = $timeZone; } @@ -518,7 +515,7 @@ public function calendarQueryReport($report) $vtimezoneObj->destroy(); } else { // Defaulting to UTC. - $calendarTimeZone = new DateTimeZone('UTC'); + $calendarTimeZone = new \DateTimeZone('UTC'); } } @@ -601,7 +598,7 @@ public function calendarQueryReport($report) list($properties) = $this->server->getPropertiesForPath($this->server->getRequestUri().'/'.$path, $report->properties); - if (($needsJson || $report->expand)) { + if ($needsJson || $report->expand) { $vObject = VObject\Reader::read($properties[200]['{'.self::NS_CALDAV.'}calendar-data']); if ($report->expand) { @@ -660,7 +657,7 @@ protected function freeBusyQueryReport(Xml\Request\FreeBusyQueryReport $report) // Destroy circular references so PHP will garbage collect the object. $vtimezoneObj->destroy(); } else { - $calendarTimeZone = new DateTimeZone('UTC'); + $calendarTimeZone = new \DateTimeZone('UTC'); } // Doing a calendar-query first, to make sure we get the most @@ -935,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/IMipPlugin.php b/lib/CalDAV/Schedule/IMipPlugin.php index dcaf951efd..4602c3ec55 100644 --- a/lib/CalDAV/Schedule/IMipPlugin.php +++ b/lib/CalDAV/Schedule/IMipPlugin.php @@ -26,6 +26,9 @@ class IMipPlugin extends DAV\ServerPlugin /** * Email address used in From: header. * + * This should generally be some kind of no-reply + * email address that you own. + * * @var string */ protected $senderEmail; @@ -33,10 +36,7 @@ class IMipPlugin extends DAV\ServerPlugin /** * Creates the email handler. * - * @param string $senderEmail. The 'senderEmail' is the email that shows up - * in the 'From:' address. This should - * generally be some kind of no-reply email - * address you own. + * @param string $senderEmail */ public function __construct($senderEmail) { diff --git a/lib/CalDAV/Schedule/Inbox.php b/lib/CalDAV/Schedule/Inbox.php index 4620690969..94166ee7b2 100644 --- a/lib/CalDAV/Schedule/Inbox.php +++ b/lib/CalDAV/Schedule/Inbox.php @@ -68,7 +68,7 @@ public function getChildren() $objs = $this->caldavBackend->getSchedulingObjects($this->principalUri); $children = []; foreach ($objs as $obj) { - //$obj['acl'] = $this->getACL(); + // $obj['acl'] = $this->getACL(); $obj['principaluri'] = $this->principalUri; $children[] = new SchedulingObject($this->caldavBackend, $obj); } diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php index 5e56596101..19dae4aed1 100644 --- a/lib/CalDAV/Schedule/Plugin.php +++ b/lib/CalDAV/Schedule/Plugin.php @@ -4,7 +4,6 @@ namespace Sabre\CalDAV\Schedule; -use DateTimeZone; use Sabre\CalDAV\ICalendar; use Sabre\CalDAV\ICalendarObject; use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp; @@ -60,7 +59,7 @@ class Plugin extends ServerPlugin /** * This is the official CalDAV namespace. */ - const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav'; + public const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav'; /** * Reference to main Server object. @@ -269,20 +268,20 @@ public function propFind(PropFind $propFind, INode $node) // old property to a different namespace. $availProp = '{'.self::NS_CALDAV.'}calendar-availability'; $subPropFind = new PropFind( - $propFind->getPath(), - [$availProp] - ); + $propFind->getPath(), + [$availProp] + ); $this->server->getPropertiesByNode( - $subPropFind, - $node - ); + $subPropFind, + $node + ); $propFind->set( - '{http://calendarserver.org/ns/}calendar-availability', - $subPropFind->get($availProp), - $subPropFind->getStatus($availProp) - ); + '{http://calendarserver.org/ns/}calendar-availability', + $subPropFind->get($availProp), + $subPropFind->getStatus($availProp) + ); }); } @@ -345,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) { @@ -403,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'); @@ -433,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', ] ); @@ -689,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()); } @@ -873,7 +872,7 @@ protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateT // Grabbing the calendar list $objects = []; - $calendarTimeZone = new DateTimeZone('UTC'); + $calendarTimeZone = new \DateTimeZone('UTC'); foreach ($this->server->tree->getNodeForPath($homeSet)->getChildren() as $node) { if (!$node instanceof ICalendar) { @@ -891,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. @@ -932,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(); @@ -943,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 bacfe04415..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; @@ -224,8 +224,8 @@ public function httpPost(RequestInterface $request, ResponseInterface $response) // Breaking the event chain return false; - // The invite-reply document is sent when the user replies to an - // invitation of a calendar share. + // The invite-reply document is sent when the user replies to an + // invitation of a calendar share. case '{'.Plugin::NS_CALENDARSERVER.'}invite-reply': // This only works on the calendar-home-root node. if (!$node instanceof CalendarHome) { 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/Filter/CalendarData.php b/lib/CalDAV/Xml/Filter/CalendarData.php index c9656d8a30..e934d0ea57 100644 --- a/lib/CalDAV/Xml/Filter/CalendarData.php +++ b/lib/CalDAV/Xml/Filter/CalendarData.php @@ -46,8 +46,6 @@ class CalendarData implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Filter/CompFilter.php b/lib/CalDAV/Xml/Filter/CompFilter.php index 929000bb8b..dcf96c4c97 100644 --- a/lib/CalDAV/Xml/Filter/CompFilter.php +++ b/lib/CalDAV/Xml/Filter/CompFilter.php @@ -43,8 +43,6 @@ class CompFilter implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -64,28 +62,28 @@ public static function xmlDeserialize(Reader $reader) if (is_array($elems)) { foreach ($elems as $elem) { switch ($elem['name']) { - case '{'.Plugin::NS_CALDAV.'}comp-filter': - $result['comp-filters'][] = $elem['value']; - break; - case '{'.Plugin::NS_CALDAV.'}prop-filter': - $result['prop-filters'][] = $elem['value']; - break; - case '{'.Plugin::NS_CALDAV.'}is-not-defined': - $result['is-not-defined'] = true; - break; - case '{'.Plugin::NS_CALDAV.'}time-range': - if ('VCALENDAR' === $result['name']) { - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); - } - $result['time-range'] = [ - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, - ]; - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { - throw new BadRequest('The end-date must be larger than the start-date'); - } - break; - } + case '{'.Plugin::NS_CALDAV.'}comp-filter': + $result['comp-filters'][] = $elem['value']; + break; + case '{'.Plugin::NS_CALDAV.'}prop-filter': + $result['prop-filters'][] = $elem['value']; + break; + case '{'.Plugin::NS_CALDAV.'}is-not-defined': + $result['is-not-defined'] = true; + break; + case '{'.Plugin::NS_CALDAV.'}time-range': + if ('VCALENDAR' === $result['name']) { + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); + } + $result['time-range'] = [ + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, + ]; + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { + throw new BadRequest('The end-date must be larger than the start-date'); + } + break; + } } } diff --git a/lib/CalDAV/Xml/Filter/ParamFilter.php b/lib/CalDAV/Xml/Filter/ParamFilter.php index 1e6dd5946d..a012de3655 100644 --- a/lib/CalDAV/Xml/Filter/ParamFilter.php +++ b/lib/CalDAV/Xml/Filter/ParamFilter.php @@ -41,8 +41,6 @@ class ParamFilter implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -60,17 +58,17 @@ public static function xmlDeserialize(Reader $reader) if (is_array($elems)) { foreach ($elems as $elem) { switch ($elem['name']) { - case '{'.Plugin::NS_CALDAV.'}is-not-defined': - $result['is-not-defined'] = true; - break; - case '{'.Plugin::NS_CALDAV.'}text-match': - $result['text-match'] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', - 'value' => $elem['value'], - ]; - break; - } + case '{'.Plugin::NS_CALDAV.'}is-not-defined': + $result['is-not-defined'] = true; + break; + case '{'.Plugin::NS_CALDAV.'}text-match': + $result['text-match'] = [ + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', + 'value' => $elem['value'], + ]; + break; + } } } diff --git a/lib/CalDAV/Xml/Filter/PropFilter.php b/lib/CalDAV/Xml/Filter/PropFilter.php index f1d66cc0d6..2ffb946944 100644 --- a/lib/CalDAV/Xml/Filter/PropFilter.php +++ b/lib/CalDAV/Xml/Filter/PropFilter.php @@ -43,8 +43,6 @@ class PropFilter implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -64,29 +62,29 @@ public static function xmlDeserialize(Reader $reader) if (is_array($elems)) { foreach ($elems as $elem) { switch ($elem['name']) { - case '{'.Plugin::NS_CALDAV.'}param-filter': - $result['param-filters'][] = $elem['value']; - break; - case '{'.Plugin::NS_CALDAV.'}is-not-defined': - $result['is-not-defined'] = true; - break; - case '{'.Plugin::NS_CALDAV.'}time-range': - $result['time-range'] = [ - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, - ]; - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { - throw new BadRequest('The end-date must be larger than the start-date'); - } - break; - case '{'.Plugin::NS_CALDAV.'}text-match': - $result['text-match'] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', - 'value' => $elem['value'], - ]; - break; - } + case '{'.Plugin::NS_CALDAV.'}param-filter': + $result['param-filters'][] = $elem['value']; + break; + case '{'.Plugin::NS_CALDAV.'}is-not-defined': + $result['is-not-defined'] = true; + break; + case '{'.Plugin::NS_CALDAV.'}time-range': + $result['time-range'] = [ + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, + ]; + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { + throw new BadRequest('The end-date must be larger than the start-date'); + } + break; + case '{'.Plugin::NS_CALDAV.'}text-match': + $result['text-match'] = [ + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', + 'value' => $elem['value'], + ]; + break; + } } } diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php index 71ccf49b15..d6caaac825 100644 --- a/lib/CalDAV/Xml/Notification/Invite.php +++ b/lib/CalDAV/Xml/Notification/Invite.php @@ -5,7 +5,7 @@ namespace Sabre\CalDAV\Xml\Notification; use Sabre\CalDAV; -use Sabre\CalDAV\SharingPlugin as SharingPlugin; +use Sabre\CalDAV\SharingPlugin; use Sabre\DAV; use Sabre\Xml\Writer; @@ -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/CalDAV/Xml/Notification/SystemStatus.php b/lib/CalDAV/Xml/Notification/SystemStatus.php index 666f8f4c5e..cfe892b882 100644 --- a/lib/CalDAV/Xml/Notification/SystemStatus.php +++ b/lib/CalDAV/Xml/Notification/SystemStatus.php @@ -19,9 +19,9 @@ */ class SystemStatus implements NotificationInterface { - const TYPE_LOW = 1; - const TYPE_MEDIUM = 2; - const TYPE_HIGH = 3; + public const TYPE_LOW = 1; + public const TYPE_MEDIUM = 2; + public const TYPE_HIGH = 3; /** * A unique id. diff --git a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php index 45e290bc01..7a5fa8dd3c 100644 --- a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php +++ b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php @@ -28,8 +28,8 @@ */ class ScheduleCalendarTransp implements Element { - const TRANSPARENT = 'transparent'; - const OPAQUE = 'opaque'; + public const TRANSPARENT = 'transparent'; + public const OPAQUE = 'opaque'; /** * value. @@ -106,8 +106,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php index 3fe03f4f2d..cfb32efd9d 100644 --- a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php +++ b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php @@ -94,8 +94,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php b/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php index 4771a20702..66d25bc48e 100644 --- a/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php +++ b/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php @@ -45,7 +45,7 @@ class CalendarMultiGetReport implements XmlDeserializable * * @var array|null */ - public $expand = null; + public $expand; /** * The mimetype of the content that should be returned. Usually @@ -53,7 +53,7 @@ class CalendarMultiGetReport implements XmlDeserializable * * @var string */ - public $contentType = null; + public $contentType; /** * The version of calendar-data that should be returned. Usually '2.0', @@ -61,7 +61,7 @@ class CalendarMultiGetReport implements XmlDeserializable * * @var string */ - public $version = null; + public $version; /** * The deserialize method is called during xml parsing. @@ -80,8 +80,6 @@ class CalendarMultiGetReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/CalendarQueryReport.php b/lib/CalDAV/Xml/Request/CalendarQueryReport.php index 5a4df46742..bc47cc9854 100644 --- a/lib/CalDAV/Xml/Request/CalendarQueryReport.php +++ b/lib/CalDAV/Xml/Request/CalendarQueryReport.php @@ -45,7 +45,7 @@ class CalendarQueryReport implements XmlDeserializable * * @var array|null */ - public $expand = null; + public $expand; /** * The mimetype of the content that should be returned. Usually @@ -53,7 +53,7 @@ class CalendarQueryReport implements XmlDeserializable * * @var string */ - public $contentType = null; + public $contentType; /** * The version of calendar-data that should be returned. Usually '2.0', @@ -61,7 +61,7 @@ class CalendarQueryReport implements XmlDeserializable * * @var string */ - public $version = null; + public $version; /** * The deserialize method is called during xml parsing. @@ -80,8 +80,6 @@ class CalendarQueryReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php b/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php index 17df05a78a..24b6a650f1 100644 --- a/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php +++ b/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php @@ -54,8 +54,6 @@ class FreeBusyQueryReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/InviteReply.php b/lib/CalDAV/Xml/Request/InviteReply.php index 166721eb36..f73e6b721d 100644 --- a/lib/CalDAV/Xml/Request/InviteReply.php +++ b/lib/CalDAV/Xml/Request/InviteReply.php @@ -97,8 +97,6 @@ public function __construct($href, $calendarUri, $inReplyTo, $summary, $status) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/MkCalendar.php b/lib/CalDAV/Xml/Request/MkCalendar.php index b5701e2ead..48c80a32de 100644 --- a/lib/CalDAV/Xml/Request/MkCalendar.php +++ b/lib/CalDAV/Xml/Request/MkCalendar.php @@ -54,8 +54,6 @@ public function getProperties() * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CalDAV/Xml/Request/Share.php b/lib/CalDAV/Xml/Request/Share.php index d597b76f1e..46a5d6386e 100644 --- a/lib/CalDAV/Xml/Request/Share.php +++ b/lib/CalDAV/Xml/Request/Share.php @@ -56,8 +56,6 @@ public function __construct(array $sharees) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CardDAV/AddressBook.php b/lib/CardDAV/AddressBook.php index f5744f644b..69e4ceedb9 100644 --- a/lib/CardDAV/AddressBook.php +++ b/lib/CardDAV/AddressBook.php @@ -250,14 +250,14 @@ public function getChildACL() public function getSyncToken() { if ( - $this->carddavBackend instanceof Backend\SyncSupport && - isset($this->addressBookInfo['{DAV:}sync-token']) + $this->carddavBackend instanceof Backend\SyncSupport + && isset($this->addressBookInfo['{DAV:}sync-token']) ) { return $this->addressBookInfo['{DAV:}sync-token']; } if ( - $this->carddavBackend instanceof Backend\SyncSupport && - isset($this->addressBookInfo['{http://sabredav.org/ns}sync-token']) + $this->carddavBackend instanceof Backend\SyncSupport + && isset($this->addressBookInfo['{http://sabredav.org/ns}sync-token']) ) { return $this->addressBookInfo['{http://sabredav.org/ns}sync-token']; } diff --git a/lib/CardDAV/Backend/AbstractBackend.php b/lib/CardDAV/Backend/AbstractBackend.php index a900c62562..6a9aecf032 100644 --- a/lib/CardDAV/Backend/AbstractBackend.php +++ b/lib/CardDAV/Backend/AbstractBackend.php @@ -25,8 +25,6 @@ abstract class AbstractBackend implements BackendInterface * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $addressBookId - * * @return array */ public function getMultipleCards($addressBookId, array $uris) diff --git a/lib/CardDAV/Backend/BackendInterface.php b/lib/CardDAV/Backend/BackendInterface.php index f9955ac832..093a035585 100644 --- a/lib/CardDAV/Backend/BackendInterface.php +++ b/lib/CardDAV/Backend/BackendInterface.php @@ -63,15 +63,11 @@ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatc * * @param string $principalUri * @param string $url just the 'basename' of the url - * - * @return mixed */ public function createAddressBook($principalUri, $url, array $properties); /** * Deletes an entire addressbook and all its contents. - * - * @param mixed $addressBookId */ public function deleteAddressBook($addressBookId); @@ -91,8 +87,6 @@ public function deleteAddressBook($addressBookId); * calculating them. If they are specified, you can also omit carddata. * This may speed up certain requests, especially with large cards. * - * @param mixed $addressbookId - * * @return array */ public function getCards($addressbookId); @@ -105,7 +99,6 @@ public function getCards($addressbookId); * * If the card does not exist, you must return false. * - * @param mixed $addressBookId * @param string $cardUri * * @return array @@ -120,8 +113,6 @@ public function getCard($addressBookId, $cardUri); * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $addressBookId - * * @return array */ public function getMultipleCards($addressBookId, array $uris); @@ -146,7 +137,6 @@ public function getMultipleCards($addressBookId, array $uris); * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * @@ -174,7 +164,6 @@ public function createCard($addressBookId, $cardUri, $cardData); * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * @@ -185,7 +174,6 @@ public function updateCard($addressBookId, $cardUri, $cardData); /** * Deletes a card. * - * @param mixed $addressBookId * @param string $cardUri * * @return bool diff --git a/lib/CardDAV/Backend/PDO.php b/lib/CardDAV/Backend/PDO.php index 7b935a4aec..7a9cfacdd8 100644 --- a/lib/CardDAV/Backend/PDO.php +++ b/lib/CardDAV/Backend/PDO.php @@ -208,8 +208,6 @@ public function deleteAddressBook($addressBookId) * calculating them. If they are specified, you can also omit carddata. * This may speed up certain requests, especially with large cards. * - * @param mixed $addressbookId - * * @return array */ public function getCards($addressbookId) @@ -235,7 +233,6 @@ public function getCards($addressbookId) * * If the card does not exist, you must return false. * - * @param mixed $addressBookId * @param string $cardUri * * @return array @@ -265,8 +262,6 @@ public function getCard($addressBookId, $cardUri) * * If the backend supports this, it may allow for some speed-ups. * - * @param mixed $addressBookId - * * @return array */ public function getMultipleCards($addressBookId, array $uris) @@ -308,7 +303,6 @@ public function getMultipleCards($addressBookId, array $uris) * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * @@ -354,7 +348,6 @@ public function createCard($addressBookId, $cardUri, $cardData) * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * @@ -382,7 +375,6 @@ public function updateCard($addressBookId, $cardUri, $cardData) /** * Deletes a card. * - * @param mixed $addressBookId * @param string $cardUri * * @return bool @@ -518,9 +510,8 @@ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, /** * Adds a change record to the addressbookchanges table. * - * @param mixed $addressBookId * @param string $objectUri - * @param int $operation 1 = add, 2 = modify, 3 = delete + * @param int $operation 1 = add, 2 = modify, 3 = delete */ protected function addChange($addressBookId, $objectUri, $operation) { diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php index c2d31d9dfe..87bcc2b239 100644 --- a/lib/CardDAV/Plugin.php +++ b/lib/CardDAV/Plugin.php @@ -28,12 +28,12 @@ class Plugin extends DAV\ServerPlugin /** * Url to the addressbooks. */ - const ADDRESSBOOK_ROOT = 'addressbooks'; + public const ADDRESSBOOK_ROOT = 'addressbooks'; /** * xml namespace for CardDAV elements. */ - const NS_CARDDAV = 'urn:ietf:params:xml:ns:carddav'; + public const NS_CARDDAV = 'urn:ietf:params:xml:ns:carddav'; /** * Add urls to this property to have them automatically exposed as @@ -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', ]; } @@ -177,7 +177,6 @@ public function propFindEarly(DAV\PropFind $propFind, DAV\INode $node) * * @param string $reportName * @param \DOMNode $dom - * @param mixed $path * * @return bool */ @@ -579,7 +578,7 @@ protected function validateParamFilters(array $vProperties, array $filters, $tes $success = true; } - // If there's no text-match, we can just check for existence + // If there's no text-match, we can just check for existence } elseif (!$filter['text-match'] || !$isDefined) { $success = $isDefined; } else { @@ -786,7 +785,7 @@ protected function negotiateVCard($input, &$mimeType = null) case 'application/vcard+json': return 'jcard'; - // @codeCoverageIgnoreStart + // @codeCoverageIgnoreStart } // @codeCoverageIgnoreEnd } @@ -796,11 +795,10 @@ protected function negotiateVCard($input, &$mimeType = null) * * @param string|resource $data * @param string $target - * @param array $propertiesFilter * * @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/Filter/AddressData.php b/lib/CardDAV/Xml/Filter/AddressData.php index b60fcebb63..41ecab4a1c 100644 --- a/lib/CardDAV/Xml/Filter/AddressData.php +++ b/lib/CardDAV/Xml/Filter/AddressData.php @@ -42,8 +42,6 @@ class AddressData implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -54,8 +52,8 @@ public static function xmlDeserialize(Reader $reader) $elems = (array) $reader->parseInnerTree(); $elems = array_filter($elems, function ($element) { - return '{urn:ietf:params:xml:ns:carddav}prop' === $element['name'] && - isset($element['attributes']['name']); + return '{urn:ietf:params:xml:ns:carddav}prop' === $element['name'] + && isset($element['attributes']['name']); }); $result['addressDataProperties'] = array_map(function ($element) { return $element['attributes']['name']; diff --git a/lib/CardDAV/Xml/Filter/ParamFilter.php b/lib/CardDAV/Xml/Filter/ParamFilter.php index 0a7ec06590..a44a6b82fb 100644 --- a/lib/CardDAV/Xml/Filter/ParamFilter.php +++ b/lib/CardDAV/Xml/Filter/ParamFilter.php @@ -42,8 +42,6 @@ abstract class ParamFilter implements Element * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -61,23 +59,23 @@ public static function xmlDeserialize(Reader $reader) if (is_array($elems)) { foreach ($elems as $elem) { switch ($elem['name']) { - case '{'.Plugin::NS_CARDDAV.'}is-not-defined': - $result['is-not-defined'] = true; - break; - case '{'.Plugin::NS_CARDDAV.'}text-match': - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; + case '{'.Plugin::NS_CARDDAV.'}is-not-defined': + $result['is-not-defined'] = true; + break; + case '{'.Plugin::NS_CARDDAV.'}text-match': + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { - throw new BadRequest('Unknown match-type: '.$matchType); - } - $result['text-match'] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', - 'value' => $elem['value'], - 'match-type' => $matchType, - ]; - break; - } + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { + throw new BadRequest('Unknown match-type: '.$matchType); + } + $result['text-match'] = [ + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', + 'value' => $elem['value'], + 'match-type' => $matchType, + ]; + break; + } } } diff --git a/lib/CardDAV/Xml/Filter/PropFilter.php b/lib/CardDAV/Xml/Filter/PropFilter.php index 5dedac8007..4c90412d1b 100644 --- a/lib/CardDAV/Xml/Filter/PropFilter.php +++ b/lib/CardDAV/Xml/Filter/PropFilter.php @@ -42,8 +42,6 @@ class PropFilter implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -67,26 +65,26 @@ public static function xmlDeserialize(Reader $reader) if (is_array($elems)) { foreach ($elems as $elem) { switch ($elem['name']) { - case '{'.Plugin::NS_CARDDAV.'}param-filter': - $result['param-filters'][] = $elem['value']; - break; - case '{'.Plugin::NS_CARDDAV.'}is-not-defined': - $result['is-not-defined'] = true; - break; - case '{'.Plugin::NS_CARDDAV.'}text-match': - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; + case '{'.Plugin::NS_CARDDAV.'}param-filter': + $result['param-filters'][] = $elem['value']; + break; + case '{'.Plugin::NS_CARDDAV.'}is-not-defined': + $result['is-not-defined'] = true; + break; + case '{'.Plugin::NS_CARDDAV.'}text-match': + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { - throw new BadRequest('Unknown match-type: '.$matchType); - } - $result['text-matches'][] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', - 'value' => $elem['value'], - 'match-type' => $matchType, - ]; - break; - } + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { + throw new BadRequest('Unknown match-type: '.$matchType); + } + $result['text-matches'][] = [ + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', + 'value' => $elem['value'], + 'match-type' => $matchType, + ]; + break; + } } } 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/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php index 491f969088..1640e10a6f 100644 --- a/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php +++ b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php @@ -43,7 +43,7 @@ class AddressBookMultiGetReport implements XmlDeserializable * * @var string */ - public $contentType = null; + public $contentType; /** * The version of vcard data that should be returned. Usually 3.0, @@ -51,7 +51,7 @@ class AddressBookMultiGetReport implements XmlDeserializable * * @var string */ - public $version = null; + public $version; /** * An array with requested vcard properties. @@ -77,8 +77,6 @@ class AddressBookMultiGetReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php index 02402f6c79..6148dc4d75 100644 --- a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php +++ b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php @@ -87,7 +87,7 @@ class AddressBookQueryReport implements XmlDeserializable * * @var string */ - public $contentType = null; + public $contentType; /** * The version of vcard data that should be returned. Usually 3.0, @@ -95,7 +95,7 @@ class AddressBookQueryReport implements XmlDeserializable * * @var string */ - public $version = null; + public $version; /** * The deserialize method is called during xml parsing. @@ -114,8 +114,6 @@ class AddressBookQueryReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -179,7 +177,7 @@ public static function xmlDeserialize(Reader $reader) * include the filter element, and we need to treat it as if no * filters are supplied */ - //throw new BadRequest('The {' . Plugin::NS_CARDDAV . '}filter element is required for this request'); + // throw new BadRequest('The {' . Plugin::NS_CARDDAV . '}filter element is required for this request'); $newProps['filters'] = []; } diff --git a/lib/DAV/Auth/Plugin.php b/lib/DAV/Auth/Plugin.php index eb4f27ca67..4a0552c16f 100644 --- a/lib/DAV/Auth/Plugin.php +++ b/lib/DAV/Auth/Plugin.php @@ -55,10 +55,8 @@ class Plugin extends ServerPlugin /** * Creates the authentication plugin. - * - * @param Backend\BackendInterface $authBackend */ - public function __construct(Backend\BackendInterface $authBackend = null) + public function __construct(?Backend\BackendInterface $authBackend = null) { if (!is_null($authBackend)) { $this->addBackend($authBackend); @@ -187,6 +185,7 @@ public function check(RequestInterface $request, ResponseInterface $response) if ($result[0]) { $this->currentPrincipal = $result[1]; + // Exit early return [true, $result[1]]; } diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php index a8a6f430e4..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', ]; @@ -159,8 +159,8 @@ public function httpPOST(RequestInterface $request, ResponseInterface $response) return; } list($contentType) = explode(';', $contentType); - if ('application/x-www-form-urlencoded' !== $contentType && - 'multipart/form-data' !== $contentType) { + if ('application/x-www-form-urlencoded' !== $contentType + && 'multipart/form-data' !== $contentType) { return; } $postVars = $request->getPostData(); @@ -208,7 +208,7 @@ public function httpPOST(RequestInterface $request, ResponseInterface $response) } break; - // @codeCoverageIgnoreStart + // @codeCoverageIgnoreStart case 'put': if ($_FILES) { $file = current($_FILES); @@ -228,7 +228,7 @@ public function httpPOST(RequestInterface $request, ResponseInterface $response) $this->server->createFile($uri.'/'.$newName, fopen($file['tmp_name'], 'r')); } break; - // @codeCoverageIgnoreEnd + // @codeCoverageIgnoreEnd } } $response->setHeader('Location', $request->getUrl()); @@ -488,7 +488,6 @@ public function generateFooter() * This specifically generates the interfaces for creating new files, and * creating new directories. * - * @param mixed $output * @param string $path */ public function htmlActionsPanel(DAV\INode $node, &$output, $path) @@ -538,9 +537,9 @@ protected function getAssetUrl($assetName) * * @param string $assetName * - * @throws DAV\Exception\NotFound - * * @return string + * + * @throws DAV\Exception\NotFound */ protected function getLocalAssetPath($assetName) { @@ -711,7 +710,6 @@ private function mapResourceType(array $resourceTypes, $node) * Draws a table row for a property. * * @param string $name - * @param mixed $value * * @return string */ @@ -729,7 +727,6 @@ private function drawPropertyRow($name, $value) * Draws a table row for a property. * * @param HtmlOutputHelper $html - * @param mixed $value * * @return string */ diff --git a/lib/DAV/Browser/PropFindAll.php b/lib/DAV/Browser/PropFindAll.php index 34702bdd8a..b15a9a9266 100644 --- a/lib/DAV/Browser/PropFindAll.php +++ b/lib/DAV/Browser/PropFindAll.php @@ -45,7 +45,6 @@ public function __construct($path) * It's also possible to not pass a callback, but immediately pass a value * * @param string $propertyName - * @param mixed $valueOrCallBack */ public function handle($propertyName, $valueOrCallBack) { @@ -66,7 +65,6 @@ public function handle($propertyName, $valueOrCallBack) * properties, and 404 for null properties. * * @param string $propertyName - * @param mixed $value * @param int $status */ public function set($propertyName, $value, $status = null) @@ -81,8 +79,6 @@ public function set($propertyName, $value, $status = null) * Returns the current value for a property. * * @param string $propertyName - * - * @return mixed */ public function get($propertyName) { diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php index 187b29ba37..6128a15240 100644 --- a/lib/DAV/Client.php +++ b/lib/DAV/Client.php @@ -25,8 +25,6 @@ class Client extends HTTP\Client * The xml service. * * Uset this service to configure the property and namespace maps. - * - * @var mixed */ public $xml; @@ -54,37 +52,37 @@ class Client extends HTTP\Client /** * Basic authentication. */ - const AUTH_BASIC = 1; + public const AUTH_BASIC = 1; /** * Digest authentication. */ - const AUTH_DIGEST = 2; + public const AUTH_DIGEST = 2; /** * NTLM authentication. */ - const AUTH_NTLM = 4; + public const AUTH_NTLM = 4; /** * Identity encoding, which basically does not nothing. */ - const ENCODING_IDENTITY = 1; + public const ENCODING_IDENTITY = 1; /** * Deflate encoding. */ - const ENCODING_DEFLATE = 2; + public const ENCODING_DEFLATE = 2; /** * Gzip encoding. */ - const ENCODING_GZIP = 4; + public const ENCODING_GZIP = 4; /** * Sends all encoding headers. */ - const ENCODING_ALL = 7; + public const ENCODING_ALL = 7; /** * Content-encoding. @@ -412,9 +410,9 @@ public function options() * @param string $url * @param string|resource|null $body * - * @throws clientException, in case a curl error occurred - * * @return array + * + * @throws clientException, in case a curl error occurred */ public function request($method, $url = '', $body = null, array $headers = []) { diff --git a/lib/DAV/Collection.php b/lib/DAV/Collection.php index 2728bb27ed..6d8557db41 100644 --- a/lib/DAV/Collection.php +++ b/lib/DAV/Collection.php @@ -28,9 +28,9 @@ abstract class Collection extends Node implements ICollection * * @param string $name * - * @throws Exception\NotFound - * * @return INode + * + * @throws Exception\NotFound */ public function getChild($name) { diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php index dbd8976b17..8d5d463b38 100644 --- a/lib/DAV/CorePlugin.php +++ b/lib/DAV/CorePlugin.php @@ -197,6 +197,7 @@ public function httpGet(RequestInterface $request, ResponseInterface $response) $response->setStatus(200); $response->setBody($body); } + // Sending back false will interrupt the event chain and tell the server // we've handled this method. return false; @@ -439,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 @@ -539,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']); @@ -861,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 28263cf13e..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; @@ -29,10 +29,8 @@ class Locked extends DAV\Exception * * A LockInfo object should be passed if the user should be informed * which lock actually has the file locked. - * - * @param DAV\Locks\LockInfo $lock */ - public function __construct(DAV\Locks\LockInfo $lock = null) + public function __construct(?DAV\Locks\LockInfo $lock = null) { parent::__construct(); diff --git a/lib/DAV/Exception/PreconditionFailed.php b/lib/DAV/Exception/PreconditionFailed.php index 7240f36964..5a57c347a2 100644 --- a/lib/DAV/Exception/PreconditionFailed.php +++ b/lib/DAV/Exception/PreconditionFailed.php @@ -27,7 +27,7 @@ class PreconditionFailed extends DAV\Exception * * @var string */ - public $header = null; + public $header; /** * Create the exception. diff --git a/lib/DAV/FS/Directory.php b/lib/DAV/FS/Directory.php index 047692294b..690929b016 100644 --- a/lib/DAV/FS/Directory.php +++ b/lib/DAV/FS/Directory.php @@ -67,9 +67,9 @@ public function createDirectory($name) * * @param string $name * - * @throws DAV\Exception\NotFound - * * @return DAV\INode + * + * @throws DAV\Exception\NotFound */ public function getChild($name) { diff --git a/lib/DAV/FS/File.php b/lib/DAV/FS/File.php index b78a801389..0048b8c705 100644 --- a/lib/DAV/FS/File.php +++ b/lib/DAV/FS/File.php @@ -61,8 +61,6 @@ public function getSize() * The ETag is an arbitrary string, but MUST be surrounded by double-quotes. * * Return null if the ETag can not effectively be determined - * - * @return mixed */ public function getETag() { @@ -77,8 +75,6 @@ public function getETag() * Returns the mime-type for a file. * * If null is returned, we'll assume application/octet-stream - * - * @return mixed */ public function getContentType() { diff --git a/lib/DAV/FSExt/Directory.php b/lib/DAV/FSExt/Directory.php index d6aea00949..37fd0b5761 100644 --- a/lib/DAV/FSExt/Directory.php +++ b/lib/DAV/FSExt/Directory.php @@ -82,9 +82,9 @@ public function createDirectory($name) * * @param string $name * - * @throws DAV\Exception\NotFound - * * @return DAV\INode + * + * @throws DAV\Exception\NotFound */ public function getChild($name) { diff --git a/lib/DAV/File.php b/lib/DAV/File.php index daf83aa4d8..7a16ef04d0 100644 --- a/lib/DAV/File.php +++ b/lib/DAV/File.php @@ -46,8 +46,6 @@ public function put($data) * Returns the data. * * This method may either return a string or a readable stream resource - * - * @return mixed */ public function get() { diff --git a/lib/DAV/IFile.php b/lib/DAV/IFile.php index 974aee00dd..b9cf23c5f2 100644 --- a/lib/DAV/IFile.php +++ b/lib/DAV/IFile.php @@ -44,8 +44,6 @@ public function put($data); * Returns the data. * * This method may either return a string or a readable stream resource - * - * @return mixed */ public function get(); diff --git a/lib/DAV/Locks/Backend/File.php b/lib/DAV/Locks/Backend/File.php index b381894999..5b9de471ed 100644 --- a/lib/DAV/Locks/Backend/File.php +++ b/lib/DAV/Locks/Backend/File.php @@ -59,12 +59,12 @@ public function getLocks($uri, $returnChildLocks) $locks = $this->getData(); foreach ($locks as $lock) { - if ($lock->uri === $uri || - //deep locks on parents - (0 != $lock->depth && 0 === strpos($uri, $lock->uri.'/')) || + if ($lock->uri === $uri + // deep locks on parents + || (0 != $lock->depth && 0 === strpos($uri, $lock->uri.'/')) // locks on children - ($returnChildLocks && (0 === strpos($lock->uri, $uri.'/')))) { + || ($returnChildLocks && (0 === strpos($lock->uri, $uri.'/')))) { $newLocks[] = $lock; } } @@ -97,8 +97,8 @@ public function lock($uri, LockInfo $lockInfo) foreach ($locks as $k => $lock) { if ( - ($lock->token == $lockInfo->token) || - (time() > $lock->timeout + $lock->created) + ($lock->token == $lockInfo->token) + || (time() > $lock->timeout + $lock->created) ) { unset($locks[$k]); } diff --git a/lib/DAV/Locks/LockInfo.php b/lib/DAV/Locks/LockInfo.php index df82275665..2e9a4431b3 100644 --- a/lib/DAV/Locks/LockInfo.php +++ b/lib/DAV/Locks/LockInfo.php @@ -19,17 +19,17 @@ class LockInfo /** * A shared lock. */ - const SHARED = 1; + public const SHARED = 1; /** * An exclusive lock. */ - const EXCLUSIVE = 2; + public const EXCLUSIVE = 2; /** * A never expiring timeout. */ - const TIMEOUT_INFINITE = -1; + public const TIMEOUT_INFINITE = -1; /** * The owner of the lock. @@ -75,8 +75,6 @@ class LockInfo * The uri this lock locks. * * TODO: This value is not always set - * - * @var mixed */ public $uri; } diff --git a/lib/DAV/Locks/Plugin.php b/lib/DAV/Locks/Plugin.php index 2443f204c3..9a43a38a9e 100644 --- a/lib/DAV/Locks/Plugin.php +++ b/lib/DAV/Locks/Plugin.php @@ -353,7 +353,7 @@ public function getTimeoutHeader() if ($header) { if (0 === stripos($header, 'second-')) { - $header = (int) (substr($header, 7)); + $header = (int) substr($header, 7); } elseif (0 === stripos($header, 'infinite')) { $header = LockInfo::TIMEOUT_INFINITE; } else { @@ -387,8 +387,6 @@ protected function generateLockResponse(LockInfo $lockInfo) * In addition, it will also ensure that it checks any missing lokens that * must be present in the request, and reject requests without the proper * tokens. - * - * @param mixed $conditions */ public function validateTokens(RequestInterface $request, &$conditions) { @@ -432,7 +430,7 @@ public function validateTokens(RequestInterface $request, &$conditions) )); break; case 'LOCK': - //Temporary measure.. figure out later why this is needed + // Temporary measure.. figure out later why this is needed // Here we basically ignore all incoming tokens... foreach ($conditions as $ii => $condition) { foreach ($condition['tokens'] as $jj => $token) { diff --git a/lib/DAV/PartialUpdate/Plugin.php b/lib/DAV/PartialUpdate/Plugin.php index d6f4d32bd1..d7d6a6a60c 100644 --- a/lib/DAV/PartialUpdate/Plugin.php +++ b/lib/DAV/PartialUpdate/Plugin.php @@ -24,9 +24,9 @@ */ class Plugin extends DAV\ServerPlugin { - const RANGE_APPEND = 1; - const RANGE_START = 2; - const RANGE_END = 3; + public const RANGE_APPEND = 1; + public const RANGE_START = 2; + public const RANGE_END = 3; /** * Reference to server. diff --git a/lib/DAV/PropFind.php b/lib/DAV/PropFind.php index e9ffb07cbc..bbab0decf4 100644 --- a/lib/DAV/PropFind.php +++ b/lib/DAV/PropFind.php @@ -15,7 +15,7 @@ class PropFind /** * A normal propfind. */ - const NORMAL = 0; + public const NORMAL = 0; /** * An allprops request. @@ -26,13 +26,13 @@ class PropFind * * So 'all properties' now means a hardcoded list. */ - const ALLPROPS = 1; + public const ALLPROPS = 1; /** * A propname request. This just returns a list of properties that are * defined on a node, without their values. */ - const PROPNAME = 2; + public const PROPNAME = 2; /** * Creates the PROPFIND object. @@ -86,7 +86,6 @@ public function __construct($path, array $properties, $depth = 0, $requestType = * It's also possible to not pass a callback, but immediately pass a value * * @param string $propertyName - * @param mixed $valueOrCallBack */ public function handle($propertyName, $valueOrCallBack) { @@ -110,7 +109,6 @@ public function handle($propertyName, $valueOrCallBack) * properties, and 404 for null properties. * * @param string $propertyName - * @param mixed $value * @param int $status */ public function set($propertyName, $value, $status = null) @@ -139,8 +137,6 @@ public function set($propertyName, $value, $status = null) * Returns the current value for a property. * * @param string $propertyName - * - * @return mixed */ public function get($propertyName) { diff --git a/lib/DAV/PropPatch.php b/lib/DAV/PropPatch.php index 092909dea8..a2d7c8c929 100644 --- a/lib/DAV/PropPatch.php +++ b/lib/DAV/PropPatch.php @@ -4,8 +4,6 @@ namespace Sabre\DAV; -use UnexpectedValueException; - /** * This class represents a set of properties that are going to be updated. * @@ -267,7 +265,7 @@ private function doCallBackSingleProp($propertyName, callable $callback) } } if (!is_int($result)) { - throw new UnexpectedValueException('A callback sent to handle() did not return an int or a bool'); + throw new \UnexpectedValueException('A callback sent to handle() did not return an int or a bool'); } $this->result[$propertyName] = $result; if ($result >= 400) { @@ -311,7 +309,7 @@ private function doCallBackMultiProp(array $propertyList, callable $callback) $this->result[$propertyName] = 403; } } else { - throw new UnexpectedValueException('A callback sent to handle() did not return an array or a bool'); + throw new \UnexpectedValueException('A callback sent to handle() did not return an array or a bool'); } } diff --git a/lib/DAV/PropertyStorage/Backend/PDO.php b/lib/DAV/PropertyStorage/Backend/PDO.php index 8960331926..15546ddb63 100644 --- a/lib/DAV/PropertyStorage/Backend/PDO.php +++ b/lib/DAV/PropertyStorage/Backend/PDO.php @@ -25,17 +25,17 @@ class PDO implements BackendInterface /** * Value is stored as string. */ - const VT_STRING = 1; + public const VT_STRING = 1; /** * Value is stored as XML fragment. */ - const VT_XML = 2; + public const VT_XML = 2; /** * Value is stored as a property object. */ - const VT_OBJECT = 3; + public const VT_OBJECT = 3; /** * PDO. diff --git a/lib/DAV/Server.php b/lib/DAV/Server.php index 1a97951ecd..7edf8bb57e 100644 --- a/lib/DAV/Server.php +++ b/lib/DAV/Server.php @@ -31,12 +31,12 @@ class Server implements LoggerAwareInterface, EmitterInterface /** * Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree. */ - const DEPTH_INFINITY = -1; + public const DEPTH_INFINITY = -1; /** * XML namespace for all SabreDAV related elements. */ - const NS_SABREDAV = 'http://sabredav.org/ns'; + public const NS_SABREDAV = 'http://sabredav.org/ns'; /** * The tree object. @@ -50,7 +50,7 @@ class Server implements LoggerAwareInterface, EmitterInterface * * @var string */ - protected $baseUri = null; + protected $baseUri; /** * httpResponse. @@ -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; @@ -552,9 +552,9 @@ public function getRequestUri() * * @param string $uri * - * @throws Exception\Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri - * * @return string + * + * @throws Exception\Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri */ public function calculateUri($uri) { @@ -583,8 +583,6 @@ public function calculateUri($uri) * This method returns the contents of the HTTP depth request header. If the depth header was 'infinity' it will return the Sabre\DAV\Server::DEPTH_INFINITY object * It is possible to supply a default depth value, which is used when the depth header has invalid content, or is completely non-existent * - * @param mixed $default - * * @return int */ public function getHTTPDepth($default = self::DEPTH_INFINITY) @@ -706,6 +704,8 @@ public function getHTTPPrefer() * * destination - Destination path * * destinationExists - Whether or not the destination is an existing url (and should therefore be overwritten) * + * @return array + * * @throws Exception\BadRequest upon missing or broken request headers * @throws Exception\UnsupportedMediaType when trying to copy into a * non-collection @@ -715,8 +715,6 @@ public function getHTTPPrefer() * identical * @throws Exception\Conflict when trying to copy a node into its own * subtree - * - * @return array */ public function getCopyAndMoveInfo(RequestInterface $request) { @@ -878,11 +876,9 @@ public function getHTTPHeaders($path) /** * Small helper to support PROPFIND with DEPTH_INFINITY. * - * @param array $yieldFirst - * * @return \Traversable */ - private function generatePathNodes(PropFind $propFind, array $yieldFirst = null) + private function generatePathNodes(PropFind $propFind, ?array $yieldFirst = null) { if (null !== $yieldFirst) { yield $yieldFirst; @@ -1651,9 +1647,6 @@ public function generateMultiStatus($fileProperties, $strip404s = false) return $w->outputMemory(); } - /** - * @param $fileProperties - */ private function writeMultiStatus(Writer $w, $fileProperties, bool $strip404s) { $w->contextUri = $this->baseUri; diff --git a/lib/DAV/Sharing/Plugin.php b/lib/DAV/Sharing/Plugin.php index d766ae0de9..b76b8fb6a6 100644 --- a/lib/DAV/Sharing/Plugin.php +++ b/lib/DAV/Sharing/Plugin.php @@ -28,16 +28,16 @@ */ class Plugin extends ServerPlugin { - const ACCESS_NOTSHARED = 0; - const ACCESS_SHAREDOWNER = 1; - const ACCESS_READ = 2; - const ACCESS_READWRITE = 3; - const ACCESS_NOACCESS = 4; - - const INVITE_NORESPONSE = 1; - const INVITE_ACCEPTED = 2; - const INVITE_DECLINED = 3; - const INVITE_INVALID = 4; + public const ACCESS_NOTSHARED = 0; + public const ACCESS_SHAREDOWNER = 1; + public const ACCESS_READ = 2; + public const ACCESS_READWRITE = 3; + public const ACCESS_NOACCESS = 4; + + public const INVITE_NORESPONSE = 1; + public const INVITE_ACCEPTED = 2; + public const INVITE_DECLINED = 3; + public const INVITE_INVALID = 4; /** * Reference to SabreDAV server object. diff --git a/lib/DAV/SimpleCollection.php b/lib/DAV/SimpleCollection.php index 3cd14d9ba8..81f5ae8776 100644 --- a/lib/DAV/SimpleCollection.php +++ b/lib/DAV/SimpleCollection.php @@ -4,8 +4,6 @@ namespace Sabre\DAV; -use InvalidArgumentException; - /** * SimpleCollection. * @@ -50,7 +48,7 @@ public function __construct($name, array $children = []) } elseif (is_array($child)) { $child = new self($key, $child); } elseif (!$child instanceof INode) { - throw new InvalidArgumentException('Children must be specified as strings, arrays or instances of Sabre\DAV\INode'); + throw new \InvalidArgumentException('Children must be specified as strings, arrays or instances of Sabre\DAV\INode'); } $this->addChild($child); } @@ -85,9 +83,9 @@ public function getName() * * @param string $name * - * @throws Exception\NotFound - * * @return INode + * + * @throws Exception\NotFound */ public function getChild($name) { diff --git a/lib/DAV/SimpleFile.php b/lib/DAV/SimpleFile.php index ca808b6720..74de8be885 100644 --- a/lib/DAV/SimpleFile.php +++ b/lib/DAV/SimpleFile.php @@ -71,8 +71,6 @@ public function getName() * Returns the data. * * This method may either return a string or a readable stream resource - * - * @return mixed */ public function get() { diff --git a/lib/DAV/Sync/Plugin.php b/lib/DAV/Sync/Plugin.php index 8609f759e5..3592eb36d8 100644 --- a/lib/DAV/Sync/Plugin.php +++ b/lib/DAV/Sync/Plugin.php @@ -29,7 +29,7 @@ class Plugin extends DAV\ServerPlugin */ protected $server; - const SYNCTOKEN_PREFIX = 'http://sabre.io/ns/sync/'; + public const SYNCTOKEN_PREFIX = 'http://sabre.io/ns/sync/'; /** * Returns a plugin name. @@ -218,8 +218,8 @@ public function validateTokens(RequestInterface $request, &$conditions) $node = $this->server->tree->getNodeForPath($condition['uri']); if ( - $node instanceof ISyncCollection && - $node->getSyncToken() == substr($token['token'], strlen(self::SYNCTOKEN_PREFIX)) + $node instanceof ISyncCollection + && $node->getSyncToken() == substr($token['token'], strlen(self::SYNCTOKEN_PREFIX)) ) { $conditions[$kk]['tokens'][$ii]['validToken'] = true; } diff --git a/lib/DAV/TemporaryFileFilterPlugin.php b/lib/DAV/TemporaryFileFilterPlugin.php index 9f8ec5b54e..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; @@ -216,7 +216,7 @@ public function httpPut(RequestInterface $request, ResponseInterface $hR, $tempL $newFile = !file_exists($tempLocation); - if (!$newFile && ($this->server->httpRequest->getHeader('If-None-Match'))) { + if (!$newFile && $this->server->httpRequest->getHeader('If-None-Match')) { throw new Exception\PreconditionFailed('The resource already exists, and an If-None-Match header was supplied'); } diff --git a/lib/DAV/UUIDUtil.php b/lib/DAV/UUIDUtil.php index 8c36e1b0b8..62b5046210 100644 --- a/lib/DAV/UUIDUtil.php +++ b/lib/DAV/UUIDUtil.php @@ -30,22 +30,22 @@ public static function getUUID() { return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" - mt_rand(0, 0xffff), mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), mt_rand(0, 0xFFFF), // 16 bits for "time_mid" - mt_rand(0, 0xffff), + mt_rand(0, 0xFFFF), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 - mt_rand(0, 0x0fff) | 0x4000, + mt_rand(0, 0x0FFF) | 0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 - mt_rand(0, 0x3fff) | 0x8000, + mt_rand(0, 0x3FFF) | 0x8000, // 48 bits for "node" - mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) + mt_rand(0, 0xFFFF), mt_rand(0, 0xFFFF), mt_rand(0, 0xFFFF) ); } diff --git a/lib/DAV/Xml/Element/Prop.php b/lib/DAV/Xml/Element/Prop.php index 9c214792f1..f922ee770e 100644 --- a/lib/DAV/Xml/Element/Prop.php +++ b/lib/DAV/Xml/Element/Prop.php @@ -38,8 +38,6 @@ class Prop implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Element/Response.php b/lib/DAV/Xml/Element/Response.php index 86f2d33882..5e19c0609a 100644 --- a/lib/DAV/Xml/Element/Response.php +++ b/lib/DAV/Xml/Element/Response.php @@ -177,8 +177,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Element/Sharee.php b/lib/DAV/Xml/Element/Sharee.php index 79d6aa90db..cbbf74ace5 100644 --- a/lib/DAV/Xml/Element/Sharee.php +++ b/lib/DAV/Xml/Element/Sharee.php @@ -152,8 +152,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Property/Complex.php b/lib/DAV/Xml/Property/Complex.php index 9db5ad6790..8ecb5fe8bf 100644 --- a/lib/DAV/Xml/Property/Complex.php +++ b/lib/DAV/Xml/Property/Complex.php @@ -36,8 +36,6 @@ class Complex extends XmlFragment * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Property/GetLastModified.php b/lib/DAV/Xml/Property/GetLastModified.php index 0a1b7f800e..1142ab7131 100644 --- a/lib/DAV/Xml/Property/GetLastModified.php +++ b/lib/DAV/Xml/Property/GetLastModified.php @@ -4,8 +4,6 @@ namespace Sabre\DAV\Xml\Property; -use DateTime; -use DateTimeZone; use Sabre\HTTP; use Sabre\Xml\Element; use Sabre\Xml\Reader; @@ -26,31 +24,31 @@ class GetLastModified implements Element /** * time. * - * @var DateTime + * @var \DateTime */ public $time; /** * Constructor. * - * @param int|DateTime $time + * @param int|\DateTime $time */ public function __construct($time) { - if ($time instanceof DateTime) { + if ($time instanceof \DateTime) { $this->time = clone $time; } else { - $this->time = new DateTime('@'.$time); + $this->time = new \DateTime('@'.$time); } // Setting timezone to UTC - $this->time->setTimezone(new DateTimeZone('UTC')); + $this->time->setTimezone(new \DateTimeZone('UTC')); } /** * getTime. * - * @return DateTime + * @return \DateTime */ public function getTime() { @@ -93,11 +91,9 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { - return new self(new DateTime($reader->parseInnerTree())); + return new self(new \DateTime($reader->parseInnerTree())); } } diff --git a/lib/DAV/Xml/Property/Href.php b/lib/DAV/Xml/Property/Href.php index f736be6c21..06377ce52c 100644 --- a/lib/DAV/Xml/Property/Href.php +++ b/lib/DAV/Xml/Property/Href.php @@ -146,8 +146,6 @@ public function toHtml(HtmlOutputHelper $html) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Property/LockDiscovery.php b/lib/DAV/Xml/Property/LockDiscovery.php index 7fdc8ef591..44fde50788 100644 --- a/lib/DAV/Xml/Property/LockDiscovery.php +++ b/lib/DAV/Xml/Property/LockDiscovery.php @@ -86,8 +86,8 @@ public function xmlSerialize(Writer $writer): void $writer->writeElement('{DAV:}href', $writer->contextUri.$lock->uri); $writer->endElement(); // {DAV:}lockroot } - $writer->writeElement('{DAV:}depth', (DAV\Server::DEPTH_INFINITY == $lock->depth ? 'infinity' : $lock->depth)); - $writer->writeElement('{DAV:}timeout', (LockInfo::TIMEOUT_INFINITE === $lock->timeout ? 'Infinite' : 'Second-'.$lock->timeout)); + $writer->writeElement('{DAV:}depth', DAV\Server::DEPTH_INFINITY == $lock->depth ? 'infinity' : $lock->depth); + $writer->writeElement('{DAV:}timeout', LockInfo::TIMEOUT_INFINITE === $lock->timeout ? 'Infinite' : 'Second-'.$lock->timeout); // optional according to https://tools.ietf.org/html/rfc4918#section-6.5 if (null !== $lock->token && '' !== $lock->token) { diff --git a/lib/DAV/Xml/Property/ResourceType.php b/lib/DAV/Xml/Property/ResourceType.php index 75ddcba3fe..85f98aef3d 100644 --- a/lib/DAV/Xml/Property/ResourceType.php +++ b/lib/DAV/Xml/Property/ResourceType.php @@ -89,8 +89,6 @@ public function add($type) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Property/ShareAccess.php b/lib/DAV/Xml/Property/ShareAccess.php index 878e3eeca3..d59bb938ab 100644 --- a/lib/DAV/Xml/Property/ShareAccess.php +++ b/lib/DAV/Xml/Property/ShareAccess.php @@ -110,8 +110,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Property/SupportedReportSet.php b/lib/DAV/Xml/Property/SupportedReportSet.php index 35e1614423..4f5d02ec60 100644 --- a/lib/DAV/Xml/Property/SupportedReportSet.php +++ b/lib/DAV/Xml/Property/SupportedReportSet.php @@ -54,8 +54,6 @@ public function __construct($reports = null) * * The report must be a string in clark-notation. * Multiple reports can be specified as an array. - * - * @param mixed $report */ public function addReport($report) { diff --git a/lib/DAV/Xml/Request/Lock.php b/lib/DAV/Xml/Request/Lock.php index 57d12ef93e..fcc973c72f 100644 --- a/lib/DAV/Xml/Request/Lock.php +++ b/lib/DAV/Xml/Request/Lock.php @@ -55,8 +55,6 @@ class Lock implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Request/MkCol.php b/lib/DAV/Xml/Request/MkCol.php index e0d7e90a26..c4d84941c4 100644 --- a/lib/DAV/Xml/Request/MkCol.php +++ b/lib/DAV/Xml/Request/MkCol.php @@ -55,8 +55,6 @@ public function getProperties() * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Request/PropFind.php b/lib/DAV/Xml/Request/PropFind.php index 505e7c79ce..7dbf05b869 100644 --- a/lib/DAV/Xml/Request/PropFind.php +++ b/lib/DAV/Xml/Request/PropFind.php @@ -52,8 +52,6 @@ class PropFind implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Request/PropPatch.php b/lib/DAV/Xml/Request/PropPatch.php index c1ed0d3afe..39dfc9e3e4 100644 --- a/lib/DAV/Xml/Request/PropPatch.php +++ b/lib/DAV/Xml/Request/PropPatch.php @@ -78,8 +78,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Request/ShareResource.php b/lib/DAV/Xml/Request/ShareResource.php index 79d7dc8264..56d943c6d1 100644 --- a/lib/DAV/Xml/Request/ShareResource.php +++ b/lib/DAV/Xml/Request/ShareResource.php @@ -55,8 +55,6 @@ public function __construct(array $sharees) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAV/Xml/Request/SyncCollectionReport.php b/lib/DAV/Xml/Request/SyncCollectionReport.php index 8dd95765b6..de1085afe8 100644 --- a/lib/DAV/Xml/Request/SyncCollectionReport.php +++ b/lib/DAV/Xml/Request/SyncCollectionReport.php @@ -67,8 +67,6 @@ class SyncCollectionReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { @@ -84,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/DAV/Xml/Response/MultiStatus.php b/lib/DAV/Xml/Response/MultiStatus.php index 8f9d45c80f..981b33f2e6 100644 --- a/lib/DAV/Xml/Response/MultiStatus.php +++ b/lib/DAV/Xml/Response/MultiStatus.php @@ -108,8 +108,6 @@ public function xmlSerialize(Writer $writer): void * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/AbstractPrincipalCollection.php b/lib/DAVACL/AbstractPrincipalCollection.php index d26f7d27b4..3d73bd49b4 100644 --- a/lib/DAVACL/AbstractPrincipalCollection.php +++ b/lib/DAVACL/AbstractPrincipalCollection.php @@ -105,9 +105,9 @@ public function getChildren() * * @param string $name * - * @throws DAV\Exception\NotFound - * * @return DAV\INode + * + * @throws DAV\Exception\NotFound */ public function getChild($name) { diff --git a/lib/DAVACL/FS/Collection.php b/lib/DAVACL/FS/Collection.php index 85b04e2bdf..3ecdad7983 100644 --- a/lib/DAVACL/FS/Collection.php +++ b/lib/DAVACL/FS/Collection.php @@ -57,9 +57,9 @@ public function __construct($path, array $acl, $owner = null) * * @param string $name * - * @throws NotFound - * * @return \Sabre\DAV\INode + * + * @throws NotFound */ public function getChild($name) { diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php index f0497844d6..685c74af80 100644 --- a/lib/DAVACL/Plugin.php +++ b/lib/DAVACL/Plugin.php @@ -37,21 +37,21 @@ class Plugin extends DAV\ServerPlugin * * This only checks the base node */ - const R_PARENT = 1; + public const R_PARENT = 1; /** * Recursion constants. * * This checks every node in the tree */ - const R_RECURSIVE = 2; + public const R_RECURSIVE = 2; /** * Recursion constants. * * This checks every parentnode in the tree, but not leaf-nodes. */ - const R_RECURSIVEPARENTS = 3; + public const R_RECURSIVEPARENTS = 3; /** * Reference to server object. @@ -185,10 +185,10 @@ public function getSupportedReportSet($uri) * @param int $recursion * @param bool $throwExceptions if set to false, this method won't throw exceptions * + * @return bool + * * @throws NeedPrivileges * @throws NotAuthenticated - * - * @return bool */ public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) { @@ -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 */ @@ -618,7 +618,7 @@ public function getCurrentUserPrivilegeSet($node) } break; - // 'all' matches for every user + // 'all' matches for every user case '{DAV:}all': $collected[] = $ace; break; @@ -917,6 +917,7 @@ public function beforeUnbind($uri) * Triggered before a node is unlocked. * * @param string $uri + * * @TODO: not yet implemented */ public function beforeUnlock($uri, DAV\Locks\LockInfo $lock) @@ -928,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(); @@ -1066,8 +1067,6 @@ public function propPatch($path, DAV\PropPatch $propPatch) * This method handles HTTP REPORT requests. * * @param string $reportName - * @param mixed $report - * @param mixed $path */ public function report($reportName, $report, $path) { @@ -1111,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); @@ -1141,9 +1140,9 @@ public function httpAcl(RequestInterface $request, ResponseInterface $response) $found = false; foreach ($newAcl as $newAce) { if ( - $newAce['privilege'] === $oldAce['privilege'] && - $newAce['principal'] === $oldAce['principal'] && - $newAce['protected'] + $newAce['privilege'] === $oldAce['privilege'] + && $newAce['principal'] === $oldAce['principal'] + && $newAce['protected'] ) { $found = true; } @@ -1333,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; } @@ -1372,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(); @@ -1503,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/lib/DAVACL/PrincipalBackend/PDO.php b/lib/DAVACL/PrincipalBackend/PDO.php index 178bd7276f..214dbb8282 100644 --- a/lib/DAVACL/PrincipalBackend/PDO.php +++ b/lib/DAVACL/PrincipalBackend/PDO.php @@ -237,7 +237,7 @@ public function searchPrincipals($prefixPath, array $searchProperties, $test = ' { if (0 == count($searchProperties)) { return []; - } //No criteria + } // No criteria $query = 'SELECT uri FROM '.$this->tableName.' WHERE '; $values = []; @@ -320,7 +320,7 @@ public function findByUri($uri, $principalPrefix) } $uri = $row['uri']; - break; //Stop on first match + break; // Stop on first match } } else { $pathParts = Uri\split($uriParts['path']); // We can do this since $uriParts['path'] is not null diff --git a/lib/DAVACL/Xml/Property/Acl.php b/lib/DAVACL/Xml/Property/Acl.php index 086d123037..92240cb8f2 100644 --- a/lib/DAVACL/Xml/Property/Acl.php +++ b/lib/DAVACL/Xml/Property/Acl.php @@ -155,8 +155,6 @@ public function toHtml(HtmlOutputHelper $html) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php index 4a7ad25b48..8611a26c58 100644 --- a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php +++ b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php @@ -104,8 +104,6 @@ public function getValue() * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Property/Principal.php b/lib/DAVACL/Xml/Property/Principal.php index 2a8af573b2..8fa085d8e7 100644 --- a/lib/DAVACL/Xml/Property/Principal.php +++ b/lib/DAVACL/Xml/Property/Principal.php @@ -25,22 +25,22 @@ class Principal extends DAV\Xml\Property\Href /** * To specify a not-logged-in user, use the UNAUTHENTICATED principal. */ - const UNAUTHENTICATED = 1; + public const UNAUTHENTICATED = 1; /** * To specify any principal that is logged in, use AUTHENTICATED. */ - const AUTHENTICATED = 2; + public const AUTHENTICATED = 2; /** * Specific principals can be specified with the HREF. */ - const HREF = 3; + public const HREF = 3; /** * Everybody, basically. */ - const ALL = 4; + public const ALL = 4; /** * Principal-type. @@ -163,8 +163,6 @@ public function toHtml(HtmlOutputHelper $html) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Request/AclPrincipalPropSetReport.php b/lib/DAVACL/Xml/Request/AclPrincipalPropSetReport.php index 4fc61273af..99a7e2bd49 100644 --- a/lib/DAVACL/Xml/Request/AclPrincipalPropSetReport.php +++ b/lib/DAVACL/Xml/Request/AclPrincipalPropSetReport.php @@ -40,8 +40,6 @@ class AclPrincipalPropSetReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Request/ExpandPropertyReport.php b/lib/DAVACL/Xml/Request/ExpandPropertyReport.php index 70a7e22000..9534b27af9 100644 --- a/lib/DAVACL/Xml/Request/ExpandPropertyReport.php +++ b/lib/DAVACL/Xml/Request/ExpandPropertyReport.php @@ -51,8 +51,6 @@ class ExpandPropertyReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Request/PrincipalMatchReport.php b/lib/DAVACL/Xml/Request/PrincipalMatchReport.php index b49582450d..97e5bef321 100644 --- a/lib/DAVACL/Xml/Request/PrincipalMatchReport.php +++ b/lib/DAVACL/Xml/Request/PrincipalMatchReport.php @@ -25,12 +25,12 @@ class PrincipalMatchReport implements XmlDeserializable /** * Report on a list of principals that match the current principal. */ - const SELF = 1; + public const SELF = 1; /** * Report on a property on resources, such as {DAV:}owner, that match the current principal. */ - const PRINCIPAL_PROPERTY = 2; + public const PRINCIPAL_PROPERTY = 2; /** * Must be SELF or PRINCIPAL_PROPERTY. @@ -71,8 +71,6 @@ class PrincipalMatchReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php b/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php index bddceca8da..f52cc83de0 100644 --- a/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php +++ b/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php @@ -72,8 +72,6 @@ class PrincipalPropertySearchReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/lib/DAVACL/Xml/Request/PrincipalSearchPropertySetReport.php b/lib/DAVACL/Xml/Request/PrincipalSearchPropertySetReport.php index 7f15d8a4e7..a039cbd0dc 100644 --- a/lib/DAVACL/Xml/Request/PrincipalSearchPropertySetReport.php +++ b/lib/DAVACL/Xml/Request/PrincipalSearchPropertySetReport.php @@ -39,8 +39,6 @@ class PrincipalSearchPropertySetReport implements XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader) { diff --git a/tests/Sabre/AbstractDAVServerTestCase.php b/tests/Sabre/AbstractDAVServerTestCase.php index 40dcb41dfa..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; @@ -116,7 +116,7 @@ abstract class AbstractDAVServerTestCase extends TestCase * If this string is set, we will automatically log in the user with this * name. */ - protected $autoLogin = null; + protected $autoLogin; public function setup(): void { @@ -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 3019dc01d9..03f4be41c4 100644 --- a/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php +++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php @@ -4,7 +4,6 @@ namespace Sabre\CalDAV\Backend; -use DateTime; use PHPUnit\Framework\TestCase; use Sabre\CalDAV; use Sabre\DAV; @@ -87,7 +86,7 @@ public function testUpdateCalendarAndFetch() { $backend = new PDO($this->pdo); - //Creating a new calendar + // Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ @@ -133,7 +132,7 @@ public function testUpdateCalendarBadId() $this->expectException('InvalidArgumentException'); $backend = new PDO($this->pdo); - //Creating a new calendar + // Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ @@ -152,7 +151,7 @@ public function testUpdateCalendarUnknownProperty() { $backend = new PDO($this->pdo); - //Creating a new calendar + // Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ @@ -211,7 +210,7 @@ public function testCreateCalendarIncorrectComponentSet() $this->expectException('Sabre\DAV\Exception'); $backend = new PDO($this->pdo); - //Creating a new calendar + // Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', [ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 'blabla', ]); @@ -769,8 +768,8 @@ public function testCalendarQueryTimeRange() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new DateTime('20120103'), - 'end' => new DateTime('20120104'), + 'start' => new \DateTime('20120103'), + 'end' => new \DateTime('20120104'), ], ], ], @@ -800,7 +799,7 @@ public function testCalendarQueryTimeRangeEndNull() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new DateTime('20120102'), + 'start' => new \DateTime('20120102'), 'end' => null, ], ], @@ -831,7 +830,7 @@ public function testCalendarQueryTimeRangeNoEnd() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new DateTime('20120102'), + 'start' => new \DateTime('20120102'), ], ], ], @@ -861,7 +860,7 @@ public function testCalendarQueryTimeRangeNoStart() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'end' => new DateTime('20120102'), + 'end' => new \DateTime('20120102'), ], ], ], @@ -1000,7 +999,7 @@ public function testCreateSubscriptions() '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, + // '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, ]; @@ -1041,7 +1040,7 @@ public function testUpdateSubscriptions() '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, + // '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, ]; @@ -1053,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(); @@ -1083,14 +1082,14 @@ public function testUpdateSubscriptionsFail() '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, + // '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, ]; $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', @@ -1114,7 +1113,7 @@ public function testDeleteSubscriptions() '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, + // '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, ]; diff --git a/tests/Sabre/CalDAV/Backend/Mock.php b/tests/Sabre/CalDAV/Backend/Mock.php index e20769f232..d46407a223 100644 --- a/tests/Sabre/CalDAV/Backend/Mock.php +++ b/tests/Sabre/CalDAV/Backend/Mock.php @@ -93,8 +93,6 @@ public function createCalendar($principalUri, $calendarUri, array $properties) * promise I can handle updating this property". * * Read the PropPatch documentation for more info and examples. - * - * @param mixed $calendarId */ public function updateCalendar($calendarId, PropPatch $propPatch) { @@ -181,7 +179,6 @@ public function getCalendarObjects($calendarId) * * This method must return null if the object did not exist. * - * @param mixed $calendarId * @param string $objectUri * * @return array|null diff --git a/tests/Sabre/CalDAV/Backend/MockScheduling.php b/tests/Sabre/CalDAV/Backend/MockScheduling.php index 40901c5cab..79d67cfe03 100644 --- a/tests/Sabre/CalDAV/Backend/MockScheduling.php +++ b/tests/Sabre/CalDAV/Backend/MockScheduling.php @@ -71,9 +71,8 @@ public function deleteSchedulingObject($principalUri, $objectUri) /** * Creates a new scheduling object. This should land in a users' inbox. * - * @param string $principalUri - * @param string $objectUri - * @param string|resource $objectData; + * @param string $principalUri + * @param string $objectUri */ public function createSchedulingObject($principalUri, $objectUri, $objectData) { diff --git a/tests/Sabre/CalDAV/Backend/MockSharing.php b/tests/Sabre/CalDAV/Backend/MockSharing.php index 32d8f10a83..d0aa933524 100644 --- a/tests/Sabre/CalDAV/Backend/MockSharing.php +++ b/tests/Sabre/CalDAV/Backend/MockSharing.php @@ -92,7 +92,6 @@ public function deleteNotification($principalUri, NotificationInterface $notific /** * Updates the list of shares. * - * @param mixed $calendarId * @param \Sabre\DAV\Xml\Element\Sharee[] $sharees */ public function updateInvites($calendarId, array $sharees) @@ -140,8 +139,6 @@ public function updateInvites($calendarId, array $sharees) * and optionally: * $properties * - * @param mixed $calendarId - * * @return \Sabre\DAV\Xml\Element\Sharee[] */ public function getInvites($calendarId) @@ -173,8 +170,7 @@ public function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = /** * Publishes a calendar. * - * @param mixed $calendarId - * @param bool $value + * @param bool $value */ public function setPublishStatus($calendarId, $value) { diff --git a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php index 803cfbf007..88dadfcd5a 100644 --- a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php +++ b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php @@ -71,8 +71,6 @@ public function getSubscriptionsForUser($principalUri) * * @param string $principalUri * @param string $uri - * - * @return mixed */ public function createSubscription($principalUri, $uri, array $properties) { @@ -106,9 +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 mixed $subscriptionId - * @param \Sabre\DAV\PropPatch $propPatch */ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) { @@ -135,8 +130,6 @@ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) /** * Deletes a subscription. - * - * @param mixed $subscriptionId */ public function deleteSubscription($subscriptionId) { diff --git a/tests/Sabre/CalDAV/Backend/SimplePDOTest.php b/tests/Sabre/CalDAV/Backend/SimplePDOTest.php index cb1bd8efec..5f6d238981 100644 --- a/tests/Sabre/CalDAV/Backend/SimplePDOTest.php +++ b/tests/Sabre/CalDAV/Backend/SimplePDOTest.php @@ -90,7 +90,7 @@ public function testUpdateCalendarAndFetch() { $backend = new SimplePDO($this->pdo); - //Creating a new calendar + // Creating a new calendar $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); $propPatch = new PropPatch([ diff --git a/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php b/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php index edd9495adf..ce161761c2 100644 --- a/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php +++ b/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php @@ -25,6 +25,7 @@ public function testTopLevelFail() * @param string $icalObject * @param array $filters * @param int $outcome + * * @dataProvider provider */ public function testValid($icalObject, $filters, $outcome) @@ -508,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 @@ -523,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 = [ @@ -533,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 = [ @@ -556,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 = [ @@ -572,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 @@ -586,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, @@ -607,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'; @@ -641,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, @@ -814,7 +815,7 @@ public function provider() [$blob32, $filter20, 0], // Bug reported on mailing list, related to all-day events (87) - //array($blob33, $filter38, 1), + // array($blob33, $filter38, 1), // Event in timerange, but filtered alarm is in the far future (88). [$blob34, $filter39, 0], 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 127ad42c5d..cfe2358d9e 100644 --- a/tests/Sabre/CalDAV/PluginTest.php +++ b/tests/Sabre/CalDAV/PluginTest.php @@ -4,8 +4,6 @@ namespace Sabre\CalDAV; -use DateTime; -use DateTimeZone; use Sabre\DAV; use Sabre\DAVACL; use Sabre\HTTP; @@ -91,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 @@ -516,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', @@ -612,8 +610,8 @@ public function testCalendarMultiGetReportExpand() $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); $expectedIcal = $expectedIcal->expand( - new DateTime('2011-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2011-12-31 23:59:59', new DateTimeZone('UTC')) + new \DateTime('2011-01-01 00:00:00', new \DateTimeZone('UTC')), + new \DateTime('2011-12-31 23:59:59', new \DateTimeZone('UTC')) ); $expectedIcal = str_replace("\r\n", " \n", $expectedIcal->serialize()); @@ -670,8 +668,8 @@ public function testCalendarQueryReport() $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) + new \DateTime('2000-01-01 00:00:00', new \DateTimeZone('UTC')), + new \DateTime('2010-12-31 23:59:59', new \DateTimeZone('UTC')) ); $expectedIcal = str_replace("\r\n", " \n", $expectedIcal->serialize()); @@ -732,8 +730,8 @@ public function testCalendarQueryReportWindowsPhone() $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) + new \DateTime('2000-01-01 00:00:00', new \DateTimeZone('UTC')), + new \DateTime('2010-12-31 23:59:59', new \DateTimeZone('UTC')) ); $expectedIcal = str_replace("\r\n", " \n", $expectedIcal->serialize()); @@ -893,8 +891,8 @@ public function testCalendarQueryReport1Object() $expectedIcal = TestUtil::getTestCalendarData(); $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) + new \DateTime('2000-01-01 00:00:00', new \DateTimeZone('UTC')), + new \DateTime('2010-12-31 23:59:59', new \DateTimeZone('UTC')) ); $expectedIcal = str_replace("\r\n", " \n", $expectedIcal->serialize()); diff --git a/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php b/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php index 10d6153739..1bc2332c74 100644 --- a/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php +++ b/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php @@ -55,7 +55,7 @@ public function testDelivery() END:VEVENT END:VCALENDAR ICS - ); + ); $messages = []; $this->server->on('schedule', function ($message) use (&$messages) { diff --git a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php index 8652339519..5b3ee09306 100644 --- a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php +++ b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php @@ -633,7 +633,7 @@ public function putPath($path, $data) $childNode->put($data); } else {*/ $parentNode->createFile($base, $data); - //} + // } } public function assertItemsInInbox($user, $count) 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 7a58656abd..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', @@ -87,7 +87,7 @@ public function testBeforeGetSharedCalendar() ]); self::assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{'.Plugin::NS_CALENDARSERVER.'}invite']); - //self::assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $props['{' . Plugin::NS_CALENDARSERVER . '}shared-url']); + // self::assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $props['{' . Plugin::NS_CALENDARSERVER . '}shared-url']); } public function testUpdateResourceType() @@ -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/TestUtil.php b/tests/Sabre/CalDAV/TestUtil.php index 5de11a31ae..1af6b63b26 100644 --- a/tests/Sabre/CalDAV/TestUtil.php +++ b/tests/Sabre/CalDAV/TestUtil.php @@ -86,7 +86,7 @@ public static function getTestCalendarData($type = 1) $calendarData .= "\nDTSTART;VALUE=DATETIME:20100223T060000\n"; break; - // No DTSTART, so intentionally broken + // No DTSTART, so intentionally broken case 'X': $calendarData .= "\n"; break; diff --git a/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php b/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php index 68a599313f..2bcd50724d 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/InviteReplyTest.php @@ -12,6 +12,7 @@ class InviteReplyTest extends \PHPUnit\Framework\TestCase /** * @param array $notification * @param string $expected + * * @dataProvider dataProvider */ public function testSerializers($notification, $expected) @@ -65,7 +66,7 @@ public function dataProvider() 'type' => DAV\Sharing\Plugin::INVITE_ACCEPTED, 'hostUrl' => 'calendar', ], -<< 20120101T000000Z @@ -93,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 5399de709f..190601d9dd 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php @@ -12,6 +12,7 @@ class InviteTest extends DAV\Xml\AbstractXmlTestCase /** * @param array $notification * @param string $expected + * * @dataProvider dataProvider */ public function testSerializers($notification, $expected) @@ -52,7 +53,7 @@ public function dataProvider() 'commonName' => 'John Doe', 'summary' => 'Awesome stuff!', ], -<< 20120101T000000Z @@ -90,7 +91,7 @@ public function dataProvider() 'firstName' => 'Foo', 'lastName' => 'Bar', ], -<< 20120101T000000Z diff --git a/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php b/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php index 21eb2358f0..7754e0d5a7 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php @@ -12,6 +12,7 @@ class SystemStatusTest extends \PHPUnit\Framework\TestCase * @param array $notification * @param string $expected1 * @param string $expected2 + * * @dataProvider dataProvider */ public function testSerializers($notification, $expected1, $expected2) diff --git a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php index 77d8851277..a2526c5f29 100644 --- a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php @@ -27,7 +27,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' diff --git a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php index 7fab3e6472..561c871938 100644 --- a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php @@ -31,7 +31,7 @@ public function testSerialize() ]); self::assertXmlStringEqualsXmlString( -' + ' foo@example.org ', $xml); diff --git a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php index 309b28291c..bd34d19e2e 100644 --- a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php @@ -65,7 +65,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' mailto:thedoctor@example.org diff --git a/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php b/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php index c2f76b8ae3..937972416e 100644 --- a/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php @@ -39,7 +39,7 @@ public function testSerializeOpaque() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' @@ -55,7 +55,7 @@ public function testSerializeTransparent() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php index 9f60c40dd8..8d9a4c3503 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php @@ -43,7 +43,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php index 51f558e178..6b40094742 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php @@ -26,7 +26,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php index a1f18342ec..c158b3f502 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php @@ -26,7 +26,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' i;ascii-casemap i;octet diff --git a/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php b/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php index 8172c906fe..d959f4fa31 100644 --- a/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php +++ b/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php @@ -4,8 +4,6 @@ namespace Sabre\CalDAV\Xml\Request; -use DateTimeImmutable; -use DateTimeZone; use Sabre\DAV\Xml\AbstractXmlTestCase; class CalendarQueryReportTest extends AbstractXmlTestCase @@ -114,8 +112,8 @@ public function testDeserializeComplex() '{urn:ietf:params:xml:ns:caldav}calendar-data', ]; $calendarQueryReport->expand = [ - 'start' => new DateTimeImmutable('2015-01-01 00:00:00', new DateTimeZone('UTC')), - 'end' => new DateTimeImmutable('2016-01-01 00:00:00', new DateTimeZone('UTC')), + 'start' => new \DateTimeImmutable('2015-01-01 00:00:00', new \DateTimeZone('UTC')), + 'end' => new \DateTimeImmutable('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ]; $calendarQueryReport->filters = [ 'name' => 'VCALENDAR', @@ -179,8 +177,8 @@ public function testDeserializeComplex() 'name' => 'X-PROP3', 'is-not-defined' => false, 'time-range' => [ - 'start' => new DateTimeImmutable('2015-01-01 00:00:00', new DateTimeZone('UTC')), - 'end' => new DateTimeImmutable('2016-01-01 00:00:00', new DateTimeZone('UTC')), + 'start' => new \DateTimeImmutable('2015-01-01 00:00:00', new \DateTimeZone('UTC')), + 'end' => new \DateTimeImmutable('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ], 'text-match' => null, 'param-filters' => [], @@ -198,8 +196,8 @@ public function testDeserializeComplex() ], ], 'time-range' => [ - 'start' => new DateTimeImmutable('2015-01-01 00:00:00', new DateTimeZone('UTC')), - 'end' => new DateTimeImmutable('2016-01-01 00:00:00', new DateTimeZone('UTC')), + 'start' => new \DateTimeImmutable('2015-01-01 00:00:00', new \DateTimeZone('UTC')), + 'end' => new \DateTimeImmutable('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ], ], ], 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 3e048ba46a..39aa4824f7 100644 --- a/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -18,7 +18,7 @@ public function testQuery() ); $request->setBody( -' + ' @@ -27,7 +27,7 @@ public function testQuery() ' - ); + ); $response = new HTTP\ResponseMock(); @@ -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, @@ -67,7 +67,7 @@ public function testQueryDepth0() ); $request->setBody( -' + ' @@ -76,7 +76,7 @@ public function testQueryDepth0() ' - ); + ); $response = new HTTP\ResponseMock(); @@ -98,7 +98,7 @@ public function testQueryDepth0() 200 => [ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', ], - ], + ], ], $result); } @@ -111,7 +111,7 @@ public function testQueryNoMatch() ); $request->setBody( -' + ' @@ -120,7 +120,7 @@ public function testQueryNoMatch() ' - ); + ); $response = new HTTP\ResponseMock(); @@ -149,7 +149,7 @@ public function testQueryLimit() ]); $request->setBody( -' + ' @@ -159,7 +159,7 @@ public function testQueryLimit() 1 ' - ); + ); $response = new HTTP\ResponseMock(); @@ -181,7 +181,7 @@ public function testQueryLimit() 200 => [ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', ], - ], + ], ], $result); } @@ -194,14 +194,14 @@ public function testJson() ); $request->setBody( -' + ' ' - ); + ); $response = new HTTP\ResponseMock(); @@ -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); } @@ -239,14 +239,14 @@ public function testVCard4() ); $request->setBody( -' + ' ' - ); + ); $response = new HTTP\ResponseMock(); @@ -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/CardDAV/Backend/Mock.php b/tests/Sabre/CardDAV/Backend/Mock.php index bef257cfe3..e156bc352f 100644 --- a/tests/Sabre/CardDAV/Backend/Mock.php +++ b/tests/Sabre/CardDAV/Backend/Mock.php @@ -123,8 +123,6 @@ public function deleteAddressBook($addressBookId) * calculating them. If they are specified, you can also omit carddata. * This may speed up certain requests, especially with large cards. * - * @param mixed $addressBookId - * * @return array */ public function getCards($addressBookId) @@ -157,7 +155,6 @@ public function getCards($addressBookId) * * If the card does not exist, you must return false. * - * @param mixed $addressBookId * @param string $cardUri * * @return array @@ -198,7 +195,6 @@ public function getCard($addressBookId, $cardUri) * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * @@ -234,7 +230,6 @@ public function createCard($addressBookId, $cardUri, $cardData) * * If you don't return an ETag, you can just return null. * - * @param mixed $addressBookId * @param string $cardUri * @param string $cardData * diff --git a/tests/Sabre/CardDAV/MultiGetTest.php b/tests/Sabre/CardDAV/MultiGetTest.php index 3557ddaeaa..c44b0513b7 100644 --- a/tests/Sabre/CardDAV/MultiGetTest.php +++ b/tests/Sabre/CardDAV/MultiGetTest.php @@ -17,7 +17,7 @@ public function testMultiGet() ]); $request->setBody( -' + ' @@ -25,7 +25,7 @@ public function testMultiGet() /addressbooks/user1/book1/card1 ' - ); + ); $response = new HTTP\ResponseMock(); @@ -60,7 +60,7 @@ public function testMultiGetVCard4() ]); $request->setBody( -' + ' @@ -68,7 +68,7 @@ public function testMultiGetVCard4() /addressbooks/user1/book1/card1 ' - ); + ); $response = new HTTP\ResponseMock(); diff --git a/tests/Sabre/CardDAV/PluginTest.php b/tests/Sabre/CardDAV/PluginTest.php index 6d7d01fcaf..46b6c61493 100644 --- a/tests/Sabre/CardDAV/PluginTest.php +++ b/tests/Sabre/CardDAV/PluginTest.php @@ -50,7 +50,7 @@ public function testDirectoryGateway() public function testReportPassThrough() { - self::assertNull($this->plugin->report('{DAV:}foo', new \DomDocument(), '')); + self::assertNull($this->plugin->report('{DAV:}foo', new \DOMDocument(), '')); } public function testHTMLActionsPanel() diff --git a/tests/Sabre/CardDAV/ValidateFilterTest.php b/tests/Sabre/CardDAV/ValidateFilterTest.php index b325d8459c..3d98397a19 100644 --- a/tests/Sabre/CardDAV/ValidateFilterTest.php +++ b/tests/Sabre/CardDAV/ValidateFilterTest.php @@ -12,6 +12,7 @@ class ValidateFilterTest extends AbstractPluginTestCase * @param string $test * @param bool $result * @param string|null $message + * * @dataProvider data */ public function testFilter($input, $filters, $test, $result, $message = '') diff --git a/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php b/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php index ed8c99ad0b..4c3cc1d10a 100644 --- a/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php +++ b/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php @@ -26,12 +26,12 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' '. -''. -''. -''. -' + ''. + ''. + ''. + ' ', $xml); } } diff --git a/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php b/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php index e4f58139d5..7c6a769ae9 100644 --- a/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php +++ b/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php @@ -26,12 +26,12 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $property]); self::assertXmlStringEqualsXmlString( -' + ' '. -'i;ascii-casemap'. -'i;octet'. -'i;unicode-casemap'. -' + 'i;ascii-casemap'. + 'i;octet'. + 'i;unicode-casemap'. + ' ', $xml); } } diff --git a/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php b/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php index d1d612329c..f5db245295 100644 --- a/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php +++ b/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php @@ -12,8 +12,6 @@ class AddressBookMultiGetReportTest extends AbstractXmlTestCase /** * @dataProvider providesAddressDataXml - * - * @param $xml */ public function testDeserialize($xml, $expectedProps, $expectedVersion = '3.0') { diff --git a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index 68193ce6d0..3d3ea1555d 100644 --- a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -24,7 +24,7 @@ public function testCollectionGet() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); @@ -33,8 +33,8 @@ 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/Browser/PluginTest.php b/tests/Sabre/DAV/Browser/PluginTest.php index 6efb00b081..2d4e787654 100644 --- a/tests/Sabre/DAV/Browser/PluginTest.php +++ b/tests/Sabre/DAV/Browser/PluginTest.php @@ -67,7 +67,7 @@ public function testCollectionGetIfNoneMatch() public function testCollectionGetRoot() { $request = new HTTP\Request('GET', '/'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(200, $this->response->status, 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); 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/DbTestHelperTrait.php b/tests/Sabre/DAV/DbTestHelperTrait.php index 6fee5e2f94..f0a0efd27c 100644 --- a/tests/Sabre/DAV/DbTestHelperTrait.php +++ b/tests/Sabre/DAV/DbTestHelperTrait.php @@ -5,7 +5,6 @@ namespace Sabre\DAV; use PDO; -use PDOException; use Sabre\TestUtil; class DbCache @@ -18,12 +17,12 @@ trait DbTestHelperTrait /** * Should be "mysql", "pgsql", "sqlite". */ - public $driver = null; + public $driver; /** * Returns a fully configured PDO object. * - * @return PDO + * @return \PDO */ public function getDb() { @@ -48,13 +47,13 @@ public function getDb() $dsn = getenv('SABRE_MYSQLDSN'); $user = getenv('SABRE_MYSQLUSER'); $pass = getenv('SABRE_MYSQLPASS'); - $pdo = new PDO($dsn, $user, $pass); + $pdo = new \PDO($dsn, $user, $pass); break; case 'sqlite': - $pdo = new PDO('sqlite:'.TestUtil::SABRE_TEMPDIR.'/testdb'); + $pdo = new \PDO('sqlite:'.TestUtil::SABRE_TEMPDIR.'/testdb'); break; case 'pgsql': - $pdo = new PDO(getenv('SABRE_PGSQLDSN')); + $pdo = new \PDO(getenv('SABRE_PGSQLDSN')); $version = $pdo->query('SELECT VERSION()')->fetchColumn(); preg_match('|([0-9\.]){5,}|', $version, $matches); $version = $matches[0]; @@ -69,8 +68,8 @@ public function getDb() $this->markTestSkipped($this->driver.' was not recognised'); } - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch (PDOException $e) { + $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + } catch (\PDOException $e) { $this->markTestSkipped($this->driver.' was not enabled or not correctly configured. Error message: '.$e->getMessage()); } @@ -82,7 +81,7 @@ public function getDb() /** * Alias for getDb. * - * @return PDO + * @return \PDO */ public function getPDO() { diff --git a/tests/Sabre/DAV/Exception/LockedTest.php b/tests/Sabre/DAV/Exception/LockedTest.php index acb33ced7a..7a747153b6 100644 --- a/tests/Sabre/DAV/Exception/LockedTest.php +++ b/tests/Sabre/DAV/Exception/LockedTest.php @@ -4,14 +4,13 @@ namespace Sabre\DAV\Exception; -use DOMDocument; use Sabre\DAV; class LockedTest extends \PHPUnit\Framework\TestCase { public function testSerialize() { - $dom = new DOMDocument('1.0'); + $dom = new \DOMDocument('1.0'); $dom->formatOutput = true; $root = $dom->createElement('d:root'); @@ -39,7 +38,7 @@ public function testSerialize() public function testSerializeAmpersand() { - $dom = new DOMDocument('1.0'); + $dom = new \DOMDocument('1.0'); $dom->formatOutput = true; $root = $dom->createElement('d:root'); diff --git a/tests/Sabre/DAV/Exception/TooManyMatchesTest.php b/tests/Sabre/DAV/Exception/TooManyMatchesTest.php index 8968a4b517..d6c0c5014f 100644 --- a/tests/Sabre/DAV/Exception/TooManyMatchesTest.php +++ b/tests/Sabre/DAV/Exception/TooManyMatchesTest.php @@ -4,14 +4,13 @@ namespace Sabre\DAV\Exception; -use DOMDocument; use Sabre\DAV; class TooManyMatchesTest extends \PHPUnit\Framework\TestCase { public function testSerialize() { - $dom = new DOMDocument('1.0'); + $dom = new \DOMDocument('1.0'); $dom->formatOutput = true; $root = $dom->createElement('d:root'); diff --git a/tests/Sabre/DAV/FSExt/ServerTest.php b/tests/Sabre/DAV/FSExt/ServerTest.php index 3f2277400e..e9b6dc3182 100644 --- a/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/tests/Sabre/DAV/FSExt/ServerTest.php @@ -28,9 +28,9 @@ 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() - ); + ); self::assertEquals('Test contents', $this->response->getBodyAsString()); } @@ -39,7 +39,7 @@ public function testHEAD() { $request = new HTTP\Request('HEAD', '/test.txt'); $filename = $this->tempDir.'/test.txt'; - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -48,9 +48,9 @@ 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() - ); + ); self::assertEquals(200, $this->response->status); self::assertEquals('', $this->response->getBodyAsString()); @@ -61,7 +61,7 @@ public function testPut() $request = new HTTP\Request('PUT', '/testput.txt'); $filename = $this->tempDir.'/testput.txt'; $request->setBody('Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -79,7 +79,7 @@ public function testPutAlreadyExists() { $request = new HTTP\Request('PUT', '/test.txt', ['If-None-Match' => '*']); $request->setBody('Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -94,7 +94,7 @@ public function testPutAlreadyExists() public function testMkcol() { $request = new HTTP\Request('MKCOL', '/testcol'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -111,7 +111,7 @@ public function testPutUpdate() { $request = new HTTP\Request('PUT', '/test.txt'); $request->setBody('Testing updated file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals('0', $this->response->getHeader('Content-Length')); @@ -124,7 +124,7 @@ public function testPutUpdate() public function testDelete() { $request = new HTTP\Request('DELETE', '/test.txt'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -143,7 +143,7 @@ public function testDeleteDirectory() file_put_contents($this->tempDir.'/testcol/test.txt', 'Hi! I\'m a file with a short lifespan'); $request = new HTTP\Request('DELETE', '/testcol'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -158,7 +158,7 @@ public function testDeleteDirectory() public function testOptions() { $request = new HTTP\Request('OPTIONS', '/'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -179,7 +179,7 @@ public function testMove() mkdir($this->tempDir.'/testcol'); $request = new HTTP\Request('MOVE', '/test.txt', ['Destination' => '/testcol/test2.txt']); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(201, $this->response->status); @@ -209,12 +209,12 @@ 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; $request = new HTTP\Request('MOVE', '/tree1', ['Destination' => '/tree2/tree1']); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(201, $this->response->status); @@ -235,7 +235,7 @@ public function testCopy() mkdir($this->tempDir.'/testcol'); $request = new HTTP\Request('COPY', '/test.txt', ['Destination' => '/testcol/test2.txt']); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(201, $this->response->status); 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/Backend/AbstractTestCase.php b/tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php index 73425e6b8f..2a6da0d710 100644 --- a/tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php @@ -10,8 +10,6 @@ abstract class AbstractTestCase extends TestCase { /** - * @abstract - * * @return AbstractBackend */ abstract public function getBackend(); diff --git a/tests/Sabre/DAV/Locks/Backend/Mock.php b/tests/Sabre/DAV/Locks/Backend/Mock.php index adc416bc26..5878dfdf29 100644 --- a/tests/Sabre/DAV/Locks/Backend/Mock.php +++ b/tests/Sabre/DAV/Locks/Backend/Mock.php @@ -38,12 +38,12 @@ public function getLocks($uri, $returnChildLocks) $locks = $this->getData(); foreach ($locks as $lock) { - if ($lock->uri === $uri || - //deep locks on parents - (0 != $lock->depth && 0 === strpos($uri, $lock->uri.'/')) || + if ($lock->uri === $uri + // deep locks on parents + || (0 != $lock->depth && 0 === strpos($uri, $lock->uri.'/')) // locks on children - ($returnChildLocks && (0 === strpos($lock->uri, $uri.'/')))) { + || ($returnChildLocks && (0 === strpos($lock->uri, $uri.'/')))) { $newLocks[] = $lock; } } @@ -76,8 +76,8 @@ public function lock($uri, LockInfo $lockInfo) foreach ($locks as $k => $lock) { if ( - ($lock->token == $lockInfo->token) || - (time() > $lock->timeout + $lock->created) + ($lock->token == $lockInfo->token) + || (time() > $lock->timeout + $lock->created) ) { unset($locks[$k]); } diff --git a/tests/Sabre/DAV/Locks/MSWordTest.php b/tests/Sabre/DAV/Locks/MSWordTest.php index 2fb9aeb2e7..1c83a7c02c 100644 --- a/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/tests/Sabre/DAV/Locks/MSWordTest.php @@ -36,7 +36,7 @@ public function testLockEtc() self::assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); $lockToken = $server->httpResponse->getHeader('Lock-Token'); - //sleep(10); + // sleep(10); $response2 = new HTTP\ResponseMock(); @@ -47,7 +47,7 @@ public function testLockEtc() self::assertEquals(201, $server->httpResponse->status); self::assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); - //sleep(10); + // sleep(10); $response3 = new HTTP\ResponseMock(); $server->httpRequest = $this->getPutRequest($lockToken); @@ -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 66f16abd81..bb5e08c28e 100644 --- a/tests/Sabre/DAV/Locks/PluginTest.php +++ b/tests/Sabre/DAV/Locks/PluginTest.php @@ -50,9 +50,9 @@ public function testLockNoBody() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() - ); + ); self::assertEquals(400, $this->response->status); } @@ -266,9 +266,9 @@ public function testUnlockNoToken() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() - ); + ); self::assertEquals(400, $this->response->status); } @@ -285,9 +285,9 @@ public function testUnlockBadToken() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() - ); + ); self::assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); } @@ -355,9 +355,9 @@ public function testUnlock() self::assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], - ], + ], $this->server->httpResponse->getHeaders() - ); + ); } /** @@ -392,9 +392,9 @@ 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 3ffb342ddd..659c850c0e 100644 --- a/tests/Sabre/DAV/Mock/Collection.php +++ b/tests/Sabre/DAV/Mock/Collection.php @@ -31,10 +31,9 @@ class Collection extends DAV\Collection /** * Creates the object. * - * @param string $name - * @param Collection $parent + * @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 d48ddaa922..728a609d6a 100644 --- a/tests/Sabre/DAV/Mock/File.php +++ b/tests/Sabre/DAV/Mock/File.php @@ -25,12 +25,11 @@ class File extends DAV\File /** * Creates the object. * - * @param string $name - * @param resource $contents - * @param Collection $parent - * @param int $lastModified + * @param string $name + * @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); @@ -100,8 +99,6 @@ public function put($data) * Returns the data. * * This method may either return a string or a readable stream resource - * - * @return mixed */ public function get() { diff --git a/tests/Sabre/DAV/Mock/PropertiesCollection.php b/tests/Sabre/DAV/Mock/PropertiesCollection.php index 42468f995d..5e1c06f731 100644 --- a/tests/Sabre/DAV/Mock/PropertiesCollection.php +++ b/tests/Sabre/DAV/Mock/PropertiesCollection.php @@ -53,7 +53,7 @@ public function propPatch(PropPatch $proppatch) return $r; case 'updatepropsobj': - return new \STDClass(); + return new \stdClass(); } }); } diff --git a/tests/Sabre/DAV/Mock/StreamingFile.php b/tests/Sabre/DAV/Mock/StreamingFile.php index 951327e334..ec23d81b0c 100644 --- a/tests/Sabre/DAV/Mock/StreamingFile.php +++ b/tests/Sabre/DAV/Mock/StreamingFile.php @@ -54,8 +54,6 @@ public function put($data) * Returns the data. * * This method may either return a string or a readable stream resource - * - * @return mixed */ public function get() { diff --git a/tests/Sabre/DAV/MockLogger.php b/tests/Sabre/DAV/MockLogger.php index 28e744f961..be728386fe 100644 --- a/tests/Sabre/DAV/MockLogger.php +++ b/tests/Sabre/DAV/MockLogger.php @@ -21,7 +21,6 @@ class MockLogger extends AbstractLogger /** * Logs with an arbitrary level. * - * @param mixed $level * @param string $message */ public function log($level, $message, array $context = []): void diff --git a/tests/Sabre/DAV/Mount/PluginTest.php b/tests/Sabre/DAV/Mount/PluginTest.php index e630d561f8..01a4dc504f 100644 --- a/tests/Sabre/DAV/Mount/PluginTest.php +++ b/tests/Sabre/DAV/Mount/PluginTest.php @@ -23,7 +23,7 @@ public function testPassThrough() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); @@ -39,7 +39,7 @@ public function testMountResponse() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(200, $this->response->status); diff --git a/tests/Sabre/DAV/ServerMKCOLTest.php b/tests/Sabre/DAV/ServerMKCOLTest.php index 9e9dfb88bc..505d2a5906 100644 --- a/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/tests/Sabre/DAV/ServerMKCOLTest.php @@ -17,7 +17,7 @@ public function testMkcol() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -42,7 +42,7 @@ public function testMKCOLUnknownBody() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('Hello'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -66,7 +66,7 @@ public function testMKCOLBrokenXML() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('Hello'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -90,7 +90,7 @@ public function testMKCOLUnknownXML() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -121,7 +121,7 @@ public function testMKCOLNoResourceType() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -152,7 +152,7 @@ public function testMKCOLIncorrectResourceType() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -183,7 +183,7 @@ public function testMKCOLSuccess() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -216,7 +216,7 @@ public function testMKCOLWhiteSpaceResourceType() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -240,7 +240,7 @@ public function testMKCOLNoParent() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -264,7 +264,7 @@ public function testMKCOLParentIsNoCollection() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -288,7 +288,7 @@ public function testMKCOLAlreadyExists() $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -320,7 +320,7 @@ public function testMKCOLAndProps() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); diff --git a/tests/Sabre/DAV/ServerPluginTest.php b/tests/Sabre/DAV/ServerPluginTest.php index 19d99b9953..7d5933ad3e 100644 --- a/tests/Sabre/DAV/ServerPluginTest.php +++ b/tests/Sabre/DAV/ServerPluginTest.php @@ -44,7 +44,7 @@ public function testOptions() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php index c60e3899ba..d87045bfa3 100644 --- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php +++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php @@ -52,13 +52,13 @@ 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() - ); + ); $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); $xml = simplexml_load_string($body); diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index 398f04f53c..bee8f5a55a 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -47,13 +47,13 @@ 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() - ); + ); $xml = $this->getSanitizedBodyAsXml(); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -76,13 +76,13 @@ 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() - ); + ); $xml = $this->getSanitizedBodyAsXml(); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -101,13 +101,13 @@ 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() - ); + ); $xml = $this->getSanitizedBodyAsXml(); $xml->registerXPathNamespace('d', 'urn:DAV'); diff --git a/tests/Sabre/DAV/ServerRangeTest.php b/tests/Sabre/DAV/ServerRangeTest.php index 17ca773844..7265803fb1 100644 --- a/tests/Sabre/DAV/ServerRangeTest.php +++ b/tests/Sabre/DAV/ServerRangeTest.php @@ -4,7 +4,6 @@ namespace Sabre\DAV; -use DateTime; use Sabre\HTTP; /** @@ -29,14 +28,14 @@ public function setup(): void $this->server->createFile('files/test.txt', 'Test contents'); $this->lastModified = HTTP\toDate( - new DateTime('@'.$this->server->tree->getNodeForPath('files/test.txt')->getLastModified()) + new \DateTime('@'.$this->server->tree->getNodeForPath('files/test.txt')->getLastModified()) ); $stream = popen('echo "Test contents"', 'r'); $streamingFile = new Mock\StreamingFile( - 'no-seeking.txt', - $stream - ); + 'no-seeking.txt', + $stream + ); $streamingFile->setSize(12); $this->server->tree->getNodeForPath('files')->addNode($streamingFile); } @@ -53,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()); @@ -75,7 +74,7 @@ public function testStartRange() 'Content-Range' => ['bytes 2-12/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -98,7 +97,7 @@ public function testEndRange() 'Content-Range' => ['bytes 5-12/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -141,7 +140,7 @@ public function testNonSeekableStream() 'Content-Range' => ['bytes 2-5/12'], // 'ETag' => ['"' . md5('Test contents') . '"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -166,7 +165,7 @@ public function testIfRangeEtag() 'Content-Range' => ['bytes 2-5/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -191,7 +190,7 @@ public function testIfRangeEtagIncorrect() 'Content-Length' => [13], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -217,7 +216,7 @@ public function testIfRangeModificationDate() 'Content-Range' => ['bytes 2-5/13'], 'ETag' => ['"'.md5('Test contents').'"'], 'Last-Modified' => [$this->lastModified], - ], + ], $response->getHeaders() ); @@ -242,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 9f741879d9..827861689c 100644 --- a/tests/Sabre/DAV/ServerSimpleTest.php +++ b/tests/Sabre/DAV/ServerSimpleTest.php @@ -71,7 +71,7 @@ public function testNonExistantMethod() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -93,7 +93,7 @@ public function testBaseUri() $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->setBaseUri('/blabla/'); self::assertEquals('/blabla/', $this->server->getBaseUri()); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals([ @@ -102,9 +102,9 @@ 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() - ); + ); self::assertEquals(200, $this->response->status); self::assertEquals('Test contents', stream_get_contents($this->response->body)); @@ -356,16 +356,16 @@ public function testReportNotFound() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->httpRequest->setBody(''); $this->server->exec(); self::assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], - ], + ], $this->response->getHeaders() - ); + ); self::assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } @@ -378,7 +378,7 @@ public function testReportIntercepted() ]; $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->httpRequest->setBody(''); $this->server->on('report', [$this, 'reportHandler']); $this->server->exec(); @@ -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/SimpleCollectionTest.php b/tests/Sabre/DAV/SimpleCollectionTest.php index ec321721b8..14f83a9dc6 100644 --- a/tests/Sabre/DAV/SimpleCollectionTest.php +++ b/tests/Sabre/DAV/SimpleCollectionTest.php @@ -29,7 +29,7 @@ public function testConstructNodeArray() public function testConstructBadParam() { $this->expectException('InvalidArgumentException'); - new SimpleCollection('foo', [new \StdClass()]); + new SimpleCollection('foo', [new \stdClass()]); } public function testGetChildren() diff --git a/tests/Sabre/DAV/Sync/MockSyncCollection.php b/tests/Sabre/DAV/Sync/MockSyncCollection.php index 9a37d4ac31..f26c1b0b4c 100644 --- a/tests/Sabre/DAV/Sync/MockSyncCollection.php +++ b/tests/Sabre/DAV/Sync/MockSyncCollection.php @@ -20,7 +20,7 @@ class MockSyncCollection extends DAV\SimpleCollection implements ISyncCollection { public $changeLog = []; - public $token = null; + public $token; /** * This method returns the current sync-token for this collection. @@ -105,7 +105,7 @@ public function getChanges($syncToken, $syncLevel, $limit = null) // This is an initial sync if (is_null($syncToken)) { return [ - 'added' => array_map( + 'added' => array_map( function ($item) { return $item->getName(); }, $this->getChildren() diff --git a/tests/Sabre/DAV/SyncTokenPropertyTest.php b/tests/Sabre/DAV/SyncTokenPropertyTest.php index 6603dbbf1d..cec7e6751b 100644 --- a/tests/Sabre/DAV/SyncTokenPropertyTest.php +++ b/tests/Sabre/DAV/SyncTokenPropertyTest.php @@ -12,7 +12,6 @@ class SyncTokenPropertyTest extends \Sabre\AbstractDAVServerTestCase * result. * * @param string $name - * @param mixed $value * * @dataProvider data */ @@ -35,7 +34,6 @@ public function testAlreadyThere1($name, $value) * fetch the items. * * @param string $name - * @param mixed $value * * @dataProvider data */ diff --git a/tests/Sabre/DAV/TemporaryFileFilterTest.php b/tests/Sabre/DAV/TemporaryFileFilterTest.php index 5082a0f73f..44e5be07e0 100644 --- a/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -19,7 +19,7 @@ public function testPutNormal() { $request = new HTTP\Request('PUT', '/testput.txt', [], 'Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); @@ -34,7 +34,7 @@ public function testPutTemp() // mimicking an OS/X resource fork $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); @@ -51,7 +51,7 @@ public function testPutTempIfNoneMatch() // mimicking an OS/X resource fork $request = new HTTP\Request('PUT', '/._testput.txt', ['If-None-Match' => '*'], 'Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); @@ -75,7 +75,7 @@ public function testPutGet() { // mimicking an OS/X resource fork $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals('', $this->response->getBodyAsString()); @@ -128,7 +128,7 @@ public function testLockNonExistant() '); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); self::assertEquals(201, $this->response->status); @@ -181,7 +181,7 @@ public function testPutPropfind() $request = new HTTP\Request('PROPFIND', '/._testput.txt'); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); $bodyAsString = $this->response->getBodyAsString(); diff --git a/tests/Sabre/DAV/Xml/Element/PropTest.php b/tests/Sabre/DAV/Xml/Element/PropTest.php index 939addedae..5bbf9a08cc 100644 --- a/tests/Sabre/DAV/Xml/Element/PropTest.php +++ b/tests/Sabre/DAV/Xml/Element/PropTest.php @@ -131,7 +131,7 @@ public function testDeserializeCustomBadObj() $expected = []; $elementMap = [ - '{DAV:}foo' => new \StdClass(), + '{DAV:}foo' => new \stdClass(), ]; self::assertDecodeProp($input, $expected, $elementMap); diff --git a/tests/Sabre/DAV/Xml/Element/ResponseTest.php b/tests/Sabre/DAV/Xml/Element/ResponseTest.php index 9863475ccd..bda578d317 100644 --- a/tests/Sabre/DAV/Xml/Element/ResponseTest.php +++ b/tests/Sabre/DAV/Xml/Element/ResponseTest.php @@ -44,7 +44,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri @@ -83,7 +83,7 @@ public function testSerializeEmptyNamespace() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertEquals( -' + ' /uri @@ -114,7 +114,7 @@ public function testSerializeCustomNamespace() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri @@ -143,7 +143,7 @@ public function testSerializeComplexProperty() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri @@ -166,7 +166,7 @@ public function testSerializeBreak() $this->expectException('InvalidArgumentException'); $innerProps = [ 200 => [ - '{DAV:}link' => new \STDClass(), + '{DAV:}link' => new \stdClass(), ], ]; @@ -222,7 +222,7 @@ public function testSerializeUrlencoding() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /space%20here @@ -255,7 +255,7 @@ public function testSerializeNoProperties() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri @@ -283,7 +283,7 @@ public function testSerializeNoPropertiesButStatus() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri @@ -312,7 +312,7 @@ public function testSerializePropertiesAndStatus() $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]); self::assertXmlStringEqualsXmlString( -' + ' /uri diff --git a/tests/Sabre/DAV/Xml/Property/HrefTest.php b/tests/Sabre/DAV/Xml/Property/HrefTest.php index dcc564b26b..0a7b6d296e 100644 --- a/tests/Sabre/DAV/Xml/Property/HrefTest.php +++ b/tests/Sabre/DAV/Xml/Property/HrefTest.php @@ -25,7 +25,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}anything' => $href]); self::assertXmlStringEqualsXmlString( -' + ' /bla/path ', $xml); } @@ -76,7 +76,7 @@ public function testSerializeEntity() $xml = $this->write(['{DAV:}anything' => $href]); self::assertXmlStringEqualsXmlString( -' + ' http://example.org/?a&b ', $xml); } diff --git a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php index ffce1366ce..6e65629265 100644 --- a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php +++ b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php @@ -4,15 +4,13 @@ namespace Sabre\DAV\Xml\Property; -use DateTime; -use DateTimeZone; use Sabre\DAV\Xml\AbstractXmlTestCase; class LastModifiedTest extends AbstractXmlTestCase { public function testSerializeDateTime() { - $dt = new DateTime('2015-03-24 11:47:00', new DateTimeZone('America/Vancouver')); + $dt = new \DateTime('2015-03-24 11:47:00', new \DateTimeZone('America/Vancouver')); $val = ['{DAV:}getlastmodified' => new GetLastModified($dt)]; $result = $this->write($val); @@ -26,7 +24,7 @@ public function testSerializeDateTime() public function testSerializeTimeStamp() { - $dt = new DateTime('2015-03-24 11:47:00', new DateTimeZone('America/Vancouver')); + $dt = new \DateTime('2015-03-24 11:47:00', new \DateTimeZone('America/Vancouver')); $dt = $dt->getTimeStamp(); $val = ['{DAV:}getlastmodified' => new GetLastModified($dt)]; @@ -50,7 +48,7 @@ public function testDeserialize() $result = $this->parse($input, $elementMap); self::assertEquals( - new DateTime('2015-03-24 18:47:00', new DateTimeZone('UTC')), + new \DateTime('2015-03-24 18:47:00', new \DateTimeZone('UTC')), $result['value']->getTime() ); } diff --git a/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php b/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php index a03da08e0d..2730f73cdb 100644 --- a/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php +++ b/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php @@ -25,7 +25,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}anything' => $href]); self::assertXmlStringEqualsXmlString( -' + ' /bla/path ', $xml); } @@ -40,7 +40,7 @@ public function testSerializeSpace() $xml = $this->write(['{DAV:}anything' => $href]); self::assertXmlStringEqualsXmlString( -' + ' /bla/path%20alsopath ', $xml); } diff --git a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php index a68877206b..1b039f720a 100644 --- a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php +++ b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php @@ -25,7 +25,7 @@ public function testSerialize() $xml = $this->write(['{DAV:}root' => $prop]); self::assertXmlStringEqualsXmlString( -' + ' @@ -62,7 +62,7 @@ public function testSerializeShared() $xml = $this->write(['{DAV:}root' => $prop]); self::assertXmlStringEqualsXmlString( -' + ' diff --git a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php index 113ab4e7d8..001a7a11ef 100644 --- a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php +++ b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php @@ -20,7 +20,7 @@ public function sendPROPFIND($body) $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody($body); - $this->server->httpRequest = ($request); + $this->server->httpRequest = $request; $this->server->exec(); } diff --git a/tests/Sabre/DAVACL/ACLMethodTest.php b/tests/Sabre/DAVACL/ACLMethodTest.php index 52bf4a86d1..41241da044 100644 --- a/tests/Sabre/DAVACL/ACLMethodTest.php +++ b/tests/Sabre/DAVACL/ACLMethodTest.php @@ -21,7 +21,7 @@ public function testCallback() } /** - /** + * /** */ public function testNotSupportedByNode() { diff --git a/tests/Sabre/DAVACL/PluginPropertiesTest.php b/tests/Sabre/DAVACL/PluginPropertiesTest.php index dca67974eb..67bfa52f17 100644 --- a/tests/Sabre/DAVACL/PluginPropertiesTest.php +++ b/tests/Sabre/DAVACL/PluginPropertiesTest.php @@ -19,7 +19,7 @@ public function testPrincipalCollectionSet() 'privilege' => '{DAV:}all', ], ]); - //Anyone can do anything + // Anyone can do anything $plugin->principalCollectionSet = [ 'principals1', 'principals2', @@ -237,8 +237,8 @@ public function testAlternateUriSet() ]; $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()) - //$fakeServer->addPlugin($plugin); + // $plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()) + // $fakeServer->addPlugin($plugin); $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ @@ -271,8 +271,8 @@ public function testPrincipalURL() ]; $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); - //$fakeServer->addPlugin($plugin); + // $plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); + // $fakeServer->addPlugin($plugin); $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ @@ -306,8 +306,8 @@ public function testGroupMemberSet() ]; $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); - //$fakeServer->addPlugin($plugin); + // $plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); + // $fakeServer->addPlugin($plugin); $plugin = new Plugin(); $plugin->allowUnauthenticatedAccess = false; $plugin->setDefaultACL([ diff --git a/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php index c6615ab67f..a184bf6286 100644 --- a/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php +++ b/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php @@ -84,7 +84,7 @@ public function testSetBadValue() $server->addPlugin($plugin); $result = $server->updateProperties('foo', [ - '{DAV:}group-member-set' => new \StdClass(), + '{DAV:}group-member-set' => new \stdClass(), ]); } 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; diff --git a/tests/Sabre/DAVACL/SimplePluginTest.php b/tests/Sabre/DAVACL/SimplePluginTest.php index bd0f58c94c..5ab1a932b1 100644 --- a/tests/Sabre/DAVACL/SimplePluginTest.php +++ b/tests/Sabre/DAVACL/SimplePluginTest.php @@ -145,7 +145,7 @@ public function testCurrentUserPrincipalsSimple() $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); $server->addPlugin($auth); - //forcing login + // forcing login $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); self::assertEquals(['principals/admin'], $acl->getCurrentUserPrincipals()); @@ -170,7 +170,7 @@ public function testCurrentUserPrincipalsGroups() $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); $server->addPlugin($auth); - //forcing login + // forcing login $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $expected = [ @@ -244,7 +244,7 @@ public function testGetCurrentUserPrivilegeSet() $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); $server->addPlugin($auth); - //forcing login + // forcing login $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); $expected = [ @@ -294,8 +294,8 @@ public function testCheckPrivileges() $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); $server->addPlugin($auth); - //forcing login - //$auth->beforeMethod('GET','/'); + // forcing login + // $auth->beforeMethod('GET','/'); self::assertFalse($aclPlugin->checkPrivileges('foo', ['{DAV:}read'], Plugin::R_PARENT, false)); } diff --git a/tests/Sabre/DAVACL/Xml/Property/PrincipalTest.php b/tests/Sabre/DAVACL/Xml/Property/PrincipalTest.php index e437204390..ec6a6640a2 100644 --- a/tests/Sabre/DAVACL/Xml/Property/PrincipalTest.php +++ b/tests/Sabre/DAVACL/Xml/Property/PrincipalTest.php @@ -134,6 +134,7 @@ public function parse($xml) /** * @depends testSimple + * * @dataProvider htmlProvider */ public function testToHtml($principal, $output)