Skip to content

Commit

Permalink
Compensate for PHP 8.1 backward compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Apr 3, 2022
1 parent e618d74 commit cb0c983
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Tensor\Exceptions\DimensionalityMismatch;
use Tensor\Exceptions\RuntimeException;
use Tensor\Exceptions\NotImplemented;
use Generator;
use Traversable;

use function count;
use function is_float;
Expand Down Expand Up @@ -3435,7 +3435,7 @@ public function offsetGet($index) : Vector
*
* @return \Generator<int,\Tensor\Vector>
*/
public function getIterator() : Generator
public function getIterator() : Traversable
{
foreach ($this->a as $row) {
yield Vector::quick($row);
Expand Down
4 changes: 3 additions & 1 deletion src/Vector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Tensor\Exceptions\DimensionalityMismatch;
use Tensor\Exceptions\RuntimeException;
use ArrayIterator;
use Traversable;

use function count;
use function is_float;
Expand Down Expand Up @@ -2303,6 +2304,7 @@ public function offsetUnset($index) : void
* @throws \Tensor\Exceptions\InvalidArgumentException
* @return float
*/
#[\ReturnTypeWillChange]
public function offsetGet($index)
{
if (isset($this->a[$index])) {
Expand All @@ -2318,7 +2320,7 @@ public function offsetGet($index)
*
* @return \ArrayIterator<int,float>
*/
public function getIterator() : ArrayIterator
public function getIterator() : Traversable
{
return new ArrayIterator($this->a);
}
Expand Down

0 comments on commit cb0c983

Please sign in to comment.