From 1a1e7cc666d17bb316ab501719a15acf14118276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 29 Jul 2024 08:59:55 +0200 Subject: [PATCH 1/2] Explicitly mark nullable parameter --- lib/CardDAV/Plugin.php | 2 +- lib/CardDAV/Xml/Property/SupportedAddressData.php | 2 +- lib/DAV/Auth/Plugin.php | 2 +- lib/DAV/Exception/Locked.php | 2 +- lib/DAV/Server.php | 4 ++-- tests/Sabre/CalDAV/SharedCalendarTest.php | 2 +- tests/Sabre/DAV/Mock/Collection.php | 2 +- tests/Sabre/DAV/Mock/File.php | 2 +- tests/Sabre/DAVACL/PrincipalBackend/Mock.php | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php index c2d31d9dfe..810ae3a1ab 100644 --- a/lib/CardDAV/Plugin.php +++ b/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/lib/CardDAV/Xml/Property/SupportedAddressData.php b/lib/CardDAV/Xml/Property/SupportedAddressData.php index a912724bf9..c3cc7741d8 100644 --- a/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/lib/CardDAV/Xml/Property/SupportedAddressData.php @@ -34,7 +34,7 @@ class SupportedAddressData implements XmlSerializable /** * Creates the property. */ - public function __construct(array $supportedData = null) + public function __construct(?array $supportedData = null) { if (is_null($supportedData)) { $supportedData = [ diff --git a/lib/DAV/Auth/Plugin.php b/lib/DAV/Auth/Plugin.php index eb4f27ca67..47fbe205ac 100644 --- a/lib/DAV/Auth/Plugin.php +++ b/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/lib/DAV/Exception/Locked.php b/lib/DAV/Exception/Locked.php index 28263cf13e..24fad70955 100644 --- a/lib/DAV/Exception/Locked.php +++ b/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/lib/DAV/Server.php b/lib/DAV/Server.php index 1a97951ecd..3133e54ad3 100644 --- a/lib/DAV/Server.php +++ b/lib/DAV/Server.php @@ -211,7 +211,7 @@ class Server implements LoggerAwareInterface, EmitterInterface * * @throws Exception */ - public function __construct($treeOrNode = null, HTTP\Sapi $sapi = null) + public function __construct($treeOrNode = null, ?HTTP\Sapi $sapi = null) { if ($treeOrNode instanceof Tree) { $this->tree = $treeOrNode; @@ -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; diff --git a/tests/Sabre/CalDAV/SharedCalendarTest.php b/tests/Sabre/CalDAV/SharedCalendarTest.php index 7e8d830a26..f5ce9d796c 100644 --- a/tests/Sabre/CalDAV/SharedCalendarTest.php +++ b/tests/Sabre/CalDAV/SharedCalendarTest.php @@ -11,7 +11,7 @@ class SharedCalendarTest extends \PHPUnit\Framework\TestCase { protected $backend; - public function getInstance(array $props = null) + public function getInstance(?array $props = null) { if (is_null($props)) { $props = [ diff --git a/tests/Sabre/DAV/Mock/Collection.php b/tests/Sabre/DAV/Mock/Collection.php index 3ffb342ddd..7baa6f6216 100644 --- a/tests/Sabre/DAV/Mock/Collection.php +++ b/tests/Sabre/DAV/Mock/Collection.php @@ -34,7 +34,7 @@ class Collection extends DAV\Collection * @param string $name * @param Collection $parent */ - public function __construct($name, array $children = [], Collection $parent = null) + public function __construct($name, array $children = [], ?Collection $parent = null) { $this->name = $name; foreach ($children as $key => $value) { diff --git a/tests/Sabre/DAV/Mock/File.php b/tests/Sabre/DAV/Mock/File.php index d48ddaa922..329c23e08c 100644 --- a/tests/Sabre/DAV/Mock/File.php +++ b/tests/Sabre/DAV/Mock/File.php @@ -30,7 +30,7 @@ class File extends DAV\File * @param Collection $parent * @param int $lastModified */ - public function __construct($name, $contents, Collection $parent = null, $lastModified = -1) + public function __construct($name, $contents, ?Collection $parent = null, $lastModified = -1) { $this->name = $name; $this->put($contents); diff --git a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php index 359e678197..4a721dd6ba 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php @@ -9,7 +9,7 @@ class Mock extends AbstractBackend public $groupMembers = []; public $principals; - public function __construct(array $principals = null) + public function __construct(?array $principals = null) { $this->principals = $principals; From a9d0a909af6485fdb80dd5301ad794c77910e604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 29 Jul 2024 09:02:15 +0200 Subject: [PATCH 2/2] Add PHP 8.4 to the test matrix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 323c32e80e..9367a494c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] coverage: [ 'xdebug' ] streaming: [ false ] include: