Skip to content

Commit 153a3a6

Browse files
author
MarkBaker
committed
Fix for null value passed to extractSheetTitle()
1 parent 070bc68 commit 153a3a6

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

phpstan-baseline.neon

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ parameters:
9595
count: 1
9696
path: src/PhpSpreadsheet/Calculation/Calculation.php
9797

98+
-
99+
message: "#^Negated boolean expression is always true\\.$#"
100+
count: 1
101+
path: src/PhpSpreadsheet/Calculation/Calculation.php
102+
98103
-
99104
message: "#^Offset 'type' does not exist on array\\|null\\.$#"
100105
count: 3
@@ -2290,6 +2295,11 @@ parameters:
22902295
count: 1
22912296
path: src/PhpSpreadsheet/Reader/Xls.php
22922297

2298+
-
2299+
message: "#^Right side of && is always true\\.$#"
2300+
count: 1
2301+
path: src/PhpSpreadsheet/Reader/Xls.php
2302+
22932303
-
22942304
message: "#^Unreachable statement \\- code above always terminates\\.$#"
22952305
count: 8
@@ -3000,6 +3010,11 @@ parameters:
30003010
count: 1
30013011
path: src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php
30023012

3013+
-
3014+
message: "#^Right side of && is always true\\.$#"
3015+
count: 1
3016+
path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php
3017+
30033018
-
30043019
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#"
30053020
count: 1
@@ -4197,7 +4212,7 @@ parameters:
41974212

41984213
-
41994214
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
4200-
count: 1
4215+
count: 2
42014216
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
42024217

42034218
-
@@ -5240,11 +5255,6 @@ parameters:
52405255
count: 1
52415256
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
52425257

5243-
-
5244-
message: "#^Negated boolean expression is always false\\.$#"
5245-
count: 1
5246-
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
5247-
52485258
-
52495259
message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int\\|string given\\.$#"
52505260
count: 1
@@ -5285,11 +5295,6 @@ parameters:
52855295
count: 1
52865296
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
52875297

5288-
-
5289-
message: "#^Strict comparison using \\=\\=\\= between false and true will always evaluate to false\\.$#"
5290-
count: 2
5291-
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
5292-
52935298
-
52945299
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Xlfn\\:\\:addXlfn\\(\\) should return string but returns string\\|null\\.$#"
52955300
count: 1

src/PhpSpreadsheet/Worksheet/Worksheet.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,6 +3011,10 @@ public function getHashCode()
30113011
*/
30123012
public static function extractSheetTitle($range, $returnRange = false)
30133013
{
3014+
if ($range === null) {
3015+
return $returnRange ? [null, null] : null;
3016+
}
3017+
30143018
// Sheet title included?
30153019
if (($sep = strrpos($range, '!')) === false) {
30163020
return $returnRange ? ['', $range] : '';

0 commit comments

Comments
 (0)