Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from bshaffer/add-return-type-will-change
Browse files Browse the repository at this point in the history
chore: fix return type will change deprecation in PHP 8.1
  • Loading branch information
vierbergenlars committed May 2, 2023
2 parents 0db3f31 + a709686 commit ff2f5b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vierbergenlars/LibJs/JSArray.php
Expand Up @@ -149,49 +149,57 @@ public function __get($name)
}
}


#[\ReturnTypeWillChange]
public function current()
{
return $this->_convert(current($this->array));
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->_convert(key($this->array));
}

#[\ReturnTypeWillChange]
public function next()
{
return $this->_convert(next($this->array));
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->array[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if(!$this->offsetExists($offset))
return null;
return $this->_convert($this->array[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->array[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->array[$offset]);
}

#[\ReturnTypeWillChange]
public function rewind()
{
return reset($this->array);
}

#[\ReturnTypeWillChange]
public function valid()
{
return key($this->array) !== null;
Expand Down
4 changes: 4 additions & 0 deletions src/vierbergenlars/LibJs/JString.php
Expand Up @@ -207,21 +207,25 @@ public function __get($name)
}
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->str[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->str[$offset];
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->str[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new \LogicException('Cannot unset a position in a string');
Expand Down

0 comments on commit ff2f5b3

Please sign in to comment.