Skip to content

Commit 591f1e0

Browse files
author
Mark Baker
authored
Scrutinizer resolutions (#1031)
* list($ac, $ar) = sscanf($a, '%[A-Z]%d'); to appease scrutinizer, which complains about ($a, '%[A-Z]%d') * Fix a docblock error
1 parent 14e9806 commit 591f1e0

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/PhpSpreadsheet/ReferenceHelper.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ public static function columnReverseSort($a, $b)
8282
*/
8383
public static function cellSort($a, $b)
8484
{
85-
sscanf($a, '%[A-Z]%d', $ac, $ar);
86-
sscanf($b, '%[A-Z]%d', $bc, $br);
85+
// TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax
86+
// [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support.
87+
// Switch when we drop support for 5.6
88+
list($ac, $ar) = sscanf($a, '%[A-Z]%d');
89+
list($bc, $br) = sscanf($b, '%[A-Z]%d');
8790

8891
if ($ar === $br) {
8992
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@@ -103,8 +106,11 @@ public static function cellSort($a, $b)
103106
*/
104107
public static function cellReverseSort($a, $b)
105108
{
106-
sscanf($a, '%[A-Z]%d', $ac, $ar);
107-
sscanf($b, '%[A-Z]%d', $bc, $br);
109+
// TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax
110+
// [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support.
111+
// Switch when we drop support for 5.6
112+
list($ac, $ar) = sscanf($a, '%[A-Z]%d');
113+
list($bc, $br) = sscanf($b, '%[A-Z]%d');
108114

109115
if ($ar === $br) {
110116
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);

src/PhpSpreadsheet/Worksheet/Worksheet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ public function insertNewRowBefore($pBefore, $pNumRows = 1)
20642064
/**
20652065
* Insert a new column, updating all possible related data.
20662066
*
2067-
* @param int $pBefore Insert before this one, eg: 'A'
2067+
* @param string $pBefore Insert before this one, eg: 'A'
20682068
* @param int $pNumCols Number of columns to insert
20692069
*
20702070
* @throws Exception

0 commit comments

Comments
 (0)