From 9d44338b13214194121179932a290de3066c5f87 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Fri, 16 Dec 2022 20:43:50 +0200 Subject: [PATCH] Fix PHP 8 deprecation notices in Wpup_Headers Implemented interface methods must have return types that match the interface, or the #[\ReturnTypeWillChange] attribute. I've added the attribute. Reported in #102 --- includes/Wpup/Headers.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/Wpup/Headers.php b/includes/Wpup/Headers.php index f5c39bb..d9a23c1 100644 --- a/includes/Wpup/Headers.php +++ b/includes/Wpup/Headers.php @@ -126,18 +126,22 @@ public function set($name, $value) { /* ArrayAccess interface */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return array_key_exists($offset, $this->headers); } + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->set($offset, $value); } + #[\ReturnTypeWillChange] public function offsetUnset($offset) { $name = $this->normalizeName($offset); unset($this->headers[$name]); @@ -145,12 +149,14 @@ public function offsetUnset($offset) { /* Countable interface */ + #[\ReturnTypeWillChange] public function count() { return count($this->headers); } /* IteratorAggregate interface */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->headers); }