Skip to content

Commit

Permalink
Fix PHP 8 deprecation notices in Wpup_Headers
Browse files Browse the repository at this point in the history
Implemented interface methods must have return types that match the interface, or the #[\ReturnTypeWillChange] attribute. I've added the attribute. 

Reported in #102
  • Loading branch information
YahnisElsts committed Dec 16, 2022
1 parent b6d1714 commit 9d44338
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions includes/Wpup/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,31 +126,37 @@ 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]);
}

/* Countable interface */

#[\ReturnTypeWillChange]
public function count() {
return count($this->headers);
}

/* IteratorAggregate interface */

#[\ReturnTypeWillChange]
public function getIterator() {
return new ArrayIterator($this->headers);
}
Expand Down

0 comments on commit 9d44338

Please sign in to comment.