Skip to content

Commit

Permalink
fix: PHP 8.4 deprecations (#1560)
Browse files Browse the repository at this point in the history
* Explicitly mark nullable parameter

* Add PHP 8.3 and 8.4 to the test matrix
  • Loading branch information
cedric-anne authored Sep 5, 2024
1 parent 8e26c69 commit 986d5f3
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
coverage: [ 'xdebug' ]
streaming: [ false ]
include:
Expand Down
2 changes: 1 addition & 1 deletion lib/CardDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/CardDAV/Xml/Property/SupportedAddressData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Auth/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Exception/Locked.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions lib/DAV/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/CalDAV/SharedCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/DAV/Mock/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/DAV/Mock/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/DAVACL/PrincipalBackend/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 986d5f3

Please sign in to comment.