From f68dd99518058f9076e4c70da5639fe77816dbdb Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 5 Jul 2023 22:20:52 +0200 Subject: [PATCH] Some more deprecation fixups --- src/Collection/Api/Notifications.php | 1 + src/Util/ACLFormatter.php | 9 ++++++--- src/Util/ReversedFileReader.php | 4 +++- tests/Util/Intercept.php | 2 +- tests/src/Database/DatabaseTest.php | 9 +++++++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Collection/Api/Notifications.php b/src/Collection/Api/Notifications.php index c2ccf2cffb..4bb1eaa566 100644 --- a/src/Collection/Api/Notifications.php +++ b/src/Collection/Api/Notifications.php @@ -29,6 +29,7 @@ class Notifications extends BaseCollection /** * @return Notification */ + #[\ReturnTypeWillChange] public function current() { return parent::current(); diff --git a/src/Util/ACLFormatter.php b/src/Util/ACLFormatter.php index f7a0894e1c..cd398fc280 100644 --- a/src/Util/ACLFormatter.php +++ b/src/Util/ACLFormatter.php @@ -35,7 +35,7 @@ final class ACLFormatter * * @return array The array based on the IDs (empty in case there is no list) */ - public function expand(string $acl_string = null) + public function expand(string $acl_string = null): array { // In case there is no ID list, return empty array (=> no ACL set) if (empty($acl_string)) { @@ -55,7 +55,7 @@ final class ACLFormatter * @param string|null $acl_string * @return string */ - public function sanitize(string $acl_string = null) + public function sanitize(string $acl_string = null): string { if (empty($acl_string)) { return ''; @@ -107,10 +107,13 @@ final class ACLFormatter * * @return string */ - function toString($permissions) { + function toString($permissions): string + { $return = ''; if (is_array($permissions)) { $item = $permissions; + } elseif (empty($permissions)) { + return ''; } else { $item = explode(',', $permissions); } diff --git a/src/Util/ReversedFileReader.php b/src/Util/ReversedFileReader.php index fdd15bec90..58fb2cb3fa 100644 --- a/src/Util/ReversedFileReader.php +++ b/src/Util/ReversedFileReader.php @@ -89,7 +89,7 @@ class ReversedFileReader implements \Iterator * * @return string|null Depending on data being buffered */ - private function _readline() + private function _readline(): ?string { $buffer = & $this->buffer; while (true) { @@ -112,6 +112,7 @@ class ReversedFileReader implements \Iterator * @see Iterator::next() * @return void */ + #[\ReturnTypeWillChange] public function next() { ++$this->key; @@ -124,6 +125,7 @@ class ReversedFileReader implements \Iterator * @see Iterator::rewind() * @return void */ + #[\ReturnTypeWillChange] public function rewind() { if ($this->filesize > 0) { diff --git a/tests/Util/Intercept.php b/tests/Util/Intercept.php index 27b558fc5e..483d274fca 100644 --- a/tests/Util/Intercept.php +++ b/tests/Util/Intercept.php @@ -37,7 +37,7 @@ class Intercept extends php_user_filter public static $cache = ''; /** @noinspection PhpMissingParentCallCommonInspection */ - public function filter($in, $out, &$consumed, $closing) + public function filter($in, $out, &$consumed, $closing): int { while ($bucket = stream_bucket_make_writeable($in)) { self::$cache .= $bucket->data; diff --git a/tests/src/Database/DatabaseTest.php b/tests/src/Database/DatabaseTest.php index e906834614..c431a5294d 100644 --- a/tests/src/Database/DatabaseTest.php +++ b/tests/src/Database/DatabaseTest.php @@ -30,6 +30,15 @@ class DatabaseTest extends FixtureTest { use CreateDatabaseTrait; + /** + * @var Cache + */ + protected $configCache; + /** + * @var ConfigFileManager + */ + protected $configFileManager; + protected function setUp(): void { $this->setUpVfsDir(); -- 2.39.5