diff --git a/.gitignore b/.gitignore index d0333502b..f26a5f6b3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ bin */*/psalm.baseline.xml */*/phpcs.xml */*/phpcs.xml.dist +*/*/.php-cs-fixer.dist.php */*/.phpcs.xml */*/phpstan.neon.dist */*/phpunit.xml diff --git a/.patches/custom-itip-broker.diff b/.patches/custom-itip-broker.diff deleted file mode 100644 index 13c835816..000000000 --- a/.patches/custom-itip-broker.diff +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php -index 5e56596101..5bca56d47e 100644 ---- a/lib/CalDAV/Schedule/Plugin.php -+++ b/lib/CalDAV/Schedule/Plugin.php -@@ -25,6 +25,7 @@ - use Sabre\VObject; - use Sabre\VObject\Component\VCalendar; - use Sabre\VObject\ITip; -+use Sabre\VObject\ITip\Broker; - use Sabre\VObject\ITip\Message; - use Sabre\VObject\Reader; - -@@ -389,7 +390,7 @@ public function beforeUnbind($path) - $node->getOwner() - ); - -- $broker = new ITip\Broker(); -+ $broker = $this->createITipBroker(); - $messages = $broker->parseEvent(null, $addresses, $node->get()); - - foreach ($messages as $message) { -@@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage) - $isNewNode = true; - } - -- $broker = new ITip\Broker(); -+ $broker = $this->createITipBroker(); - $newObject = $broker->processMessage($iTipMessage, $currentObject); - - $inbox->createFile($newFileName, $iTipMessage->message->serialize()); -@@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege - */ - protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false) - { -- $broker = new ITip\Broker(); -+ $broker = $this->createITipBroker(); - $messages = $broker->parseEvent($newObject, $addresses, $oldObject); - - if ($messages) { -@@ -994,4 +995,12 @@ public function getPluginInfo() - 'link' => 'http://sabre.io/dav/scheduling/', - ]; - } -+ -+ /** -+ * Returns an instance of the iTip\Broker. -+ */ -+ protected function createITipBroker(): Broker -+ { -+ return new Broker(); -+ } - } diff --git a/.patches/fix-cache-for-node.diff b/.patches/fix-cache-for-node.diff deleted file mode 100644 index 4f668c7f2..000000000 --- a/.patches/fix-cache-for-node.diff +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/lib/DAV/Tree.php b/lib/DAV/Tree.php -index 65b4583ceb..1483e1bc51 100644 ---- a/lib/DAV/Tree.php -+++ b/lib/DAV/Tree.php -@@ -62,9 +62,21 @@ public function getNodeForPath($path) - return $this->rootNode; - } - -- $parts = explode('/', $path); - $node = $this->rootNode; - -+ // look for any cached parent and collect the parts below the parent -+ $parts = []; -+ $remainingPath = $path; -+ do { -+ list($remainingPath, $baseName) = Uri\split($remainingPath); -+ array_unshift($parts, $baseName); -+ -+ if (isset($this->cache[$remainingPath])) { -+ $node = $this->cache[$remainingPath]; -+ break; -+ } -+ } while ('' !== $remainingPath); -+ - while (count($parts)) { - if (!($node instanceof ICollection)) { - throw new Exception\NotFound('Could not find node at path: '.$path); diff --git a/composer.json b/composer.json index 0723ad27c..1faef5337 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "psr/event-dispatcher": "^1.0", "psr/log": "^3.0.2", "punic/punic": "^3.8", - "sabre/dav": "^4.4.0", + "sabre/dav": "^4.7.0", "scssphp/scssphp": "^1.12", "stecman/symfony-console-completion": "^0.13.0", "symfony/console": "^6.4.12", diff --git a/composer.lock b/composer.lock index d4d65b0bc..ad58af6bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fc7c1a89458a97e883bb9b4226d98297", + "content-hash": "cfa4a972fc95abcad3e4b06472a54b7e", "packages": [ { "name": "aws/aws-crt-php", @@ -3480,16 +3480,16 @@ }, { "name": "sabre/dav", - "version": "4.6.0", + "version": "4.7.0", "source": { "type": "git", "url": "https://github.com/sabre-io/dav.git", - "reference": "554145304b4a026477d130928d16e626939b0b2a" + "reference": "074373bcd689a30bcf5aaa6bbb20a3395964ce7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/dav/zipball/554145304b4a026477d130928d16e626939b0b2a", - "reference": "554145304b4a026477d130928d16e626939b0b2a", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/074373bcd689a30bcf5aaa6bbb20a3395964ce7a", + "reference": "074373bcd689a30bcf5aaa6bbb20a3395964ce7a", "shasum": "" }, "require": { @@ -3559,29 +3559,29 @@ "issues": "https://github.com/sabre-io/dav/issues", "source": "https://github.com/fruux/sabre-dav" }, - "time": "2023-12-11T13:01:23+00:00" + "time": "2024-10-29T11:46:02+00:00" }, { "name": "sabre/event", - "version": "5.1.4", + "version": "5.1.7", "source": { "type": "git", "url": "https://github.com/sabre-io/event.git", - "reference": "d7da22897125d34d7eddf7977758191c06a74497" + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/event/zipball/d7da22897125d34d7eddf7977758191c06a74497", - "reference": "d7da22897125d34d7eddf7977758191c06a74497", + "url": "https://api.github.com/repos/sabre-io/event/zipball/86d57e305c272898ba3c28e9bd3d65d5464587c2", + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "type": "library", "autoload": { @@ -3625,20 +3625,20 @@ "issues": "https://github.com/sabre-io/event/issues", "source": "https://github.com/fruux/sabre-event" }, - "time": "2021-11-04T06:51:17+00:00" + "time": "2024-08-27T11:23:05+00:00" }, { "name": "sabre/http", - "version": "5.1.10", + "version": "5.1.12", "source": { "type": "git", "url": "https://github.com/sabre-io/http.git", - "reference": "f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02" + "reference": "dedff73f3995578bc942fa4c8484190cac14f139" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/http/zipball/f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02", - "reference": "f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02", + "url": "https://api.github.com/repos/sabre-io/http/zipball/dedff73f3995578bc942fa4c8484190cac14f139", + "reference": "dedff73f3995578bc942fa4c8484190cac14f139", "shasum": "" }, "require": { @@ -3650,9 +3650,9 @@ "sabre/uri": "^2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "suggest": { "ext-curl": " to make http requests with the Client class" @@ -3688,31 +3688,31 @@ "issues": "https://github.com/sabre-io/http/issues", "source": "https://github.com/fruux/sabre-http" }, - "time": "2023-08-18T01:55:28+00:00" + "time": "2024-08-27T16:07:41+00:00" }, { "name": "sabre/uri", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sabre-io/uri.git", - "reference": "7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b" + "reference": "b76524c22de90d80ca73143680a8e77b1266c291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b", - "reference": "7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/b76524c22de90d80ca73143680a8e77b1266c291", + "reference": "b76524c22de90d80ca73143680a8e77b1266c291", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.17", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-phpunit": "^1.3", - "phpstan/phpstan-strict-rules": "^1.5", + "friendsofphp/php-cs-fixer": "^3.63", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "^9.6" }, "type": "library", @@ -3748,20 +3748,20 @@ "issues": "https://github.com/sabre-io/uri/issues", "source": "https://github.com/fruux/sabre-uri" }, - "time": "2023-06-09T06:54:04+00:00" + "time": "2024-08-27T12:18:16+00:00" }, { "name": "sabre/vobject", - "version": "4.5.4", + "version": "4.5.6", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772" + "reference": "900266bb3bd448a9f7f41f82344ad0aba237cb27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", - "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/900266bb3bd448a9f7f41f82344ad0aba237cb27", + "reference": "900266bb3bd448a9f7f41f82344ad0aba237cb27", "shasum": "" }, "require": { @@ -3771,9 +3771,9 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^0.12 || ^1.11", "phpunit/php-invoker": "^2.0 || ^3.1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "suggest": { "hoa/bench": "If you would like to run the benchmark scripts" @@ -3852,20 +3852,20 @@ "issues": "https://github.com/sabre-io/vobject/issues", "source": "https://github.com/fruux/sabre-vobject" }, - "time": "2023-11-09T12:54:37+00:00" + "time": "2024-10-14T11:53:54+00:00" }, { "name": "sabre/xml", - "version": "2.2.7", + "version": "2.2.11", "source": { "type": "git", "url": "https://github.com/sabre-io/xml.git", - "reference": "f1d53d55976bbd4cf3e640dda6ebc31120c71a4e" + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/xml/zipball/f1d53d55976bbd4cf3e640dda6ebc31120c71a4e", - "reference": "f1d53d55976bbd4cf3e640dda6ebc31120c71a4e", + "url": "https://api.github.com/repos/sabre-io/xml/zipball/01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", "shasum": "" }, "require": { @@ -3877,9 +3877,9 @@ "sabre/uri": ">=1.0,<3.0.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||3.63.2", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "type": "library", "autoload": { @@ -3921,7 +3921,7 @@ "issues": "https://github.com/sabre-io/xml/issues", "source": "https://github.com/fruux/sabre-xml" }, - "time": "2024-04-18T10:15:43+00:00" + "time": "2024-09-06T07:37:46+00:00" }, { "name": "scssphp/scssphp", @@ -6356,13 +6356,13 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^8.1" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.1.0" }, diff --git a/composer.patches.json b/composer.patches.json index b86d16fd9..cbe5110f2 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -1,9 +1,5 @@ { "patches": { - "sabre/dav": { - "Allow for custom iTip broker": ".patches/custom-itip-broker.diff", - "Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" - }, "wapmorgan/mp3info": { "generate exception if codec/layer versions or channel headers are unrecognized": ".patches/mp3info-check-array-key.diff" } diff --git a/composer/installed.json b/composer/installed.json index 63c654785..894892982 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -3633,17 +3633,17 @@ }, { "name": "sabre/dav", - "version": "4.6.0", - "version_normalized": "4.6.0.0", + "version": "4.7.0", + "version_normalized": "4.7.0.0", "source": { "type": "git", "url": "https://github.com/sabre-io/dav.git", - "reference": "554145304b4a026477d130928d16e626939b0b2a" + "reference": "074373bcd689a30bcf5aaa6bbb20a3395964ce7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/dav/zipball/554145304b4a026477d130928d16e626939b0b2a", - "reference": "554145304b4a026477d130928d16e626939b0b2a", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/074373bcd689a30bcf5aaa6bbb20a3395964ce7a", + "reference": "074373bcd689a30bcf5aaa6bbb20a3395964ce7a", "shasum": "" }, "require": { @@ -3677,18 +3677,12 @@ "ext-imap": "*", "ext-pdo": "*" }, - "time": "2023-12-11T13:01:23+00:00", + "time": "2024-10-29T11:46:02+00:00", "bin": [ "bin/sabredav", "bin/naturalselection" ], "type": "library", - "extra": { - "patches_applied": { - "Allow for custom iTip broker": ".patches/custom-itip-broker.diff", - "Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" - } - }, "installation-source": "dist", "autoload": { "psr-4": { @@ -3725,28 +3719,28 @@ }, { "name": "sabre/event", - "version": "5.1.4", - "version_normalized": "5.1.4.0", + "version": "5.1.7", + "version_normalized": "5.1.7.0", "source": { "type": "git", "url": "https://github.com/sabre-io/event.git", - "reference": "d7da22897125d34d7eddf7977758191c06a74497" + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/event/zipball/d7da22897125d34d7eddf7977758191c06a74497", - "reference": "d7da22897125d34d7eddf7977758191c06a74497", + "url": "https://api.github.com/repos/sabre-io/event/zipball/86d57e305c272898ba3c28e9bd3d65d5464587c2", + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, - "time": "2021-11-04T06:51:17+00:00", + "time": "2024-08-27T11:23:05+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3794,17 +3788,17 @@ }, { "name": "sabre/http", - "version": "5.1.10", - "version_normalized": "5.1.10.0", + "version": "5.1.12", + "version_normalized": "5.1.12.0", "source": { "type": "git", "url": "https://github.com/sabre-io/http.git", - "reference": "f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02" + "reference": "dedff73f3995578bc942fa4c8484190cac14f139" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/http/zipball/f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02", - "reference": "f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02", + "url": "https://api.github.com/repos/sabre-io/http/zipball/dedff73f3995578bc942fa4c8484190cac14f139", + "reference": "dedff73f3995578bc942fa4c8484190cac14f139", "shasum": "" }, "require": { @@ -3816,14 +3810,14 @@ "sabre/uri": "^2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "suggest": { "ext-curl": " to make http requests with the Client class" }, - "time": "2023-08-18T01:55:28+00:00", + "time": "2024-08-27T16:07:41+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3860,31 +3854,31 @@ }, { "name": "sabre/uri", - "version": "2.3.3", - "version_normalized": "2.3.3.0", + "version": "2.3.4", + "version_normalized": "2.3.4.0", "source": { "type": "git", "url": "https://github.com/sabre-io/uri.git", - "reference": "7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b" + "reference": "b76524c22de90d80ca73143680a8e77b1266c291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b", - "reference": "7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/b76524c22de90d80ca73143680a8e77b1266c291", + "reference": "b76524c22de90d80ca73143680a8e77b1266c291", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.17", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-phpunit": "^1.3", - "phpstan/phpstan-strict-rules": "^1.5", + "friendsofphp/php-cs-fixer": "^3.63", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "^9.6" }, - "time": "2023-06-09T06:54:04+00:00", + "time": "2024-08-27T12:18:16+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3923,17 +3917,17 @@ }, { "name": "sabre/vobject", - "version": "4.5.4", - "version_normalized": "4.5.4.0", + "version": "4.5.6", + "version_normalized": "4.5.6.0", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772" + "reference": "900266bb3bd448a9f7f41f82344ad0aba237cb27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", - "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/900266bb3bd448a9f7f41f82344ad0aba237cb27", + "reference": "900266bb3bd448a9f7f41f82344ad0aba237cb27", "shasum": "" }, "require": { @@ -3943,14 +3937,14 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^0.12 || ^1.11", "phpunit/php-invoker": "^2.0 || ^3.1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, "suggest": { "hoa/bench": "If you would like to run the benchmark scripts" }, - "time": "2023-11-09T12:54:37+00:00", + "time": "2024-10-14T11:53:54+00:00", "bin": [ "bin/vobject", "bin/generate_vcards" @@ -4030,17 +4024,17 @@ }, { "name": "sabre/xml", - "version": "2.2.7", - "version_normalized": "2.2.7.0", + "version": "2.2.11", + "version_normalized": "2.2.11.0", "source": { "type": "git", "url": "https://github.com/sabre-io/xml.git", - "reference": "f1d53d55976bbd4cf3e640dda6ebc31120c71a4e" + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/xml/zipball/f1d53d55976bbd4cf3e640dda6ebc31120c71a4e", - "reference": "f1d53d55976bbd4cf3e640dda6ebc31120c71a4e", + "url": "https://api.github.com/repos/sabre-io/xml/zipball/01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", "shasum": "" }, "require": { @@ -4052,11 +4046,11 @@ "sabre/uri": ">=1.0,<3.0.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", + "friendsofphp/php-cs-fixer": "~2.17.1||3.63.2", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" }, - "time": "2024-04-18T10:15:43+00:00", + "time": "2024-09-06T07:37:46+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/composer/installed.php b/composer/installed.php index 3dc76fa5c..4ff737bbd 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -563,54 +563,54 @@ ), ), 'sabre/dav' => array( - 'pretty_version' => '4.6.0', - 'version' => '4.6.0.0', - 'reference' => '554145304b4a026477d130928d16e626939b0b2a', + 'pretty_version' => '4.7.0', + 'version' => '4.7.0.0', + 'reference' => '074373bcd689a30bcf5aaa6bbb20a3395964ce7a', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/dav', 'aliases' => array(), 'dev_requirement' => false, ), 'sabre/event' => array( - 'pretty_version' => '5.1.4', - 'version' => '5.1.4.0', - 'reference' => 'd7da22897125d34d7eddf7977758191c06a74497', + 'pretty_version' => '5.1.7', + 'version' => '5.1.7.0', + 'reference' => '86d57e305c272898ba3c28e9bd3d65d5464587c2', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/event', 'aliases' => array(), 'dev_requirement' => false, ), 'sabre/http' => array( - 'pretty_version' => '5.1.10', - 'version' => '5.1.10.0', - 'reference' => 'f9f3d1fba8916fa2f4ec25636c4fedc26cb94e02', + 'pretty_version' => '5.1.12', + 'version' => '5.1.12.0', + 'reference' => 'dedff73f3995578bc942fa4c8484190cac14f139', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/http', 'aliases' => array(), 'dev_requirement' => false, ), 'sabre/uri' => array( - 'pretty_version' => '2.3.3', - 'version' => '2.3.3.0', - 'reference' => '7e0e7dfd0b7e14346a27eabd66e843a6e7f1812b', + 'pretty_version' => '2.3.4', + 'version' => '2.3.4.0', + 'reference' => 'b76524c22de90d80ca73143680a8e77b1266c291', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/uri', 'aliases' => array(), 'dev_requirement' => false, ), 'sabre/vobject' => array( - 'pretty_version' => '4.5.4', - 'version' => '4.5.4.0', - 'reference' => 'a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772', + 'pretty_version' => '4.5.6', + 'version' => '4.5.6.0', + 'reference' => '900266bb3bd448a9f7f41f82344ad0aba237cb27', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/vobject', 'aliases' => array(), 'dev_requirement' => false, ), 'sabre/xml' => array( - 'pretty_version' => '2.2.7', - 'version' => '2.2.7.0', - 'reference' => 'f1d53d55976bbd4cf3e640dda6ebc31120c71a4e', + 'pretty_version' => '2.2.11', + 'version' => '2.2.11.0', + 'reference' => '01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc', 'type' => 'library', 'install_path' => __DIR__ . '/../sabre/xml', 'aliases' => array(), diff --git a/sabre/dav/PATCHES.txt b/sabre/dav/PATCHES.txt deleted file mode 100644 index 101f21ee6..000000000 --- a/sabre/dav/PATCHES.txt +++ /dev/null @@ -1,11 +0,0 @@ -This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) -Patches applied to this directory: - -Allow for custom iTip broker -Source: .patches/custom-itip-broker.diff - - -Fix getNodeForPath cache -Source: .patches/fix-cache-for-node.diff - - diff --git a/sabre/dav/lib/CalDAV/Backend/BackendInterface.php b/sabre/dav/lib/CalDAV/Backend/BackendInterface.php index 8bfa7446a..ccaa2519a 100644 --- a/sabre/dav/lib/CalDAV/Backend/BackendInterface.php +++ b/sabre/dav/lib/CalDAV/Backend/BackendInterface.php @@ -221,7 +221,7 @@ public function deleteCalendarObject($calendarId, $objectUri); * * This default may well be good enough for personal use, and calendars * that aren't very large. But if you anticipate high usage, big calendars - * or high loads, you are strongly adviced to optimize certain paths. + * or high loads, you are strongly advised to optimize certain paths. * * The best way to do so is override this method and to optimize * specifically for 'common filters'. diff --git a/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php b/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php index 6e48d5454..5c04ae44c 100644 --- a/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php +++ b/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php @@ -36,7 +36,7 @@ interface NotificationSupport extends BackendInterface public function getNotificationsForPrincipal($principalUri); /** - * This deletes a specific notifcation. + * This deletes a specific notification. * * This may be called by a client once it deems a notification handled. * diff --git a/sabre/dav/lib/CalDAV/Backend/PDO.php b/sabre/dav/lib/CalDAV/Backend/PDO.php index b9f112cf8..634b9828c 100644 --- a/sabre/dav/lib/CalDAV/Backend/PDO.php +++ b/sabre/dav/lib/CalDAV/Backend/PDO.php @@ -196,7 +196,7 @@ public function getCalendarsForUser($principalUri) //$stmt2 = $this->pdo->prepare('SELECT principaluri FROM ' . $this->calendarInstancesTableName . ' WHERE access = 1 AND id = ?'); //$stmt2->execute([$row['id']]); - // read-only is for backwards compatbility. Might go away in + // read-only is for backwards compatibility. Might go away in // the future. $calendar['read-only'] = \Sabre\DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access']; } @@ -730,7 +730,7 @@ public function deleteCalendarObject($calendarId, $objectUri) * * This default may well be good enough for personal use, and calendars * that aren't very large. But if you anticipate high usage, big calendars - * or high loads, you are strongly adviced to optimize certain paths. + * or high loads, you are strongly advised to optimize certain paths. * * The best way to do so is override this method and to optimize * specifically for 'common filters'. diff --git a/sabre/dav/lib/CalDAV/Calendar.php b/sabre/dav/lib/CalDAV/Calendar.php index 6c0bf5411..ba8c704a5 100644 --- a/sabre/dav/lib/CalDAV/Calendar.php +++ b/sabre/dav/lib/CalDAV/Calendar.php @@ -435,7 +435,7 @@ public function getSyncToken() * return null. * * The limit is 'suggestive'. You are free to ignore it. - * TODO: RFC6578 Setion 3.7 says that the server must fail when the server + * TODO: RFC6578 Section 3.7 says that the server must fail when the server * cannot truncate according to the limit, so it may not be just suggestive. * * @param string $syncToken diff --git a/sabre/dav/lib/CalDAV/Notifications/Node.php b/sabre/dav/lib/CalDAV/Notifications/Node.php index 7d3a3f46b..5bf9a6018 100644 --- a/sabre/dav/lib/CalDAV/Notifications/Node.php +++ b/sabre/dav/lib/CalDAV/Notifications/Node.php @@ -70,7 +70,7 @@ public function getName() /** * Returns the etag for the notification. * - * The etag must be surrounded by litteral double-quotes. + * The etag must be surrounded by literal double-quotes. * * @return string */ @@ -101,7 +101,7 @@ public function delete() /** * Returns the owner principal. * - * This must be a url to a principal, or null if there's no owner + * This must be an url to a principal, or null if there's no owner * * @return string|null */ diff --git a/sabre/dav/lib/CalDAV/Plugin.php b/sabre/dav/lib/CalDAV/Plugin.php index 98f4f554c..ccb722f85 100644 --- a/sabre/dav/lib/CalDAV/Plugin.php +++ b/sabre/dav/lib/CalDAV/Plugin.php @@ -720,7 +720,7 @@ public function beforeWriteContent($path, DAV\IFile $node, &$data, &$modified) return; } - // We're onyl interested in ICalendarObject nodes that are inside of a + // We're only interested in ICalendarObject nodes that are inside of a // real calendar. This is to avoid triggering validation and scheduling // for non-calendars (such as an inbox). list($parent) = Uri\split($path); @@ -913,7 +913,7 @@ protected function validateICalendar(&$data, $path, &$modified, RequestInterface } /** - * This method is triggered whenever a subsystem reqeuests the privileges + * This method is triggered whenever a subsystem requests the privileges * that are supported on a particular node. */ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet) diff --git a/sabre/dav/lib/CalDAV/SharingPlugin.php b/sabre/dav/lib/CalDAV/SharingPlugin.php index f7dca9be6..bacfe0441 100644 --- a/sabre/dav/lib/CalDAV/SharingPlugin.php +++ b/sabre/dav/lib/CalDAV/SharingPlugin.php @@ -136,7 +136,7 @@ public function propFindLate(DAV\PropFind $propFind, DAV\INode $node) } /** - * This method is trigged when a user attempts to update a node's + * This method is triggered when a user attempts to update a node's * properties. * * A previous draft of the sharing spec stated that it was possible to use diff --git a/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php b/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php index 3b3a94b26..4771a2070 100644 --- a/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php +++ b/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php @@ -48,7 +48,7 @@ class CalendarMultiGetReport implements XmlDeserializable public $expand = null; /** - * The mimetype of the content that should be returend. Usually + * The mimetype of the content that should be returned. Usually * text/calendar. * * @var string diff --git a/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php b/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php index b3cc299d3..5a4df4674 100644 --- a/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php +++ b/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php @@ -48,7 +48,7 @@ class CalendarQueryReport implements XmlDeserializable public $expand = null; /** - * The mimetype of the content that should be returend. Usually + * The mimetype of the content that should be returned. Usually * text/calendar. * * @var string diff --git a/sabre/dav/lib/CardDAV/Backend/BackendInterface.php b/sabre/dav/lib/CardDAV/Backend/BackendInterface.php index 6ef34d173..f9955ac83 100644 --- a/sabre/dav/lib/CardDAV/Backend/BackendInterface.php +++ b/sabre/dav/lib/CardDAV/Backend/BackendInterface.php @@ -88,7 +88,7 @@ public function deleteAddressBook($addressBookId); * * size - The size of the card in bytes. * * If these last two properties are provided, less time will be spent - * calculating them. If they are specified, you can also ommit carddata. + * calculating them. If they are specified, you can also omit carddata. * This may speed up certain requests, especially with large cards. * * @param mixed $addressbookId @@ -98,7 +98,7 @@ public function deleteAddressBook($addressBookId); public function getCards($addressbookId); /** - * Returns a specfic card. + * Returns a specific card. * * The same set of properties must be returned as with getCards. The only * exception is that 'carddata' is absolutely required. diff --git a/sabre/dav/lib/CardDAV/Backend/PDO.php b/sabre/dav/lib/CardDAV/Backend/PDO.php index 4ca9284a9..7b935a4ae 100644 --- a/sabre/dav/lib/CardDAV/Backend/PDO.php +++ b/sabre/dav/lib/CardDAV/Backend/PDO.php @@ -205,7 +205,7 @@ public function deleteAddressBook($addressBookId) * * size - The size of the card in bytes. * * If these last two properties are provided, less time will be spent - * calculating them. If they are specified, you can also ommit carddata. + * calculating them. If they are specified, you can also omit carddata. * This may speed up certain requests, especially with large cards. * * @param mixed $addressbookId diff --git a/sabre/dav/lib/CardDAV/Plugin.php b/sabre/dav/lib/CardDAV/Plugin.php index c2d31d9df..810ae3a1a 100644 --- a/sabre/dav/lib/CardDAV/Plugin.php +++ b/sabre/dav/lib/CardDAV/Plugin.php @@ -800,7 +800,7 @@ protected function negotiateVCard($input, &$mimeType = null) * * @return string */ - protected function convertVCard($data, $target, array $propertiesFilter = null) + protected function convertVCard($data, $target, ?array $propertiesFilter = null) { if (is_resource($data)) { $data = stream_get_contents($data); diff --git a/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php b/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php index fe5f976a0..536c5a19f 100644 --- a/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/sabre/dav/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 = [ diff --git a/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php index e1096fe28..02402f6c7 100644 --- a/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php +++ b/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php @@ -82,7 +82,7 @@ class AddressBookQueryReport implements XmlDeserializable public $test; /** - * The mimetype of the content that should be returend. Usually + * The mimetype of the content that should be returned. Usually * text/vcard. * * @var string diff --git a/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php b/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php index 39324e4db..d142cbfbf 100644 --- a/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php +++ b/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php @@ -44,7 +44,7 @@ class PDOBasicAuth extends AbstractBasic * Digest prefix: * if the backend you are using for is prefixing * your password hashes set this option to your prefix to - * cut it off before verfiying. + * cut it off before verifying. * * @var string */ diff --git a/sabre/dav/lib/DAV/Auth/Plugin.php b/sabre/dav/lib/DAV/Auth/Plugin.php index eb4f27ca6..47fbe205a 100644 --- a/sabre/dav/lib/DAV/Auth/Plugin.php +++ b/sabre/dav/lib/DAV/Auth/Plugin.php @@ -58,7 +58,7 @@ class Plugin extends ServerPlugin * * @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); diff --git a/sabre/dav/lib/DAV/Browser/Plugin.php b/sabre/dav/lib/DAV/Browser/Plugin.php index 89495e5db..a8a6f430e 100644 --- a/sabre/dav/lib/DAV/Browser/Plugin.php +++ b/sabre/dav/lib/DAV/Browser/Plugin.php @@ -522,7 +522,7 @@ public function htmlActionsPanel(DAV\INode $node, &$output, $path) /** * This method takes a path/name of an asset and turns it into url - * suiteable for http access. + * suitable for http access. * * @param string $assetName * diff --git a/sabre/dav/lib/DAV/Exception/InvalidSyncToken.php b/sabre/dav/lib/DAV/Exception/InvalidSyncToken.php index 37b28ca54..f28d20f41 100644 --- a/sabre/dav/lib/DAV/Exception/InvalidSyncToken.php +++ b/sabre/dav/lib/DAV/Exception/InvalidSyncToken.php @@ -9,7 +9,7 @@ /** * InvalidSyncToken. * - * This exception is emited for the {DAV:}valid-sync-token pre-condition, as + * This exception is emitted for the {DAV:}valid-sync-token pre-condition, as * defined in rfc6578, section 3.2. * * http://tools.ietf.org/html/rfc6578#section-3.2 diff --git a/sabre/dav/lib/DAV/Exception/Locked.php b/sabre/dav/lib/DAV/Exception/Locked.php index 28263cf13..24fad7095 100644 --- a/sabre/dav/lib/DAV/Exception/Locked.php +++ b/sabre/dav/lib/DAV/Exception/Locked.php @@ -32,7 +32,7 @@ class Locked extends DAV\Exception * * @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/sabre/dav/lib/DAV/Exception/TooManyMatches.php b/sabre/dav/lib/DAV/Exception/TooManyMatches.php index 3f7d2d5fb..ef6f50243 100644 --- a/sabre/dav/lib/DAV/Exception/TooManyMatches.php +++ b/sabre/dav/lib/DAV/Exception/TooManyMatches.php @@ -9,7 +9,7 @@ /** * TooManyMatches. * - * This exception is emited for the {DAV:}number-of-matches-within-limits + * This exception is emitted for the {DAV:}number-of-matches-within-limits * post-condition, as defined in rfc6578, section 3.2. * * http://tools.ietf.org/html/rfc6578#section-3.2 diff --git a/sabre/dav/lib/DAV/INodeByPath.php b/sabre/dav/lib/DAV/INodeByPath.php index 4d63a33bd..349ea1053 100644 --- a/sabre/dav/lib/DAV/INodeByPath.php +++ b/sabre/dav/lib/DAV/INodeByPath.php @@ -9,7 +9,7 @@ * * This interface adds a tiny bit of functionality to collections. * - * Getting a node that is deep in the tree normally requires going trough each parent node + * Getting a node that is deep in the tree normally requires going through each parent node * which can cause a significant performance overhead. * * Implementing this interface allows solving this overhead by directly jumping to the target node. diff --git a/sabre/dav/lib/DAV/Server.php b/sabre/dav/lib/DAV/Server.php index 1f8300d4a..3133e54ad 100644 --- a/sabre/dav/lib/DAV/Server.php +++ b/sabre/dav/lib/DAV/Server.php @@ -211,7 +211,7 @@ class Server implements LoggerAwareInterface, EmitterInterface * * @throws Exception */ - public function __construct($treeOrNode = null, HTTP\Sapi $sapi = null) + public function __construct($treeOrNode = null, ?HTTP\Sapi $sapi = null) { if ($treeOrNode instanceof Tree) { $this->tree = $treeOrNode; @@ -882,7 +882,7 @@ public function getHTTPHeaders($path) * * @return \Traversable */ - private function generatePathNodes(PropFind $propFind, array $yieldFirst = null) + private function generatePathNodes(PropFind $propFind, ?array $yieldFirst = null) { if (null !== $yieldFirst) { yield $yieldFirst; @@ -1635,6 +1635,8 @@ public function getResourceTypeForNode(INode $node) */ public function generateMultiStatus($fileProperties, $strip404s = false) { + $this->emit('beforeMultiStatus', [&$fileProperties]); + $w = $this->xml->getWriter(); if (self::$streamMultiStatus) { return function () use ($fileProperties, $strip404s, $w) { diff --git a/sabre/dav/lib/DAV/Sharing/Plugin.php b/sabre/dav/lib/DAV/Sharing/Plugin.php index e7adbeee6..d766ae0de 100644 --- a/sabre/dav/lib/DAV/Sharing/Plugin.php +++ b/sabre/dav/lib/DAV/Sharing/Plugin.php @@ -194,7 +194,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response) } /** - * This method is triggered whenever a subsystem reqeuests the privileges + * This method is triggered whenever a subsystem requests the privileges * hat are supported on a particular node. * * We need to add a number of privileges for scheduling purposes. diff --git a/sabre/dav/lib/DAV/Version.php b/sabre/dav/lib/DAV/Version.php index 345c62d7e..e6aee097c 100644 --- a/sabre/dav/lib/DAV/Version.php +++ b/sabre/dav/lib/DAV/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - public const VERSION = '4.6.0'; + public const VERSION = '4.7.0'; } diff --git a/sabre/dav/lib/DAVACL/Plugin.php b/sabre/dav/lib/DAVACL/Plugin.php index 46d680e15..f0497844d 100644 --- a/sabre/dav/lib/DAVACL/Plugin.php +++ b/sabre/dav/lib/DAVACL/Plugin.php @@ -716,7 +716,7 @@ public function getPrincipalByUri($uri) * @param array $requestedProperties this is the list of properties to * return for every match * @param string $collectionUri the principal collection to search on. - * If this is ommitted, the standard + * If this is omitted, the standard * principal collection-set will be used * @param string $test "allof" to use AND to search the * properties. 'anyof' for OR. diff --git a/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php b/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php index 17bc245c5..178bd7276 100644 --- a/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php +++ b/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php @@ -80,7 +80,7 @@ public function __construct(\PDO $pdo) * return any additional properties if you wish so. Common properties are: * {DAV:}displayname * {http://sabredav.org/ns}email-address - This is a custom SabreDAV - * field that's actualy injected in a number of other properties. If + * field that's actually injected in a number of other properties. If * you have an email address, use this property. * * @param string $prefixPath diff --git a/sabre/dav/lib/DAVACL/Xml/Property/Principal.php b/sabre/dav/lib/DAVACL/Xml/Property/Principal.php index 52092128f..5b9ee4517 100644 --- a/sabre/dav/lib/DAVACL/Xml/Property/Principal.php +++ b/sabre/dav/lib/DAVACL/Xml/Property/Principal.php @@ -149,7 +149,7 @@ public function toHtml(HtmlOutputHelper $html) /** * The deserialize method is called during xml parsing. * - * This method is called staticly, this is because in theory this method + * This method is called statically, this is because in theory this method * may be used as a type of constructor, or factory method. * * Often you want to return an instance of the current class, but you are diff --git a/sabre/event/lib/EmitterInterface.php b/sabre/event/lib/EmitterInterface.php index 6ce0f34db..662efd739 100644 --- a/sabre/event/lib/EmitterInterface.php +++ b/sabre/event/lib/EmitterInterface.php @@ -47,7 +47,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool; + public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool; /** * Returns the list of listeners for an event. @@ -74,5 +74,5 @@ public function removeListener(string $eventName, callable $listener): bool; * removed. If it is not specified, every listener for every event is * removed. */ - public function removeAllListeners(string $eventName = null); + public function removeAllListeners(?string $eventName = null); } diff --git a/sabre/event/lib/EmitterTrait.php b/sabre/event/lib/EmitterTrait.php index 5502ef9f3..5a0a23457 100644 --- a/sabre/event/lib/EmitterTrait.php +++ b/sabre/event/lib/EmitterTrait.php @@ -73,7 +73,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool + public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool { if (\is_null($continueCallBack)) { foreach ($this->listeners($eventName) as $listener) { @@ -160,7 +160,7 @@ public function removeListener(string $eventName, callable $listener): bool * removed. If it is not specified, every listener for every event is * removed. */ - public function removeAllListeners(string $eventName = null) + public function removeAllListeners(?string $eventName = null) { if (!\is_null($eventName)) { unset($this->listeners[$eventName]); diff --git a/sabre/event/lib/Loop/Loop.php b/sabre/event/lib/Loop/Loop.php index b85a7a440..74981da08 100644 --- a/sabre/event/lib/Loop/Loop.php +++ b/sabre/event/lib/Loop/Loop.php @@ -24,7 +24,7 @@ class Loop */ public function setTimeout(callable $cb, float $timeout) { - $triggerTime = microtime(true) + ($timeout); + $triggerTime = microtime(true) + $timeout; if (!$this->timers) { // Special case when the timers array was empty. @@ -265,7 +265,7 @@ protected function runTimers() * If $timeout is 0, it will return immediately. If $timeout is null, it * will wait indefinitely. * - * @param float|null timeout + * @param float|null $timeout */ protected function runStreams($timeout) { diff --git a/sabre/event/lib/Loop/functions.php b/sabre/event/lib/Loop/functions.php index bf4d933f2..9412a77ff 100644 --- a/sabre/event/lib/Loop/functions.php +++ b/sabre/event/lib/Loop/functions.php @@ -130,7 +130,7 @@ function stop() /** * Retrieves or sets the global Loop object. */ -function instance(Loop $newLoop = null): Loop +function instance(?Loop $newLoop = null): Loop { static $loop; if ($newLoop) { diff --git a/sabre/event/lib/Promise.php b/sabre/event/lib/Promise.php index 42969a55f..66903fb9f 100644 --- a/sabre/event/lib/Promise.php +++ b/sabre/event/lib/Promise.php @@ -5,7 +5,6 @@ namespace Sabre\Event; use Exception; -use Throwable; /** * An implementation of the Promise pattern. @@ -30,17 +29,17 @@ class Promise /** * The asynchronous operation is pending. */ - const PENDING = 0; + public const PENDING = 0; /** * The asynchronous operation has completed, and has a result. */ - const FULFILLED = 1; + public const FULFILLED = 1; /** * The asynchronous operation has completed with an error. */ - const REJECTED = 2; + public const REJECTED = 2; /** * The current state of this promise. @@ -58,7 +57,7 @@ class Promise * Each are callbacks that map to $this->fulfill and $this->reject. * Using the executor is optional. */ - public function __construct(callable $executor = null) + public function __construct(?callable $executor = null) { if ($executor) { $executor( @@ -87,7 +86,7 @@ public function __construct(callable $executor = null) * If either of the callbacks throw an exception, the returned promise will * be rejected and the exception will be passed back. */ - public function then(callable $onFulfilled = null, callable $onRejected = null): Promise + public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise { // This new subPromise will be returned from this function, and will // be fulfilled with the result of the onFulfilled or onRejected event @@ -128,8 +127,6 @@ public function otherwise(callable $onRejected): Promise /** * Marks this promise as fulfilled and sets its return value. - * - * @param mixed $value */ public function fulfill($value = null) { @@ -146,7 +143,7 @@ public function fulfill($value = null) /** * Marks this promise as rejected, and set its rejection reason. */ - public function reject(Throwable $reason) + public function reject(\Throwable $reason) { if (self::PENDING !== $this->state) { throw new PromiseAlreadyResolvedException('This promise is already resolved, and you\'re not allowed to resolve a promise more than once'); @@ -169,7 +166,6 @@ public function reject(Throwable $reason) * one. In PHP it might be useful to call this on the last promise in a * chain. * - * @return mixed * @psalm-return TReturn */ public function wait() @@ -208,10 +204,8 @@ public function wait() * * If the promise was fulfilled, this will be the result value. If the * promise was rejected, this property hold the rejection reason. - * - * @var mixed */ - protected $value = null; + protected $value; /** * This method is used to call either an onFulfilled or onRejected callback. @@ -219,10 +213,8 @@ public function wait() * This method makes sure that the result of these callbacks are handled * correctly, and any chained promises are also correctly fulfilled or * rejected. - * - * @param callable $callBack */ - private function invokeCallback(Promise $subPromise, callable $callBack = null) + private function invokeCallback(Promise $subPromise, ?callable $callBack = null) { // We use 'nextTick' to ensure that the event handlers are always // triggered outside of the calling stack in which they were originally @@ -244,7 +236,7 @@ private function invokeCallback(Promise $subPromise, callable $callBack = null) // immediately fulfill the chained promise. $subPromise->fulfill($result); } - } catch (Throwable $e) { + } catch (\Throwable $e) { // If the event handler threw an exception, we need to make sure that // the chained promise is rejected as well. $subPromise->reject($e); diff --git a/sabre/event/lib/Promise/functions.php b/sabre/event/lib/Promise/functions.php index fbed63471..67e80cbe4 100644 --- a/sabre/event/lib/Promise/functions.php +++ b/sabre/event/lib/Promise/functions.php @@ -5,7 +5,6 @@ namespace Sabre\Event\Promise; use Sabre\Event\Promise; -use Throwable; /** * This file contains a set of functions that are useful for dealing with the @@ -101,8 +100,6 @@ function ($reason) use ($fail, &$alreadyDone) { * * If the value is a promise, the returned promise will attach itself to that * promise and eventually get the same state as the followed promise. - * - * @param mixed $value */ function resolve($value): Promise { @@ -119,7 +116,7 @@ function resolve($value): Promise /** * Returns a Promise that will reject with the given reason. */ -function reject(Throwable $reason): Promise +function reject(\Throwable $reason): Promise { $promise = new Promise(); $promise->reject($reason); diff --git a/sabre/event/lib/Version.php b/sabre/event/lib/Version.php index fe8f5c3bf..10a98c607 100644 --- a/sabre/event/lib/Version.php +++ b/sabre/event/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '5.1.4'; + public const VERSION = '5.1.7'; } diff --git a/sabre/event/lib/WildcardEmitterTrait.php b/sabre/event/lib/WildcardEmitterTrait.php index 206a8f3c5..69243ff83 100644 --- a/sabre/event/lib/WildcardEmitterTrait.php +++ b/sabre/event/lib/WildcardEmitterTrait.php @@ -82,7 +82,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool + public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool { if (\is_null($continueCallBack)) { foreach ($this->listeners($eventName) as $listener) { @@ -195,7 +195,7 @@ public function removeListener(string $eventName, callable $listener): bool * removed. If it is not specified, every listener for every event is * removed. */ - public function removeAllListeners(string $eventName = null) + public function removeAllListeners(?string $eventName = null) { if (\is_null($eventName)) { $this->listeners = []; diff --git a/sabre/event/lib/coroutine.php b/sabre/event/lib/coroutine.php index cdf2d3ecd..f664efa78 100644 --- a/sabre/event/lib/coroutine.php +++ b/sabre/event/lib/coroutine.php @@ -5,7 +5,6 @@ namespace Sabre\Event; use Generator; -use Throwable; /** * Turn asynchronous promise-based code into something that looks synchronous @@ -42,10 +41,10 @@ * * }); * - * @return \Sabre\Event\Promise - * * @psalm-template TReturn + * * @psalm-param callable():\Generator $gen + * * @psalm-return Promise * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) @@ -55,7 +54,7 @@ function coroutine(callable $gen): Promise { $generator = $gen(); - if (!$generator instanceof Generator) { + if (!$generator instanceof \Generator) { throw new \InvalidArgumentException('You must pass a generator function'); } @@ -75,11 +74,11 @@ function ($value) use ($generator, &$advanceGenerator) { $generator->send($value); $advanceGenerator(); }, - function (Throwable $reason) use ($generator, $advanceGenerator) { + function (\Throwable $reason) use ($generator, $advanceGenerator) { $generator->throw($reason); $advanceGenerator(); } - )->otherwise(function (Throwable $reason) use ($promise) { + )->otherwise(function (\Throwable $reason) use ($promise) { // This error handler would be called, if something in the // generator throws an exception, and it's not caught // locally. @@ -104,7 +103,7 @@ function (Throwable $reason) use ($generator, $advanceGenerator) { if ($returnValue instanceof Promise) { $returnValue->then(function ($value) use ($promise) { $promise->fulfill($value); - }, function (Throwable $reason) use ($promise) { + }, function (\Throwable $reason) use ($promise) { $promise->reject($reason); }); } else { @@ -115,7 +114,7 @@ function (Throwable $reason) use ($generator, $advanceGenerator) { try { $advanceGenerator(); - } catch (Throwable $e) { + } catch (\Throwable $e) { $promise->reject($e); } diff --git a/sabre/http/lib/Auth/AWS.php b/sabre/http/lib/Auth/AWS.php index ffda3cf15..2690c634d 100644 --- a/sabre/http/lib/Auth/AWS.php +++ b/sabre/http/lib/Auth/AWS.php @@ -22,14 +22,14 @@ class AWS extends AbstractAuth * * @var string */ - private $signature = null; + private $signature; /** * The accesskey supplied by the HTTP client. * * @var string */ - private $accessKey = null; + private $accessKey; /** * An error code, if any. @@ -40,11 +40,11 @@ class AWS extends AbstractAuth */ public $errorCode = 0; - const ERR_NOAWSHEADER = 1; - const ERR_MD5CHECKSUMWRONG = 2; - const ERR_INVALIDDATEFORMAT = 3; - const ERR_REQUESTTIMESKEWED = 4; - const ERR_INVALIDSIGNATURE = 5; + public const ERR_NOAWSHEADER = 1; + public const ERR_MD5CHECKSUMWRONG = 2; + public const ERR_INVALIDDATEFORMAT = 3; + public const ERR_REQUESTTIMESKEWED = 4; + public const ERR_INVALIDSIGNATURE = 5; /** * Gathers all information from the headers. @@ -212,7 +212,7 @@ private function hmacsha1(string $key, string $message): string } $key = str_pad($key, $blocksize, chr(0x00)); $ipad = str_repeat(chr(0x36), $blocksize); - $opad = str_repeat(chr(0x5c), $blocksize); + $opad = str_repeat(chr(0x5C), $blocksize); $hmac = pack('H*', sha1(($key ^ $opad).pack('H*', sha1(($key ^ $ipad).$message)))); return $hmac; diff --git a/sabre/http/lib/Auth/Digest.php b/sabre/http/lib/Auth/Digest.php index e80e78305..08fa34f90 100644 --- a/sabre/http/lib/Auth/Digest.php +++ b/sabre/http/lib/Auth/Digest.php @@ -34,8 +34,8 @@ class Digest extends AbstractAuth /** * These constants are used in setQOP();. */ - const QOP_AUTH = 1; - const QOP_AUTHINT = 2; + public const QOP_AUTH = 1; + public const QOP_AUTHINT = 2; protected $nonce; protected $opaque; @@ -177,8 +177,6 @@ public function requireLogin() * It should be compatible with mod_php format and other webservers. * * If the header could not be found, null will be returned - * - * @return mixed */ public function getDigest() { diff --git a/sabre/http/lib/Client.php b/sabre/http/lib/Client.php index 0837e8d2a..c00f9e1b1 100644 --- a/sabre/http/lib/Client.php +++ b/sabre/http/lib/Client.php @@ -175,7 +175,7 @@ public function send(RequestInterface $request): ResponseInterface * After calling sendAsync, you must therefore occasionally call the poll() * method, or wait(). */ - public function sendAsync(RequestInterface $request, callable $success = null, callable $error = null) + public function sendAsync(RequestInterface $request, ?callable $success = null, ?callable $error = null) { $this->emit('beforeRequest', [$request]); $this->sendAsyncInternal($request, $success, $error); @@ -299,8 +299,6 @@ public function setThrowExceptions(bool $throwExceptions) * Adds a CURL setting. * * These settings will be included in every HTTP request. - * - * @param mixed $value */ public function addCurlSetting(int $name, $value) { @@ -419,9 +417,9 @@ protected function createCurlSettingsArray(RequestInterface $request): array return $settings; } - const STATUS_SUCCESS = 0; - const STATUS_CURLERROR = 1; - const STATUS_HTTPERROR = 2; + public const STATUS_SUCCESS = 0; + public const STATUS_CURLERROR = 1; + public const STATUS_HTTPERROR = 2; private function parseResponse(string $response, $curlHandle): array { diff --git a/sabre/http/lib/Request.php b/sabre/http/lib/Request.php index b8395ff45..99a13d25a 100644 --- a/sabre/http/lib/Request.php +++ b/sabre/http/lib/Request.php @@ -4,7 +4,6 @@ namespace Sabre\HTTP; -use LogicException; use Sabre\Uri; /** diff --git a/sabre/http/lib/Response.php b/sabre/http/lib/Response.php index c06c9637e..78ebb220d 100644 --- a/sabre/http/lib/Response.php +++ b/sabre/http/lib/Response.php @@ -100,10 +100,9 @@ class Response extends Message implements ResponseInterface * Creates the response object. * * @param string|int $status - * @param array $headers * @param resource $body */ - public function __construct($status = 500, array $headers = null, $body = null) + public function __construct($status = 500, ?array $headers = null, $body = null) { if (null !== $status) { $this->setStatus($status); diff --git a/sabre/http/lib/Sapi.php b/sabre/http/lib/Sapi.php index 55a4c46e7..4c8fb6732 100644 --- a/sabre/http/lib/Sapi.php +++ b/sabre/http/lib/Sapi.php @@ -4,8 +4,6 @@ namespace Sabre\HTTP; -use InvalidArgumentException; - /** * PHP SAPI. * @@ -168,7 +166,7 @@ public static function createFromServerArray(array $serverArray): Request $url = $value; break; - // These sometimes show up without a HTTP_ prefix + // These sometimes show up without a HTTP_ prefix case 'CONTENT_TYPE': $headers['Content-Type'] = $value; break; @@ -176,21 +174,21 @@ public static function createFromServerArray(array $serverArray): Request $headers['Content-Length'] = $value; break; - // mod_php on apache will put credentials in these variables. - // (fast)cgi does not usually do this, however. + // mod_php on apache will put credentials in these variables. + // (fast)cgi does not usually do this, however. case 'PHP_AUTH_USER': if (isset($serverArray['PHP_AUTH_PW'])) { $headers['Authorization'] = 'Basic '.base64_encode($value.':'.$serverArray['PHP_AUTH_PW']); } break; - // Similarly, mod_php may also screw around with digest auth. + // Similarly, mod_php may also screw around with digest auth. case 'PHP_AUTH_DIGEST': $headers['Authorization'] = 'Digest '.$value; break; - // Apache may prefix the HTTP_AUTHORIZATION header with - // REDIRECT_, if mod_rewrite was used. + // Apache may prefix the HTTP_AUTHORIZATION header with + // REDIRECT_, if mod_rewrite was used. case 'REDIRECT_HTTP_AUTHORIZATION': $headers['Authorization'] = $value; break; @@ -226,11 +224,11 @@ public static function createFromServerArray(array $serverArray): Request } if (null === $url) { - throw new InvalidArgumentException('The _SERVER array must have a REQUEST_URI key'); + throw new \InvalidArgumentException('The _SERVER array must have a REQUEST_URI key'); } if (null === $method) { - throw new InvalidArgumentException('The _SERVER array must have a REQUEST_METHOD key'); + throw new \InvalidArgumentException('The _SERVER array must have a REQUEST_METHOD key'); } $r = new Request($method, $url, $headers); $r->setHttpVersion($httpVersion); diff --git a/sabre/http/lib/Version.php b/sabre/http/lib/Version.php index 93c64797b..4ac82f6d7 100644 --- a/sabre/http/lib/Version.php +++ b/sabre/http/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '5.1.10'; + public const VERSION = '5.1.12'; } diff --git a/sabre/http/lib/functions.php b/sabre/http/lib/functions.php index d0477d943..9ecc1758a 100644 --- a/sabre/http/lib/functions.php +++ b/sabre/http/lib/functions.php @@ -4,9 +4,6 @@ namespace Sabre\HTTP; -use DateTime; -use InvalidArgumentException; - /** * A collection of useful helpers for parsing or generating various HTTP * headers. @@ -29,7 +26,7 @@ * See: * http://tools.ietf.org/html/rfc7231#section-7.1.1.1 * - * @return bool|DateTime + * @return bool|\DateTime */ function parseDate(string $dateString) { @@ -65,7 +62,7 @@ function parseDate(string $dateString) } try { - return new DateTime($dateString, new \DateTimeZone('UTC')); + return new \DateTime($dateString, new \DateTimeZone('UTC')); } catch (\Exception $e) { return false; } @@ -74,7 +71,7 @@ function parseDate(string $dateString) /** * Transforms a DateTime object to a valid HTTP/1.1 Date header value. */ -function toDate(DateTime $dateTime): string +function toDate(\DateTime $dateTime): string { // We need to clone it, as we don't want to affect the existing // DateTime. @@ -171,9 +168,9 @@ function negotiateContentType($acceptHeaderValue, array $availableOptions) // Does this entry win? if ( - ($proposal['quality'] > $lastQuality) || - ($proposal['quality'] === $lastQuality && $specificity > $lastSpecificity) || - ($proposal['quality'] === $lastQuality && $specificity === $lastSpecificity && $optionIndex < $lastOptionIndex) + ($proposal['quality'] > $lastQuality) + || ($proposal['quality'] === $lastQuality && $specificity > $lastSpecificity) + || ($proposal['quality'] === $lastQuality && $specificity === $lastSpecificity && $optionIndex < $lastOptionIndex) ) { $lastQuality = $proposal['quality']; $lastSpecificity = $specificity; @@ -331,7 +328,7 @@ function parseMimeType(string $str): array if (2 !== count($mimeType)) { // Illegal value var_dump($mimeType); - exit(); + exit; // throw new InvalidArgumentException('Not a valid mime-type: '.$str); } list($type, $subType) = $mimeType; diff --git a/sabre/uri/.php-cs-fixer.dist.php b/sabre/uri/.php-cs-fixer.dist.php deleted file mode 100644 index 87337520b..000000000 --- a/sabre/uri/.php-cs-fixer.dist.php +++ /dev/null @@ -1,13 +0,0 @@ -exclude('vendor') - ->in(__DIR__); - -$config = new PhpCsFixer\Config(); -$config->setRules([ - '@PSR1' => true, - '@Symfony' => true -]); -$config->setFinder($finder); -return $config; \ No newline at end of file diff --git a/sabre/uri/lib/Version.php b/sabre/uri/lib/Version.php index a30694f2c..c7652f4f2 100644 --- a/sabre/uri/lib/Version.php +++ b/sabre/uri/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - public const VERSION = '2.3.3'; + public const VERSION = '2.3.4'; } diff --git a/sabre/uri/lib/functions.php b/sabre/uri/lib/functions.php index 01ef92d7e..ce3027e2e 100644 --- a/sabre/uri/lib/functions.php +++ b/sabre/uri/lib/functions.php @@ -223,14 +223,14 @@ function ($matches) { */ return $result + [ - 'scheme' => null, - 'host' => null, - 'path' => null, - 'port' => null, - 'user' => null, - 'query' => null, - 'fragment' => null, - ]; + 'scheme' => null, + 'host' => null, + 'path' => null, + 'port' => null, + 'user' => null, + 'query' => null, + 'fragment' => null, + ]; } /** diff --git a/sabre/vobject/lib/Component/VCalendar.php b/sabre/vobject/lib/Component/VCalendar.php index 4db318135..017aed70c 100644 --- a/sabre/vobject/lib/Component/VCalendar.php +++ b/sabre/vobject/lib/Component/VCalendar.php @@ -281,7 +281,7 @@ public function getBaseComponent($componentName = null) * * @return VCalendar */ - public function expand(DateTimeInterface $start, DateTimeInterface $end, DateTimeZone $timeZone = null) + public function expand(DateTimeInterface $start, DateTimeInterface $end, ?DateTimeZone $timeZone = null) { $newChildren = []; $recurringEvents = []; diff --git a/sabre/vobject/lib/DateTimeParser.php b/sabre/vobject/lib/DateTimeParser.php index c5dbac97d..69072ef8c 100644 --- a/sabre/vobject/lib/DateTimeParser.php +++ b/sabre/vobject/lib/DateTimeParser.php @@ -31,7 +31,7 @@ class DateTimeParser * * @return DateTimeImmutable */ - public static function parseDateTime($dt, DateTimeZone $tz = null) + public static function parseDateTime($dt, ?DateTimeZone $tz = null) { // Format is YYYYMMDD + "T" + hhmmss $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/', $dt, $matches); @@ -61,7 +61,7 @@ public static function parseDateTime($dt, DateTimeZone $tz = null) * * @return DateTimeImmutable */ - public static function parseDate($date, DateTimeZone $tz = null) + public static function parseDate($date, ?DateTimeZone $tz = null) { // Format is YYYYMMDD $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches); diff --git a/sabre/vobject/lib/Document.php b/sabre/vobject/lib/Document.php index 14a77c911..d2131f479 100644 --- a/sabre/vobject/lib/Document.php +++ b/sabre/vobject/lib/Document.php @@ -157,7 +157,7 @@ public function create($name) * * @return Component */ - public function createComponent($name, array $children = null, $defaults = true) + public function createComponent($name, ?array $children = null, $defaults = true) { $name = strtoupper($name); $class = Component::class; @@ -186,10 +186,8 @@ public function createComponent($name, array $children = null, $defaults = true) * @param mixed $value * @param array $parameters * @param string $valueType Force a specific valuetype, such as URI or TEXT - * - * @return Property */ - public function createProperty($name, $value = null, array $parameters = null, $valueType = null) + public function createProperty($name, $value = null, ?array $parameters = null, $valueType = null, ?int $lineIndex = null, ?string $lineString = null): Property { // If there's a . in the name, it means it's prefixed by a groupname. if (false !== ($i = strpos($name, '.'))) { @@ -223,7 +221,7 @@ public function createProperty($name, $value = null, array $parameters = null, $ $parameters = []; } - return new $class($this, $name, $value, $parameters, $group); + return new $class($this, $name, $value, $parameters, $group, $lineIndex, $lineString); } /** diff --git a/sabre/vobject/lib/FreeBusyGenerator.php b/sabre/vobject/lib/FreeBusyGenerator.php index 81b8126d5..56ae166fa 100644 --- a/sabre/vobject/lib/FreeBusyGenerator.php +++ b/sabre/vobject/lib/FreeBusyGenerator.php @@ -89,7 +89,7 @@ class FreeBusyGenerator * @param mixed $objects * @param DateTimeZone $timeZone */ - public function __construct(DateTimeInterface $start = null, DateTimeInterface $end = null, $objects = null, DateTimeZone $timeZone = null) + public function __construct(?DateTimeInterface $start = null, ?DateTimeInterface $end = null, $objects = null, ?DateTimeZone $timeZone = null) { $this->setTimeRange($start, $end); @@ -158,7 +158,7 @@ public function setObjects($objects) * @param DateTimeInterface $start * @param DateTimeInterface $end */ - public function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null) + public function setTimeRange(?DateTimeInterface $start = null, ?DateTimeInterface $end = null) { if (!$start) { $start = new DateTimeImmutable(Settings::$minDate); diff --git a/sabre/vobject/lib/ITip/Broker.php b/sabre/vobject/lib/ITip/Broker.php index 80d9a5b31..9d68fc4c6 100644 --- a/sabre/vobject/lib/ITip/Broker.php +++ b/sabre/vobject/lib/ITip/Broker.php @@ -108,7 +108,7 @@ class Broker * * @return VCalendar|null */ - public function processMessage(Message $itipMessage, VCalendar $existingObject = null) + public function processMessage(Message $itipMessage, ?VCalendar $existingObject = null) { // We only support events at the moment. if ('VEVENT' !== $itipMessage->component) { @@ -266,7 +266,7 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null) * * @return VCalendar|null */ - protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null) + protected function processMessageRequest(Message $itipMessage, ?VCalendar $existingObject = null) { if (!$existingObject) { // This is a new invite, and we're just going to copy over @@ -301,7 +301,7 @@ protected function processMessageRequest(Message $itipMessage, VCalendar $existi * * @return VCalendar|null */ - protected function processMessageCancel(Message $itipMessage, VCalendar $existingObject = null) + protected function processMessageCancel(Message $itipMessage, ?VCalendar $existingObject = null) { if (!$existingObject) { // The event didn't exist in the first place, so we're just @@ -326,7 +326,7 @@ protected function processMessageCancel(Message $itipMessage, VCalendar $existin * * @return VCalendar|null */ - protected function processMessageReply(Message $itipMessage, VCalendar $existingObject = null) + protected function processMessageReply(Message $itipMessage, ?VCalendar $existingObject = null) { // A reply can only be processed based on an existing object. // If the object is not available, the reply is ignored. @@ -338,7 +338,10 @@ protected function processMessageReply(Message $itipMessage, VCalendar $existing // Finding all the instances the attendee replied to. foreach ($itipMessage->message->VEVENT as $vevent) { - $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master'; + // Use the Unix timestamp returned by getTimestamp as a unique identifier for the recurrence. + // The Unix timestamp will be the same for an event, even if the reply from the attendee + // used a different format/timezone to express the event date-time. + $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimestamp() : 'master'; $attendee = $vevent->ATTENDEE; $instances[$recurId] = $attendee['PARTSTAT']->getValue(); if (isset($vevent->{'REQUEST-STATUS'})) { @@ -351,7 +354,8 @@ protected function processMessageReply(Message $itipMessage, VCalendar $existing // all the instances where we have a reply for. $masterObject = null; foreach ($existingObject->VEVENT as $vevent) { - $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master'; + // Use the Unix timestamp returned by getTimestamp as a unique identifier for the recurrence. + $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimestamp() : 'master'; if ('master' === $recurId) { $masterObject = $vevent; } @@ -398,7 +402,10 @@ protected function processMessageReply(Message $itipMessage, VCalendar $existing $newObject = $recurrenceIterator->getEventObject(); $recurrenceIterator->next(); - if (isset($newObject->{'RECURRENCE-ID'}) && $newObject->{'RECURRENCE-ID'}->getValue() === $recurId) { + // Compare the Unix timestamp returned by getTimestamp with the previously calculated timestamp. + // If they are the same, then this is a matching recurrence, even though its date-time may have + // been expressed in a different format/timezone. + if (isset($newObject->{'RECURRENCE-ID'}) && $newObject->{'RECURRENCE-ID'}->getDateTime()->getTimestamp() === $recurId) { $found = true; } --$iterations; @@ -503,10 +510,11 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo, $icalMsg->add(clone $timezone); } - if (!$attendee['newInstances']) { - // If there are no instances the attendee is a part of, it - // means the attendee was removed and we need to send him a - // CANCEL. + if (!$attendee['newInstances'] || 'CANCELLED' === $eventInfo['status']) { + // If there are no instances the attendee is a part of, it means + // the attendee was removed and we need to send them a CANCEL message. + // Also If the meeting STATUS property was changed to CANCELLED + // we need to send the attendee a CANCEL message. $message->method = 'CANCEL'; $icalMsg->METHOD = $message->method; @@ -800,7 +808,7 @@ protected function parseEventForAttendee(VCalendar $calendar, array $eventInfo, * * @return array */ - protected function parseEventInfo(VCalendar $calendar = null) + protected function parseEventInfo(?VCalendar $calendar = null) { $uid = null; $organizer = null; diff --git a/sabre/vobject/lib/Parser/MimeDir.php b/sabre/vobject/lib/Parser/MimeDir.php index 513f7bd0c..d484d6a39 100644 --- a/sabre/vobject/lib/Parser/MimeDir.php +++ b/sabre/vobject/lib/Parser/MimeDir.php @@ -83,6 +83,12 @@ public function parse($input = null, $options = 0) $this->setInput($input); } + if (!\is_resource($this->input)) { + // Null was passed as input, but there was no existing input buffer + // There is nothing to parse. + throw new ParseException('No input provided to parse'); + } + if (0 !== $options) { $this->options = $options; } @@ -447,7 +453,7 @@ protected function readProperty($line) } } - $propObj = $this->root->createProperty($property['name'], null, $namedParameters); + $propObj = $this->root->createProperty($property['name'], null, $namedParameters, null, $this->startLine, $line); foreach ($namelessParameters as $namelessParameter) { $propObj->add(null, $namelessParameter); diff --git a/sabre/vobject/lib/Property.php b/sabre/vobject/lib/Property.php index f6550246a..f52760f9c 100644 --- a/sabre/vobject/lib/Property.php +++ b/sabre/vobject/lib/Property.php @@ -56,6 +56,20 @@ abstract class Property extends Node */ public $delimiter = ';'; + /** + * The line number in the original iCalendar / vCard file + * that corresponds with the current node + * if the node was read from a file. + */ + public $lineIndex; + + /** + * The line string from the original iCalendar / vCard file + * that corresponds with the current node + * if the node was read from a file. + */ + public $lineString; + /** * Creates the generic property. * @@ -67,7 +81,7 @@ abstract class Property extends Node * @param array $parameters List of parameters * @param string $group The vcard property group */ - public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) + public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null, ?int $lineIndex = null, ?string $lineString = null) { $this->name = $name; $this->group = $group; @@ -81,6 +95,14 @@ public function __construct(Component $root, $name, $value = null, array $parame if (!is_null($value)) { $this->setValue($value); } + + if (!is_null($lineIndex)) { + $this->lineIndex = $lineIndex; + } + + if (!is_null($lineString)) { + $this->lineString = $lineString; + } } /** diff --git a/sabre/vobject/lib/Property/ICalendar/DateTime.php b/sabre/vobject/lib/Property/ICalendar/DateTime.php index ca71633b9..3ea21e2ec 100644 --- a/sabre/vobject/lib/Property/ICalendar/DateTime.php +++ b/sabre/vobject/lib/Property/ICalendar/DateTime.php @@ -131,7 +131,7 @@ public function isFloating() * * @return \DateTimeImmutable */ - public function getDateTime(DateTimeZone $timeZone = null) + public function getDateTime(?DateTimeZone $timeZone = null) { $dt = $this->getDateTimes($timeZone); if (!$dt) { @@ -153,7 +153,7 @@ public function getDateTime(DateTimeZone $timeZone = null) * @return \DateTimeImmutable[] * @return \DateTime[] */ - public function getDateTimes(DateTimeZone $timeZone = null) + public function getDateTimes(?DateTimeZone $timeZone = null) { // Does the property have a TZID? $tzid = $this['TZID']; diff --git a/sabre/vobject/lib/Property/ICalendar/Recur.php b/sabre/vobject/lib/Property/ICalendar/Recur.php index 3d632fec1..cd3d7a5e4 100644 --- a/sabre/vobject/lib/Property/ICalendar/Recur.php +++ b/sabre/vobject/lib/Property/ICalendar/Recur.php @@ -2,6 +2,7 @@ namespace Sabre\VObject\Property\ICalendar; +use Sabre\VObject\InvalidDataException; use Sabre\VObject\Property; use Sabre\Xml; @@ -198,7 +199,14 @@ public static function stringToArray($value) if (empty($part)) { continue; } - list($partName, $partValue) = explode('=', $part); + + $parts = explode('=', $part); + + if (2 !== count($parts)) { + throw new InvalidDataException('The supplied iCalendar RRULE part is incorrect: '.$part); + } + + list($partName, $partValue) = $parts; // The value itself had multiple values.. if (false !== strpos($partValue, ',')) { diff --git a/sabre/vobject/lib/Recur/EventIterator.php b/sabre/vobject/lib/Recur/EventIterator.php index 61f05d7de..55d6e4779 100644 --- a/sabre/vobject/lib/Recur/EventIterator.php +++ b/sabre/vobject/lib/Recur/EventIterator.php @@ -93,7 +93,7 @@ class EventIterator implements \Iterator * @param DateTimeZone $timeZone reference timezone for floating dates and * times */ - public function __construct($input, $uid = null, DateTimeZone $timeZone = null) + public function __construct($input, $uid = null, ?DateTimeZone $timeZone = null) { if (is_null($timeZone)) { $timeZone = new DateTimeZone('UTC'); diff --git a/sabre/vobject/lib/Recur/RRuleIterator.php b/sabre/vobject/lib/Recur/RRuleIterator.php index 4f0e9070d..ca53b63ee 100644 --- a/sabre/vobject/lib/Recur/RRuleIterator.php +++ b/sabre/vobject/lib/Recur/RRuleIterator.php @@ -172,6 +172,14 @@ public function fastForward(DateTimeInterface $dt) */ protected $currentDate; + /** + * The number of hours that the next occurrence of an event + * jumped forward, usually because summer time started and + * the requested time-of-day like 0230 did not exist on that + * day. And so the event was scheduled 1 hour later at 0330. + */ + protected $hourJump = 0; + /** * Frequency is one of: secondly, minutely, hourly, daily, weekly, monthly, * yearly. @@ -319,12 +327,65 @@ public function fastForward(DateTimeInterface $dt) /* Functions that advance the iterator {{{ */ + /** + * Gets the original start time of the RRULE. + * + * The value is formatted as a string with 24-hour:minute:second + */ + protected function startTime(): string + { + return $this->startDate->format('H:i:s'); + } + + /** + * Advances currentDate by the interval. + * The time is set from the original startDate. + * If the recurrence is on a day when summer time started, then the + * time on that day may have jumped forward, for example, from 0230 to 0330. + * Using the original time means that the next recurrence will be calculated + * based on the original start time and the day/week/month/year interval. + * So the start time of the next occurrence can correctly revert to 0230. + */ + protected function advanceTheDate(string $interval): void + { + $this->currentDate = $this->currentDate->modify($interval.' '.$this->startTime()); + } + + /** + * Does the processing for adjusting the time of multi-hourly events when summer time starts. + */ + protected function adjustForTimeJumpsOfHourlyEvent(DateTimeInterface $previousEventDateTime): void + { + if (0 === $this->hourJump) { + // Remember if the clock time jumped forward on the next occurrence. + // That happens if the next event time is on a day when summer time starts + // and the event time is in the non-existent hour of the day. + // For example, an event that normally starts at 02:30 will + // have to start at 03:30 on that day. + // If the interval is just 1 hour, then there is no "jumping back" to do. + // The events that day will happen, for example, at 0030 0130 0330 0430 0530... + if ($this->interval > 1) { + $expectedHourOfNextDate = ((int) $previousEventDateTime->format('G') + $this->interval) % 24; + $actualHourOfNextDate = (int) $this->currentDate->format('G'); + $this->hourJump = $actualHourOfNextDate - $expectedHourOfNextDate; + } + } else { + // The hour "jumped" for the previous occurrence, to avoid the non-existent time. + // currentDate got set ahead by (usually) 1 hour on that day. + // Adjust it back for this next occurrence. + $this->currentDate = $this->currentDate->sub(new \DateInterval('PT'.$this->hourJump.'H')); + $this->hourJump = 0; + } + } + /** * Does the processing for advancing the iterator for hourly frequency. */ protected function nextHourly() { + $previousEventDateTime = clone $this->currentDate; $this->currentDate = $this->currentDate->modify('+'.$this->interval.' hours'); + $this->adjustForTimeJumpsOfHourlyEvent($previousEventDateTime); } /** @@ -333,7 +394,7 @@ protected function nextHourly() protected function nextDaily() { if (!$this->byHour && !$this->byDay) { - $this->currentDate = $this->currentDate->modify('+'.$this->interval.' days'); + $this->advanceTheDate('+'.$this->interval.' days'); return; } @@ -392,7 +453,7 @@ protected function nextDaily() protected function nextWeekly() { if (!$this->byHour && !$this->byDay) { - $this->currentDate = $this->currentDate->modify('+'.$this->interval.' weeks'); + $this->advanceTheDate('+'.$this->interval.' weeks'); return; } @@ -414,7 +475,7 @@ protected function nextWeekly() if ($this->byHour) { $this->currentDate = $this->currentDate->modify('+1 hours'); } else { - $this->currentDate = $this->currentDate->modify('+1 days'); + $this->advanceTheDate('+1 days'); } // Current day of the week @@ -449,13 +510,13 @@ protected function nextMonthly() // occur to the next month. We Must skip these invalid // entries. if ($currentDayOfMonth < 29) { - $this->currentDate = $this->currentDate->modify('+'.$this->interval.' months'); + $this->advanceTheDate('+'.$this->interval.' months'); } else { $increase = 0; do { ++$increase; $tempDate = clone $this->currentDate; - $tempDate = $tempDate->modify('+ '.($this->interval * $increase).' months'); + $tempDate = $tempDate->modify('+ '.($this->interval * $increase).' months '.$this->startTime()); } while ($tempDate->format('j') != $currentDayOfMonth); $this->currentDate = $tempDate; } @@ -506,11 +567,15 @@ protected function nextMonthly() } } + // Set the currentDate to the year and month that we are in, and the day of the month that we have selected. + // That day could be a day when summer time starts, and if the time of the event is, for example, 0230, + // then 0230 will not be a valid time on that day. So always apply the start time from the original startDate. + // The "modify" method will set the time forward to 0330, for example, if needed. $this->currentDate = $this->currentDate->setDate( (int) $this->currentDate->format('Y'), (int) $this->currentDate->format('n'), (int) $occurrence - ); + )->modify($this->startTime()); } /** @@ -627,7 +692,7 @@ protected function nextYearly() } // The easiest form - $this->currentDate = $this->currentDate->modify('+'.$this->interval.' years'); + $this->advanceTheDate('+'.$this->interval.' years'); return; } @@ -651,7 +716,11 @@ protected function nextYearly() // If we advanced to the next month or year, the first // occurrence is always correct. if ($occurrence > $currentDayOfMonth || $advancedToNewMonth) { - break 2; + // only consider byMonth matches, + // otherwise, we don't follow RRule correctly + if (in_array($currentMonth, $this->byMonth)) { + break 2; + } } } @@ -687,7 +756,7 @@ protected function nextYearly() (int) $currentYear, (int) $currentMonth, (int) $occurrence - ); + )->modify($this->startTime()); return; } else { @@ -704,7 +773,7 @@ protected function nextYearly() (int) $currentYear, (int) $currentMonth, (int) $currentDayOfMonth - ); + )->modify($this->startTime()); return; } diff --git a/sabre/vobject/lib/TimeZoneUtil.php b/sabre/vobject/lib/TimeZoneUtil.php index 6422c0930..0d77e71ed 100644 --- a/sabre/vobject/lib/TimeZoneUtil.php +++ b/sabre/vobject/lib/TimeZoneUtil.php @@ -75,7 +75,7 @@ private function addFinder(string $key, TimezoneFinder $finder): void * Alternatively, if $failIfUncertain is set to true, it will throw an * exception if we cannot accurately determine the timezone. */ - private function findTimeZone(string $tzid, Component $vcalendar = null, bool $failIfUncertain = false): DateTimeZone + private function findTimeZone(string $tzid, ?Component $vcalendar = null, bool $failIfUncertain = false): DateTimeZone { foreach ($this->timezoneFinders as $timezoneFinder) { $timezone = $timezoneFinder->find($tzid, $failIfUncertain); @@ -126,7 +126,7 @@ public static function addTimezoneFinder(string $key, TimezoneFinder $finder): v * * @return DateTimeZone */ - public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) + public static function getTimeZone($tzid, ?Component $vcalendar = null, $failIfUncertain = false) { return self::getInstance()->findTimeZone($tzid, $vcalendar, $failIfUncertain); } diff --git a/sabre/vobject/lib/Version.php b/sabre/vobject/lib/Version.php index c7ca69e14..060c69a30 100644 --- a/sabre/vobject/lib/Version.php +++ b/sabre/vobject/lib/Version.php @@ -14,5 +14,5 @@ class Version /** * Full version number. */ - public const VERSION = '4.5.4'; + public const VERSION = '4.5.6'; } diff --git a/sabre/xml/lib/Deserializer/functions.php b/sabre/xml/lib/Deserializer/functions.php index 7a16ec9e0..50818098b 100644 --- a/sabre/xml/lib/Deserializer/functions.php +++ b/sabre/xml/lib/Deserializer/functions.php @@ -55,7 +55,7 @@ * Attributes will be removed from the top-level elements. If elements with * the same name appear twice in the list, only the last one will be kept. */ -function keyValue(Reader $reader, string $namespace = null): array +function keyValue(Reader $reader, ?string $namespace = null): array { // If there's no children, we don't do anything. if ($reader->isEmptyElement) { @@ -144,7 +144,7 @@ function keyValue(Reader $reader, string $namespace = null): array * * @return string[] */ -function enum(Reader $reader, string $namespace = null): array +function enum(Reader $reader, ?string $namespace = null): array { // If there's no children, we don't do anything. if ($reader->isEmptyElement) { @@ -325,8 +325,6 @@ function mixedContent(Reader $reader): array * * You can use, e.g., a named constructor (factory method) to create an object using * this function. - * - * @return mixed */ function functionCaller(Reader $reader, callable $func, string $namespace) { diff --git a/sabre/xml/lib/Element/Base.php b/sabre/xml/lib/Element/Base.php index 8a93191b1..02fd76966 100644 --- a/sabre/xml/lib/Element/Base.php +++ b/sabre/xml/lib/Element/Base.php @@ -21,8 +21,6 @@ class Base implements Xml\Element { /** * PHP value to serialize. - * - * @var mixed */ protected $value; @@ -72,8 +70,6 @@ public function xmlSerialize(Xml\Writer $writer) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Xml\Reader $reader) { diff --git a/sabre/xml/lib/Element/Elements.php b/sabre/xml/lib/Element/Elements.php index fecce4c75..6915fd462 100644 --- a/sabre/xml/lib/Element/Elements.php +++ b/sabre/xml/lib/Element/Elements.php @@ -90,8 +90,6 @@ public function xmlSerialize(Xml\Writer $writer) * * $reader->parseSubTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Xml\Reader $reader) { diff --git a/sabre/xml/lib/Element/KeyValue.php b/sabre/xml/lib/Element/KeyValue.php index 17448880d..7d75a3ac8 100644 --- a/sabre/xml/lib/Element/KeyValue.php +++ b/sabre/xml/lib/Element/KeyValue.php @@ -90,8 +90,6 @@ public function xmlSerialize(Xml\Writer $writer) * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Xml\Reader $reader) { diff --git a/sabre/xml/lib/Element/Uri.php b/sabre/xml/lib/Element/Uri.php index 336212a53..65276380e 100644 --- a/sabre/xml/lib/Element/Uri.php +++ b/sabre/xml/lib/Element/Uri.php @@ -84,8 +84,6 @@ public function xmlSerialize(Xml\Writer $writer) * * $reader->parseSubTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Xml\Reader $reader) { diff --git a/sabre/xml/lib/Element/XmlFragment.php b/sabre/xml/lib/Element/XmlFragment.php index bf110eaee..99d1f87f9 100644 --- a/sabre/xml/lib/Element/XmlFragment.php +++ b/sabre/xml/lib/Element/XmlFragment.php @@ -135,8 +135,6 @@ public function xmlSerialize(Writer $writer) * * $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/sabre/xml/lib/LibXMLException.php b/sabre/xml/lib/LibXMLException.php index fb074f97d..993f95fd9 100644 --- a/sabre/xml/lib/LibXMLException.php +++ b/sabre/xml/lib/LibXMLException.php @@ -5,7 +5,6 @@ namespace Sabre\Xml; use LibXMLError; -use Throwable; /** * This exception is thrown when the Reader runs into a parsing error. @@ -30,10 +29,9 @@ class LibXMLException extends ParseException * * You should pass a list of LibXMLError objects in its constructor. * - * @param LibXMLError[] $errors - * @param Throwable $previousException + * @param \LibXMLError[] $errors */ - public function __construct(array $errors, int $code = 0, Throwable $previousException = null) + public function __construct(array $errors, int $code = 0, ?\Throwable $previousException = null) { $this->errors = $errors; parent::__construct($errors[0]->message.' on line '.$errors[0]->line.', column '.$errors[0]->column, $code, $previousException); diff --git a/sabre/xml/lib/ParseException.php b/sabre/xml/lib/ParseException.php index e237b8732..158cf0119 100644 --- a/sabre/xml/lib/ParseException.php +++ b/sabre/xml/lib/ParseException.php @@ -13,6 +13,6 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ParseException extends Exception +class ParseException extends \Exception { } diff --git a/sabre/xml/lib/Reader.php b/sabre/xml/lib/Reader.php index 7871a74f5..f680bf4cd 100644 --- a/sabre/xml/lib/Reader.php +++ b/sabre/xml/lib/Reader.php @@ -19,7 +19,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Reader extends XMLReader +class Reader extends \XMLReader { use ContextStackTrait; @@ -103,7 +103,7 @@ public function parse(): array * If the $elementMap argument is specified, the existing elementMap will * be overridden while parsing the tree, and restored after this process. */ - public function parseGetElements(array $elementMap = null): array + public function parseGetElements(?array $elementMap = null): array { $result = $this->parseInnerTree($elementMap); if (!is_array($result)) { @@ -126,7 +126,7 @@ public function parseGetElements(array $elementMap = null): array * * @return array|string|null */ - public function parseInnerTree(array $elementMap = null) + public function parseInnerTree(?array $elementMap = null) { $text = null; $elements = []; @@ -205,7 +205,7 @@ public function readText(): string $previousDepth = $this->depth; while ($this->read() && $this->depth != $previousDepth) { - if (in_array($this->nodeType, [XMLReader::TEXT, XMLReader::CDATA, XMLReader::WHITESPACE])) { + if (in_array($this->nodeType, [\XMLReader::TEXT, \XMLReader::CDATA, \XMLReader::WHITESPACE])) { $result .= $this->value; } } diff --git a/sabre/xml/lib/Serializer/functions.php b/sabre/xml/lib/Serializer/functions.php index 8d0330558..23f22d4c8 100644 --- a/sabre/xml/lib/Serializer/functions.php +++ b/sabre/xml/lib/Serializer/functions.php @@ -4,7 +4,6 @@ namespace Sabre\Xml\Serializer; -use InvalidArgumentException; use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; @@ -197,12 +196,12 @@ function standardSerializer(Writer $writer, $value) $writer->write($item); $writer->endElement(); } else { - throw new InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name)); + throw new \InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name)); } } } elseif (is_object($value)) { - throw new InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value)); + throw new \InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value)); } elseif (!is_null($value)) { - throw new InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value)); + throw new \InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value)); } } diff --git a/sabre/xml/lib/Service.php b/sabre/xml/lib/Service.php index a8e34d254..6e522630e 100644 --- a/sabre/xml/lib/Service.php +++ b/sabre/xml/lib/Service.php @@ -105,16 +105,23 @@ public function getWriter(): Writer * * @param string|resource $input * - * @throws ParseException - * * @return array|object|string + * + * @throws ParseException */ - public function parse($input, string $contextUri = null, string &$rootElementName = null) + public function parse($input, ?string $contextUri = null, ?string &$rootElementName = null) { - if (is_resource($input)) { + if (!is_string($input)) { // Unfortunately the XMLReader doesn't support streams. When it // does, we can optimize this. - $input = (string) stream_get_contents($input); + if (is_resource($input)) { + $input = (string) stream_get_contents($input); + } else { + // Input is not a string and not a resource. + // Therefore, it has to be a closed resource. + // Effectively empty input has been passed in. + $input = ''; + } } // If input is empty, then it's safe to throw an exception @@ -149,16 +156,23 @@ public function parse($input, string $contextUri = null, string &$rootElementNam * @param string|string[] $rootElementName * @param string|resource $input * - * @throws ParseException - * * @return array|object|string + * + * @throws ParseException */ - public function expect($rootElementName, $input, string $contextUri = null) + public function expect($rootElementName, $input, ?string $contextUri = null) { - if (is_resource($input)) { + if (!is_string($input)) { // Unfortunately the XMLReader doesn't support streams. When it // does, we can optimize this. - $input = (string) stream_get_contents($input); + if (is_resource($input)) { + $input = (string) stream_get_contents($input); + } else { + // Input is not a string and not a resource. + // Therefore, it has to be a closed resource. + // Effectively empty input has been passed in. + $input = ''; + } } // If input is empty, then it's safe to throw an exception @@ -204,7 +218,7 @@ public function expect($rootElementName, $input, string $contextUri = null) * * @return string */ - public function write(string $rootElementName, $value, string $contextUri = null) + public function write(string $rootElementName, $value, ?string $contextUri = null) { $w = $this->getWriter(); $w->openMemory(); @@ -266,7 +280,7 @@ public function mapValueObject(string $elementName, string $className) * * @throws \InvalidArgumentException */ - public function writeValueObject($object, string $contextUri = null) + public function writeValueObject($object, ?string $contextUri = null) { if (!isset($this->valueObjectMap[get_class($object)])) { throw new \InvalidArgumentException('"'.get_class($object).'" is not a registered value object class. Register your class with mapValueObject.'); diff --git a/sabre/xml/lib/Version.php b/sabre/xml/lib/Version.php index 860beaa7c..c2da842ec 100644 --- a/sabre/xml/lib/Version.php +++ b/sabre/xml/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '2.2.7'; + public const VERSION = '2.2.11'; } diff --git a/sabre/xml/lib/Writer.php b/sabre/xml/lib/Writer.php index e3238a7ed..76989612e 100644 --- a/sabre/xml/lib/Writer.php +++ b/sabre/xml/lib/Writer.php @@ -30,7 +30,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Writer extends XMLWriter +class Writer extends \XMLWriter { use ContextStackTrait; @@ -93,8 +93,6 @@ class Writer extends XMLWriter * ] * ] * ] - * - * @param mixed $value */ public function write($value) { @@ -151,7 +149,7 @@ public function startElement($name): bool if (!$this->namespacesWritten) { foreach ($this->namespaceMap as $namespace => $prefix) { - $this->writeAttribute(($prefix ? 'xmlns:'.$prefix : 'xmlns'), $namespace); + $this->writeAttribute($prefix ? 'xmlns:'.$prefix : 'xmlns', $namespace); } $this->namespacesWritten = true; } diff --git a/sabre/xml/lib/XmlDeserializable.php b/sabre/xml/lib/XmlDeserializable.php index 83f33db1e..0a5720334 100644 --- a/sabre/xml/lib/XmlDeserializable.php +++ b/sabre/xml/lib/XmlDeserializable.php @@ -31,8 +31,6 @@ interface XmlDeserializable * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. - * - * @return mixed */ public static function xmlDeserialize(Reader $reader); }