Skip to content

Commit

Permalink
Fix remaining Hoa PHP 8.1 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 30, 2021
1 parent 7367c7b commit 458a8fb
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 0 deletions.
56 changes: 56 additions & 0 deletions patches/Buffer.patch
@@ -0,0 +1,56 @@
@package hoa/iterator

--- Buffer.php 2017-01-10 11:34:47.000000000 +0100
+++ Buffer.php 2021-10-30 16:36:22.000000000 +0200
@@ -103,7 +103,7 @@
*
* @return \Iterator
*/
- public function getInnerIterator()
+ public function getInnerIterator(): ?\Iterator
{
return $this->_iterator;
}
@@ -133,6 +133,7 @@
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->getBuffer()->current()[self::BUFFER_VALUE];
@@ -143,6 +144,7 @@
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->getBuffer()->current()[self::BUFFER_KEY];
@@ -153,7 +155,7 @@
*
* @return void
*/
- public function next()
+ public function next(): void
{
$innerIterator = $this->getInnerIterator();
$buffer = $this->getBuffer();
@@ -204,7 +206,7 @@
*
* @return void
*/
- public function rewind()
+ public function rewind(): void
{
$innerIterator = $this->getInnerIterator();
$buffer = $this->getBuffer();
@@ -228,7 +230,7 @@
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return
$this->getBuffer()->valid() &&
54 changes: 54 additions & 0 deletions patches/Lookahead.patch
@@ -0,0 +1,54 @@
@package hoa/iterator

--- Lookahead.php 2017-01-10 11:34:47.000000000 +0100
+++ Lookahead.php 2021-10-30 16:35:30.000000000 +0200
@@ -93,7 +93,7 @@
*
* @return \Iterator
*/
- public function getInnerIterator()
+ public function getInnerIterator(): ?\Iterator
{
return $this->_iterator;
}
@@ -103,6 +103,7 @@
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->_current;
@@ -113,6 +114,7 @@
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->_key;
@@ -123,6 +125,7 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
$innerIterator = $this->getInnerIterator();
@@ -143,6 +146,7 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$out = $this->getInnerIterator()->rewind();
@@ -156,7 +160,7 @@
*
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
return $this->_valid;
}
48 changes: 48 additions & 0 deletions patches/Node.patch
@@ -0,0 +1,48 @@
@package hoa/protocol

--- Node/Node.php 2017-01-14 13:26:10.000000000 +0100
+++ Node/Node.php 2021-10-30 16:32:43.000000000 +0200
@@ -108,7 +108,7 @@
* @return \Hoa\Protocol\Protocol
* @throws \Hoa\Protocol\Exception
*/
- public function offsetSet($name, $node)
+ public function offsetSet($name, $node): void
{
if (!($node instanceof self)) {
throw new Protocol\Exception(
@@ -141,6 +141,7 @@
* @return \Hoa\Protocol\Protocol
* @throws \Hoa\Protocol\Exception
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($name)
{
if (!isset($this[$name])) {
@@ -160,7 +161,7 @@
* @param string $name Node's name.
* @return bool
*/
- public function offsetExists($name)
+ public function offsetExists($name): bool
{
return true === array_key_exists($name, $this->_children);
}
@@ -171,7 +172,7 @@
* @param string $name Node's name to remove.
* @return void
*/
- public function offsetUnset($name)
+ public function offsetUnset($name): void
{
unset($this->_children[$name]);

@@ -365,7 +366,7 @@
*
* @return \ArrayIterator
*/
- public function getIterator()
+ public function getIterator(): \Traversable
{
return new \ArrayIterator($this->_children);
}

0 comments on commit 458a8fb

Please sign in to comment.