Skip to content

Commit b4fc92e

Browse files
author
MarkBaker
committed
Simplify validation of columnId/rowId values when creating a CellAddress object
1 parent fde7730 commit b4fc92e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/PhpSpreadsheet/Cell/CellAddress.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ public function __construct(string $cellAddress, ?Worksheet $worksheet = null)
4747
*/
4848
private static function validateColumnAndRow($columnId, $rowId): void
4949
{
50-
$array = [$columnId, $rowId];
51-
array_walk(
52-
$array,
53-
function ($value): void {
54-
if (!is_numeric($value) || $value <= 0) {
55-
throw new Exception('Row and Column Ids must be positive integer values');
56-
}
57-
}
58-
);
50+
if (!is_numeric($columnId) || $columnId <= 0 || !is_numeric($rowId) || $rowId <= 0) {
51+
throw new Exception('Row and Column Ids must be positive integer values');
52+
}
5953
}
6054

6155
/**

0 commit comments

Comments
 (0)