diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b0271f35..58206827 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1660,6 +1660,11 @@ parameters: count: 1 path: src/PhpSpreadsheet/Reader/Xls/RC4.php + - + message: "#^Cannot access property \\$r on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx.php + - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#" count: 1 @@ -2750,6 +2755,16 @@ parameters: count: 1 path: src/PhpSpreadsheet/Writer/Xls.php + - + message: "#^Offset 'length' does not exist on array\\{data\\: non\\-empty\\-string, length\\?\\: int\\<1, max\\>\\}\\|array\\{pack\\?\\: 'V', data\\: non\\-empty\\-string\\}\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls.php + + - + message: "#^Offset 'length' does not exist on array\\{data\\: non\\-empty\\-string\\|false, length\\?\\: int\\<1, max\\>\\}\\|array\\{pack\\?\\: 'V', data\\: 1252\\|786432\\|false\\}\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls.php + - message: "#^Offset 'startCoordinates' does not exist on array\\|null\\.$#" count: 1 @@ -2912,7 +2927,7 @@ parameters: - message: "#^Cannot access offset 1 on array\\|false\\.$#" - count: 1 + count: 2 path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 94eadd85..59bfcafe 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -4793,7 +4793,7 @@ class Calculation if (isset($matches[8])) { if ($cell === null) { - // We can't access the range, so return a REF error + // We can't access the range, so return a REF error $cellValue = Information\ExcelError::REF(); } else { $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; @@ -4864,6 +4864,7 @@ class Calculation if (isset($storeKey)) { $branchStore[$storeKey] = $cellValue; } + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $token ?? '', $matches)) { // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on if ($pCellParent) { diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 26cd1af3..e2fae121 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -487,7 +487,7 @@ class Xlsx extends BaseReader $propertyReader->readCustomProperties($this->getFromZipArchive($zip, $relTarget)); break; - // Ribbon + //Ribbon case Namespaces::EXTENSIBILITY: $customUI = $relTarget; if ($customUI) { @@ -1703,8 +1703,8 @@ class Xlsx extends BaseReader break; - case 'application/vnd.ms-excel.controlproperties+xml': // unparsed + case 'application/vnd.ms-excel.controlproperties+xml': $unparsedLoadedData['override_content_types'][(string) $contentType['PartName']] = (string) $contentType['ContentType']; break; @@ -1729,7 +1729,7 @@ class Xlsx extends BaseReader if (isset($is->t)) { $value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t)); } else { - if (isset($is->r) && is_object($is->r)) { + if (is_object($is->r)) { /** @var SimpleXMLElement $run */ foreach ($is->r as $run) { if (!isset($run->rPr)) {