Skip to content

Commit cb0c983

Browse files
committed
Compensate for PHP 8.1 backward compatibility issues
1 parent e618d74 commit cb0c983

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Matrix.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Tensor\Exceptions\DimensionalityMismatch;
1313
use Tensor\Exceptions\RuntimeException;
1414
use Tensor\Exceptions\NotImplemented;
15-
use Generator;
15+
use Traversable;
1616

1717
use function count;
1818
use function is_float;
@@ -3435,7 +3435,7 @@ public function offsetGet($index) : Vector
34353435
*
34363436
* @return \Generator<int,\Tensor\Vector>
34373437
*/
3438-
public function getIterator() : Generator
3438+
public function getIterator() : Traversable
34393439
{
34403440
foreach ($this->a as $row) {
34413441
yield Vector::quick($row);

src/Vector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Tensor\Exceptions\DimensionalityMismatch;
77
use Tensor\Exceptions\RuntimeException;
88
use ArrayIterator;
9+
use Traversable;
910

1011
use function count;
1112
use function is_float;
@@ -2303,6 +2304,7 @@ public function offsetUnset($index) : void
23032304
* @throws \Tensor\Exceptions\InvalidArgumentException
23042305
* @return float
23052306
*/
2307+
#[\ReturnTypeWillChange]
23062308
public function offsetGet($index)
23072309
{
23082310
if (isset($this->a[$index])) {
@@ -2318,7 +2320,7 @@ public function offsetGet($index)
23182320
*
23192321
* @return \ArrayIterator<int,float>
23202322
*/
2321-
public function getIterator() : ArrayIterator
2323+
public function getIterator() : Traversable
23222324
{
23232325
return new ArrayIterator($this->a);
23242326
}

0 commit comments

Comments
 (0)