Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated lib/Varien for PHP8.1 #2802

Merged
merged 1 commit into from
Dec 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/Varien/Data/Form/Element/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct($container)
*
* @return ArrayIterator
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new ArrayIterator($this->_elements);
}
Expand All @@ -69,7 +69,7 @@ public function getIterator()
* @param mixed $key
* @param mixed $value
*/
public function offsetSet($key, $value)
public function offsetSet($key, $value): void
{
$this->_elements[$key] = $value;
}
Expand All @@ -80,7 +80,7 @@ public function offsetSet($key, $value)
* @param mixed $key
* @return mixed
*/
public function offsetGet($key)
public function offsetGet($key): mixed
{
return $this->_elements[$key];
}
Expand All @@ -90,7 +90,7 @@ public function offsetGet($key)
*
* @param mixed $key
*/
public function offsetUnset($key)
public function offsetUnset($key): void
{
unset($this->_elements[$key]);
}
Expand All @@ -99,9 +99,9 @@ public function offsetUnset($key)
* Implementation of ArrayAccess:offsetExists()
*
* @param mixed $key
* @return boolean
* @return bool
*/
public function offsetExists($key)
public function offsetExists($key): bool
{
return isset($this->_elements[$key]);
}
Expand Down Expand Up @@ -179,7 +179,7 @@ public function remove($elementId)
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->_elements);
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Varien/Data/Tree/Node/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getNodes()
/**
* Implementation of IteratorAggregate::getIterator()
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new ArrayIterator($this->_nodes);
}
Expand All @@ -69,17 +69,17 @@ public function getIterator()
* @param string $key
* @param string $value
*/
public function offsetSet($key, $value)
public function offsetSet($key, $value): void
{
$this->_nodes[$key] = $value;
}

/**
* Implementation of ArrayAccess:offsetGet()
* @param string $key
* @return Varien_Data_Tree_Node
* @return mixed|Varien_Data_Tree_Node
*/
public function offsetGet($key)
public function offsetGet($key): mixed
{
return $this->_nodes[$key];
}
Expand All @@ -88,7 +88,7 @@ public function offsetGet($key)
* Implementation of ArrayAccess:offsetUnset()
* @param string $key
*/
public function offsetUnset($key)
public function offsetUnset($key): void
{
unset($this->_nodes[$key]);
}
Expand All @@ -98,7 +98,7 @@ public function offsetUnset($key)
* @param string $key
* @return bool
*/
public function offsetExists($key)
public function offsetExists($key): bool
{
return isset($this->_nodes[$key]);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public function delete($node)
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->_nodes);
}
Expand Down
12 changes: 6 additions & 6 deletions lib/Varien/Db/Tree/NodeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/**
* TODO implements iterators
*
*/
class Varien_Db_Tree_NodeSet implements Iterator
{
Expand Down Expand Up @@ -60,31 +59,32 @@ public function count()
/**
* @return bool
*/
public function valid()
public function valid(): bool
{
return isset($this->_nodes[$this->_current]);
}

#[\ReturnTypeWillChange]
public function next()
{
if ($this->_current > $this->_currentNode) {
return false;
} else {
return $this->_current++;
return $this->_current++;
}
}

public function key()
public function key(): mixed
{
return $this->_current;
}

public function current()
public function current(): mixed
{
return $this->_nodes[$this->_current];
}

public function rewind()
public function rewind(): void
{
$this->_current = 0;
}
Expand Down
14 changes: 5 additions & 9 deletions lib/Varien/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,7 @@ public function debug($data = null, &$objects = [])
* @param string $offset
* @param mixed $value
*/
#[ReturnTypeWillChange]
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->_data[$offset] = $value;
}
Expand All @@ -846,10 +845,9 @@ public function offsetSet($offset, $value)
*
* @link http://www.php.net/manual/en/arrayaccess.offsetexists.php
* @param string $offset
* @return boolean
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->_data[$offset]);
}
Expand All @@ -860,8 +858,7 @@ public function offsetExists($offset)
* @link http://www.php.net/manual/en/arrayaccess.offsetunset.php
* @param string $offset
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->_data[$offset]);
}
Expand All @@ -873,8 +870,7 @@ public function offsetUnset($offset)
* @param string $offset
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return isset($this->_data[$offset]) ? $this->_data[$offset] : null;
}
Expand Down