From 591f1e0c70b270287a7e74e9636361fa9660968f Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 23 Jun 2019 19:19:45 +0200 Subject: [PATCH] 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 --- src/PhpSpreadsheet/ReferenceHelper.php | 14 ++++++++++---- src/PhpSpreadsheet/Worksheet/Worksheet.php | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index a14880b7..13dbe042 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -82,8 +82,11 @@ class ReferenceHelper */ public static function cellSort($a, $b) { - sscanf($a, '%[A-Z]%d', $ac, $ar); - sscanf($b, '%[A-Z]%d', $bc, $br); + // TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax + // [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support. + // Switch when we drop support for 5.6 + list($ac, $ar) = sscanf($a, '%[A-Z]%d'); + list($bc, $br) = sscanf($b, '%[A-Z]%d'); if ($ar === $br) { return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); @@ -103,8 +106,11 @@ class ReferenceHelper */ public static function cellReverseSort($a, $b) { - sscanf($a, '%[A-Z]%d', $ac, $ar); - sscanf($b, '%[A-Z]%d', $bc, $br); + // TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax + // [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support. + // Switch when we drop support for 5.6 + list($ac, $ar) = sscanf($a, '%[A-Z]%d'); + list($bc, $br) = sscanf($b, '%[A-Z]%d'); if ($ar === $br) { return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index cf257166..1e525a3f 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -2064,7 +2064,7 @@ class Worksheet implements IComparable /** * Insert a new column, updating all possible related data. * - * @param int $pBefore Insert before this one, eg: 'A' + * @param string $pBefore Insert before this one, eg: 'A' * @param int $pNumCols Number of columns to insert * * @throws Exception