From 6b555f64daa15c2218da6b28c522dc408327b49d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Nov 2022 13:36:49 -0500 Subject: [PATCH] Add \ReturnTypeWillChange attribute to methods inherited from native interfaces - Part of https://github.com/friendica/friendica/issues/12011#issuecomment-1321796513 --- src/BaseCollection.php | 14 ++++++++------ src/Core/Session/Handler/Database.php | 2 ++ src/Object/Email.php | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/BaseCollection.php b/src/BaseCollection.php index f6fa9bbd4..ad68dc81c 100644 --- a/src/BaseCollection.php +++ b/src/BaseCollection.php @@ -48,25 +48,27 @@ class BaseCollection extends \ArrayIterator /** * @inheritDoc */ - public function offsetSet($offset, $value) + #[\ReturnTypeWillChange] + public function offsetSet($key, $value): void { - if (is_null($offset)) { + if (is_null($key)) { $this->totalCount++; } - parent::offsetSet($offset, $value); + parent::offsetSet($key, $value); } /** * @inheritDoc */ - public function offsetUnset($offset) + #[\ReturnTypeWillChange] + public function offsetUnset($key): void { - if ($this->offsetExists($offset)) { + if ($this->offsetExists($key)) { $this->totalCount--; } - parent::offsetUnset($offset); + parent::offsetUnset($key); } /** diff --git a/src/Core/Session/Handler/Database.php b/src/Core/Session/Handler/Database.php index 41ccb6b33..337397be6 100644 --- a/src/Core/Session/Handler/Database.php +++ b/src/Core/Session/Handler/Database.php @@ -57,6 +57,7 @@ class Database extends AbstractSessionHandler return true; } + #[\ReturnTypeWillChange] public function read($id) { if (empty($id)) { @@ -136,6 +137,7 @@ class Database extends AbstractSessionHandler } } + #[\ReturnTypeWillChange] public function gc($max_lifetime): bool { try { diff --git a/src/Object/Email.php b/src/Object/Email.php index 4d5a11715..fdde4e96d 100644 --- a/src/Object/Email.php +++ b/src/Object/Email.php @@ -200,6 +200,7 @@ class Email implements IEmail /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray();