Skip to content

Commit 455c259

Browse files
committed
Minor Tweak
1 parent 19555d6 commit 455c259

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentHelper.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,11 @@ public function isColumnVector(int $argument): bool
132132
return $this->columns[$argument] === 1;
133133
}
134134

135-
public function rowCountMixed(mixed $argument): int
136-
{
137-
return is_int($argument) ? $this->rowCount($argument) : throw new Exception('arg should be int');
138-
}
139-
140135
public function rowCount(int $argument): int
141136
{
142137
return $this->rows[$argument];
143138
}
144139

145-
public function columnCountMixed(mixed $argument): int
146-
{
147-
return is_int($argument) ? $this->columnCount($argument) : throw new Exception('arg should be int');
148-
}
149-
150140
public function columnCount(int $argument): int
151141
{
152142
return $this->columns[$argument];

src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentProcessor.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ private static function evaluateVectorMatrixPair(callable $method, array $matrix
7070
/** @var mixed[][] $matrixValues1 */
7171
$matrixValues1 = $arguments[$matrix1];
7272

73-
$rows = min(array_map(self::$arrayArgumentHelper->rowCountMixed(...), [$matrix1, $matrix2]));
74-
$columns = min(array_map(self::$arrayArgumentHelper->columnCountMixed(...), [$matrix1, $matrix2]));
73+
/** @var non-empty-array<int> */
74+
$matrix12 = [$matrix1, $matrix2];
75+
$rows = min(array_map(self::$arrayArgumentHelper->rowCount(...), $matrix12));
76+
$columns = min(array_map(self::$arrayArgumentHelper->columnCount(...), $matrix12));
7577

7678
if ($rows === 1) {
77-
$rows = max(array_map(self::$arrayArgumentHelper->rowCountMixed(...), [$matrix1, $matrix2]));
79+
$rows = max(array_map(self::$arrayArgumentHelper->rowCount(...), $matrix12));
7880
}
7981
if ($columns === 1) {
80-
$columns = max(array_map(self::$arrayArgumentHelper->columnCountMixed(...), [$matrix1, $matrix2]));
82+
$columns = max(array_map(self::$arrayArgumentHelper->columnCount(...), $matrix12));
8183
}
8284

8385
$result = [];

0 commit comments

Comments
 (0)