Skip to content

Commit 8ef9aa8

Browse files
author
MarkBaker
committed
Minor performance tweak
1 parent 7c1c896 commit 8ef9aa8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/PhpSpreadsheet/Worksheet/Validations.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ public static function validateCellAddress($cellAddress): string
4242
public static function validateCellOrCellRange($cellRange): string
4343
{
4444
if (is_string($cellRange) || is_numeric($cellRange)) {
45-
// Convert a single column reference like 'A' to 'A:A'
46-
$cellRange = (string) preg_replace('/^([A-Z]+)$/', '${1}:${1}', (string) $cellRange);
47-
// Convert a single row reference like '1' to '1:1'
48-
$cellRange = (string) preg_replace('/^(\d+)$/', '${1}:${1}', $cellRange);
45+
// Convert a single column reference like 'A' to 'A:A',
46+
// a single row reference like '1' to '1:1'
47+
$cellRange = (string) preg_replace('/^([A-Z]+|\d+)$/', '${1}:${1}', (string) $cellRange);
4948
} elseif (is_object($cellRange) && $cellRange instanceof CellAddress) {
5049
$cellRange = new CellRange($cellRange, $cellRange);
5150
}

0 commit comments

Comments
 (0)