Skip to content

Commit df9f086

Browse files
authored
Merge branch 'sabre-io:master' into master
2 parents 96674e8 + a6ff593 commit df9f086

File tree

13 files changed

+53
-15
lines changed

13 files changed

+53
-15
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3']
56+
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
5757
coverage: [ 'xdebug' ]
5858
streaming: [ false ]
5959
include:

lib/CalDAV/Schedule/Plugin.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Sabre\VObject;
2626
use Sabre\VObject\Component\VCalendar;
2727
use Sabre\VObject\ITip;
28+
use Sabre\VObject\ITip\Broker;
2829
use Sabre\VObject\ITip\Message;
2930
use Sabre\VObject\Reader;
3031

@@ -389,7 +390,7 @@ public function beforeUnbind($path)
389390
$node->getOwner()
390391
);
391392

392-
$broker = new ITip\Broker();
393+
$broker = $this->createITipBroker();
393394
$messages = $broker->parseEvent(null, $addresses, $node->get());
394395

395396
foreach ($messages as $message) {
@@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage)
500501
$isNewNode = true;
501502
}
502503

503-
$broker = new ITip\Broker();
504+
$broker = $this->createITipBroker();
504505
$newObject = $broker->processMessage($iTipMessage, $currentObject);
505506

506507
$inbox->createFile($newFileName, $iTipMessage->message->serialize());
@@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege
611612
*/
612613
protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
613614
{
614-
$broker = new ITip\Broker();
615+
$broker = $this->createITipBroker();
615616
$messages = $broker->parseEvent($newObject, $addresses, $oldObject);
616617

617618
if ($messages) {
@@ -994,4 +995,12 @@ public function getPluginInfo()
994995
'link' => 'http://sabre.io/dav/scheduling/',
995996
];
996997
}
998+
999+
/**
1000+
* Returns an instance of the iTip\Broker.
1001+
*/
1002+
protected function createITipBroker(): Broker
1003+
{
1004+
return new Broker();
1005+
}
9971006
}

lib/CardDAV/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ protected function negotiateVCard($input, &$mimeType = null)
800800
*
801801
* @return string
802802
*/
803-
protected function convertVCard($data, $target, array $propertiesFilter = null)
803+
protected function convertVCard($data, $target, ?array $propertiesFilter = null)
804804
{
805805
if (is_resource($data)) {
806806
$data = stream_get_contents($data);

lib/CardDAV/Xml/Property/SupportedAddressData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SupportedAddressData implements XmlSerializable
3434
/**
3535
* Creates the property.
3636
*/
37-
public function __construct(array $supportedData = null)
37+
public function __construct(?array $supportedData = null)
3838
{
3939
if (is_null($supportedData)) {
4040
$supportedData = [

lib/DAV/Auth/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Plugin extends ServerPlugin
5858
*
5959
* @param Backend\BackendInterface $authBackend
6060
*/
61-
public function __construct(Backend\BackendInterface $authBackend = null)
61+
public function __construct(?Backend\BackendInterface $authBackend = null)
6262
{
6363
if (!is_null($authBackend)) {
6464
$this->addBackend($authBackend);

lib/DAV/Exception/Locked.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Locked extends DAV\Exception
3232
*
3333
* @param DAV\Locks\LockInfo $lock
3434
*/
35-
public function __construct(DAV\Locks\LockInfo $lock = null)
35+
public function __construct(?DAV\Locks\LockInfo $lock = null)
3636
{
3737
parent::__construct();
3838

lib/DAV/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class Server implements LoggerAwareInterface, EmitterInterface
211211
*
212212
* @throws Exception
213213
*/
214-
public function __construct($treeOrNode = null, HTTP\Sapi $sapi = null)
214+
public function __construct($treeOrNode = null, ?HTTP\Sapi $sapi = null)
215215
{
216216
if ($treeOrNode instanceof Tree) {
217217
$this->tree = $treeOrNode;
@@ -882,7 +882,7 @@ public function getHTTPHeaders($path)
882882
*
883883
* @return \Traversable
884884
*/
885-
private function generatePathNodes(PropFind $propFind, array $yieldFirst = null)
885+
private function generatePathNodes(PropFind $propFind, ?array $yieldFirst = null)
886886
{
887887
if (null !== $yieldFirst) {
888888
yield $yieldFirst;

lib/DAV/Tree.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,21 @@ public function getNodeForPath($path)
6262
return $this->rootNode;
6363
}
6464

65-
$parts = explode('/', $path);
6665
$node = $this->rootNode;
6766

67+
// look for any cached parent and collect the parts below the parent
68+
$parts = [];
69+
$remainingPath = $path;
70+
do {
71+
list($remainingPath, $baseName) = Uri\split($remainingPath);
72+
array_unshift($parts, $baseName);
73+
74+
if (isset($this->cache[$remainingPath])) {
75+
$node = $this->cache[$remainingPath];
76+
break;
77+
}
78+
} while ('' !== $remainingPath);
79+
6880
while (count($parts)) {
6981
if (!($node instanceof ICollection)) {
7082
throw new Exception\NotFound('Could not find node at path: '.$path);

tests/Sabre/CalDAV/SharedCalendarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SharedCalendarTest extends \PHPUnit\Framework\TestCase
1111
{
1212
protected $backend;
1313

14-
public function getInstance(array $props = null)
14+
public function getInstance(?array $props = null)
1515
{
1616
if (is_null($props)) {
1717
$props = [

tests/Sabre/DAV/Mock/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Collection extends DAV\Collection
3434
* @param string $name
3535
* @param Collection $parent
3636
*/
37-
public function __construct($name, array $children = [], Collection $parent = null)
37+
public function __construct($name, array $children = [], ?Collection $parent = null)
3838
{
3939
$this->name = $name;
4040
foreach ($children as $key => $value) {

0 commit comments

Comments
 (0)