Skip to content

Commit

Permalink
handle mixed return type for PHP version prior to 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
KBorm committed Mar 20, 2024
1 parent 0bddb36 commit d965845
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions classes/ProformaXMLElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public function offsetUnset($offset) : void {
* @param mixed $offset
* @return mixed|SimpleXMLElement Either a named attribute or an element from a list of children
*/
public function offsetGet ($offset) : mixed {
#[ReturnTypeWillChange]
public function offsetGet ($offset) {
return $this->element->attributes()->$offset;
}

Expand Down Expand Up @@ -162,7 +163,8 @@ public function __toString () {
* Iterator interface: return element at cursor position
* @return mixed|ProformaXMLElement
*/
public function current() : mixed {
#[ReturnTypeWillChange]
public function current() {
return new ProformaXMLElement($this->cursor, $this->namespace);
}

Expand All @@ -178,7 +180,8 @@ public function next() : void {
* @return bool|float|int|string|void|null
* @throws coding_exception
*/
public function key() : mixed {
#[ReturnTypeWillChange]
public function key() {
// TODO: Implement key() method.
throw new coding_exception('not implemented key');
}
Expand Down

0 comments on commit d965845

Please sign in to comment.