Skip to content

Commit e550528

Browse files
authored
Lock our deps with our minimum PHP 7.2, instead of PHP 7.3
1 parent 11f758e commit e550528

File tree

22 files changed

+400
-407
lines changed

22 files changed

+400
-407
lines changed

composer.lock

Lines changed: 253 additions & 244 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan-baseline.neon

Lines changed: 51 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ parameters:
3535
count: 1
3636
path: src/PhpSpreadsheet/Calculation/Calculation.php
3737

38-
-
39-
message: "#^Binary operation \"\\-\" between 0 and string\\|false results in an error\\.$#"
40-
count: 1
41-
path: src/PhpSpreadsheet/Calculation/Calculation.php
42-
4338
-
4439
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:\\$spreadsheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|null\\.$#"
4540
count: 1
@@ -425,11 +420,6 @@ parameters:
425420
count: 1
426421
path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php
427422

428-
-
429-
message: "#^Binary operation \"\\-\" between 1 and float\\|string results in an error\\.$#"
430-
count: 1
431-
path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php
432-
433423
-
434424
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:\\$oneSqrtPi has no typehint specified\\.$#"
435425
count: 1
@@ -445,11 +435,6 @@ parameters:
445435
count: 1
446436
path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php
447437

448-
-
449-
message: "#^Binary operation \"\\-\" between 2 and float\\|string results in an error\\.$#"
450-
count: 1
451-
path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php
452-
453438
-
454439
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, array\\('PhpOffice\\\\\\\\PhpSpreadsheet\\\\\\\\Calculation\\\\\\\\Exception', 'errorHandlerCallback'\\) given\\.$#"
455440
count: 1
@@ -675,11 +660,6 @@ parameters:
675660
count: 1
676661
path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php
677662

678-
-
679-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:MATCH\\(\\) should return int\\|string but returns float\\|int\\.$#"
680-
count: 1
681-
path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php
682-
683663
-
684664
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has no return typehint specified\\.$#"
685665
count: 1
@@ -1005,11 +985,6 @@ parameters:
1005985
count: 1
1006986
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
1007987

1008-
-
1009-
message: "#^Binary operation \"\\-\" between 1 and float\\|string results in an error\\.$#"
1010-
count: 1
1011-
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
1012-
1013988
-
1014989
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has no return typehint specified\\.$#"
1015990
count: 1
@@ -1130,11 +1105,6 @@ parameters:
11301105
count: 1
11311106
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php
11321107

1133-
-
1134-
message: "#^Binary operation \"\\-\" between 1 and float\\|string results in an error\\.$#"
1135-
count: 1
1136-
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php
1137-
11381108
-
11391109
message: "#^Binary operation \"\\-\" between float\\|string and float\\|int\\|\\(string&numeric\\) results in an error\\.$#"
11401110
count: 1
@@ -2355,16 +2325,6 @@ parameters:
23552325
count: 1
23562326
path: src/PhpSpreadsheet/Reader/Xls.php
23572327

2358-
-
2359-
message: "#^Parameter \\#1 \\$pValue of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\:\\:setOffsetX\\(\\) expects int, float\\|int given\\.$#"
2360-
count: 1
2361-
path: src/PhpSpreadsheet/Reader/Xls.php
2362-
2363-
-
2364-
message: "#^Parameter \\#1 \\$pValue of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\:\\:setOffsetY\\(\\) expects int, float\\|int given\\.$#"
2365-
count: 1
2366-
path: src/PhpSpreadsheet/Reader/Xls.php
2367-
23682328
-
23692329
message: "#^Parameter \\#2 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\IReadFilter\\:\\:readCell\\(\\) expects int, string given\\.$#"
23702330
count: 1
@@ -2400,21 +2360,6 @@ parameters:
24002360
count: 1
24012361
path: src/PhpSpreadsheet/Reader/Xls.php
24022362

2403-
-
2404-
message: "#^Parameter \\#2 \\$pos of static method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:getUInt2d\\(\\) expects int, float\\|int given\\.$#"
2405-
count: 1
2406-
path: src/PhpSpreadsheet/Reader/Xls.php
2407-
2408-
-
2409-
message: "#^Parameter \\#2 \\$pos of static method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:getInt4d\\(\\) expects int, float\\|int given\\.$#"
2410-
count: 1
2411-
path: src/PhpSpreadsheet/Reader/Xls.php
2412-
2413-
-
2414-
message: "#^Parameter \\#2 \\$start of function substr expects int, float\\|int given\\.$#"
2415-
count: 5
2416-
path: src/PhpSpreadsheet/Reader/Xls.php
2417-
24182363
-
24192364
message: "#^Parameter \\#1 \\$pValue of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:setShowSummaryBelow\\(\\) expects bool, int given\\.$#"
24202365
count: 1
@@ -2610,11 +2555,6 @@ parameters:
26102555
count: 1
26112556
path: src/PhpSpreadsheet/Reader/Xlsx.php
26122557

2613-
-
2614-
message: "#^Parameter \\#1 \\$is of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:parseRichText\\(\\) expects SimpleXMLElement\\|null, object given\\.$#"
2615-
count: 1
2616-
path: src/PhpSpreadsheet/Reader/Xlsx.php
2617-
26182558
-
26192559
message: "#^Negated boolean expression is always true\\.$#"
26202560
count: 1
@@ -3336,12 +3276,12 @@ parameters:
33363276
path: src/PhpSpreadsheet/Reader/Xml.php
33373277

33383278
-
3339-
message: "#^Parameter \\#2 \\$cmp_function of function uksort expects callable\\(mixed, mixed\\)\\: int, array\\('self', 'cellReverseSort'\\) given\\.$#"
3279+
message: "#^Parameter \\#2 \\$cmp_function of function uksort expects callable\\(\\(int\\|string\\), \\(int\\|string\\)\\)\\: int, array\\('self', 'cellReverseSort'\\) given\\.$#"
33403280
count: 4
33413281
path: src/PhpSpreadsheet/ReferenceHelper.php
33423282

33433283
-
3344-
message: "#^Parameter \\#2 \\$cmp_function of function uksort expects callable\\(mixed, mixed\\)\\: int, array\\('self', 'cellSort'\\) given\\.$#"
3284+
message: "#^Parameter \\#2 \\$cmp_function of function uksort expects callable\\(\\(int\\|string\\), \\(int\\|string\\)\\)\\: int, array\\('self', 'cellSort'\\) given\\.$#"
33453285
count: 4
33463286
path: src/PhpSpreadsheet/ReferenceHelper.php
33473287

@@ -3350,11 +3290,6 @@ parameters:
33503290
count: 1
33513291
path: src/PhpSpreadsheet/ReferenceHelper.php
33523292

3353-
-
3354-
message: "#^Parameter \\#1 \\$columnIndex of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:stringFromColumnIndex\\(\\) expects int, float\\|int given\\.$#"
3355-
count: 1
3356-
path: src/PhpSpreadsheet/ReferenceHelper.php
3357-
33583293
-
33593294
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#"
33603295
count: 1
@@ -5330,11 +5265,6 @@ parameters:
53305265
count: 1
53315266
path: src/PhpSpreadsheet/Writer/Xls.php
53325267

5333-
-
5334-
message: "#^Parameter \\#2 \\$pad_length of function str_pad expects int, float\\|int given\\.$#"
5335-
count: 1
5336-
path: src/PhpSpreadsheet/Writer/Xls.php
5337-
53385268
-
53395269
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\BIFFwriter\\:\\:writeEof\\(\\) has no return typehint specified\\.$#"
53405270
count: 1
@@ -5870,16 +5800,6 @@ parameters:
58705800
count: 1
58715801
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
58725802

5873-
-
5874-
message: "#^Parameter \\#2 \\$pId of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeRelationship\\(\\) expects int, float\\|int given\\.$#"
5875-
count: 1
5876-
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
5877-
5878-
-
5879-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeDrawingHyperLink\\(\\) should return int but returns float\\|int\\.$#"
5880-
count: 1
5881-
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
5882-
58835803
-
58845804
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#"
58855805
count: 1
@@ -6381,22 +6301,62 @@ parameters:
63816301
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
63826302

63836303
-
6384-
message: "#^Cannot access property \\$workbookProtection on SimpleXMLElement\\|false\\.$#"
6385-
count: 3
6304+
message: "#^Cannot access property \\$pageSetup on SimpleXMLElement\\|false\\.$#"
6305+
count: 1
63866306
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
63876307

63886308
-
6389-
message: "#^Cannot access property \\$sheets on SimpleXMLElement\\|false\\.$#"
6390-
count: 2
6309+
message: "#^Cannot access property \\$sheetProtection on SimpleXMLElement\\|false\\.$#"
6310+
count: 5
63916311
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
63926312

63936313
-
6394-
message: "#^Cannot access property \\$pageSetup on SimpleXMLElement\\|false\\.$#"
6314+
message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#"
63956315
count: 1
6396-
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
6316+
path: src/PhpSpreadsheet/Reader/Xml/Properties.php
63976317

63986318
-
6399-
message: "#^Cannot access property \\$sheetProtection on SimpleXMLElement\\|false\\.$#"
6400-
count: 5
6401-
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
6319+
message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#"
6320+
count: 1
6321+
path: src/PhpSpreadsheet/Reader/Xml/Style.php
6322+
6323+
-
6324+
message: "#^Binary operation \"/\" between int\\|string and 360 results in an error\\.$#"
6325+
count: 3
6326+
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
6327+
6328+
-
6329+
message: "#^Binary operation \"/\" between int\\|string and 365 results in an error\\.$#"
6330+
count: 1
6331+
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
6332+
6333+
-
6334+
message: "#^Binary operation \"/\" between int\\|string and \\(float\\|int\\) results in an error\\.$#"
6335+
count: 1
6336+
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
6337+
6338+
-
6339+
message: "#^Binary operation \"/\" between float\\|string and float\\|string results in an error\\.$#"
6340+
count: 2
6341+
path: src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php
6342+
6343+
-
6344+
message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int\\|string results in an error\\.$#"
6345+
count: 2
6346+
path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php
6347+
6348+
-
6349+
message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int results in an error\\.$#"
6350+
count: 1
6351+
path: src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php
6352+
6353+
-
6354+
message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int\\|string results in an error\\.$#"
6355+
count: 1
6356+
path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php
6357+
6358+
-
6359+
message: "#^Offset '(percentage|value)' does not exist on SimpleXMLElement|null\\.$#"
6360+
count: 3
6361+
path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php
64026362

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,9 +3161,9 @@ private static function translateFormula(array $from, array $to, $formula, $from
31613161
return $formula;
31623162
}
31633163

3164-
private static $functionReplaceFromExcel = null;
3164+
private static $functionReplaceFromExcel;
31653165

3166-
private static $functionReplaceToLocale = null;
3166+
private static $functionReplaceToLocale;
31673167

31683168
public function _translateFormulaToLocale($formula)
31693169
{
@@ -3190,9 +3190,9 @@ public function _translateFormulaToLocale($formula)
31903190
return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
31913191
}
31923192

3193-
private static $functionReplaceFromLocale = null;
3193+
private static $functionReplaceFromLocale;
31943194

3195-
private static $functionReplaceToExcel = null;
3195+
private static $functionReplaceToExcel;
31963196

31973197
public function _translateFormulaToEnglish($formula)
31983198
{
@@ -5405,7 +5405,7 @@ private function addDefaultArgumentValues(array $functionCall, array $args, arra
54055405
// Apply any defaults for empty argument values
54065406
foreach ($emptyArguments as $argumentId => $isArgumentEmpty) {
54075407
if ($isArgumentEmpty === true) {
5408-
$reflectedArgumentId = count($args) - $argumentId - 1;
5408+
$reflectedArgumentId = count($args) - (int) $argumentId - 1;
54095409
if (
54105410
!array_key_exists($reflectedArgumentId, $methodArguments) ||
54115411
$methodArguments[$reflectedArgumentId]->isVariadic()

src/PhpSpreadsheet/Calculation/Statistical/Deviations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static function kurtosis(...$args)
103103
*
104104
* @param array ...$args Data Series
105105
*
106-
* @return float|string The result, or a string containing an error
106+
* @return float|int|string The result, or a string containing an error
107107
*/
108108
public static function skew(...$args)
109109
{

src/PhpSpreadsheet/Reader/Gnumeric.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private function processComments(SimpleXMLElement $sheet): void
209209
foreach ($sheet->Objects->children(self::NAMESPACE_GNM) as $key => $comment) {
210210
$commentAttributes = $comment->attributes();
211211
// Only comment objects are handled at the moment
212-
if ($commentAttributes->Text) {
212+
if ($commentAttributes && $commentAttributes->Text) {
213213
$this->spreadsheet->getActiveSheet()->getComment((string) $commentAttributes->ObjectBound)
214214
->setAuthor((string) $commentAttributes->Author)
215215
->setText($this->parseRichText((string) $commentAttributes->Text));

src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public function printInformation(SimpleXMLElement $sheet): self
2424
{
2525
if (isset($sheet->PrintInformation)) {
2626
$printInformation = $sheet->PrintInformation[0];
27+
if (!$printInformation) {
28+
return $this;
29+
}
30+
2731
$scale = (string) $printInformation->Scale->attributes()['percentage'];
2832
$pageOrder = (string) $printInformation->order;
2933
$orientation = (string) $printInformation->orientation;

src/PhpSpreadsheet/Reader/Gnumeric/Properties.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ private function docPropertiesMeta(SimpleXMLElement $officePropertyMeta): void
113113

114114
break;
115115
case 'user-defined':
116-
[, $attrName] = explode(':', $attributes['name']);
117-
$this->userDefinedProperties($attrName, $propertyValue);
116+
if ($attributes) {
117+
[, $attrName] = explode(':', (string) $attributes['name']);
118+
$this->userDefinedProperties($attrName, $propertyValue);
119+
}
118120

119121
break;
120122
}

src/PhpSpreadsheet/Reader/Gnumeric/Styles.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ public function read(SimpleXMLElement $sheet, int $maxRow, int $maxCol): void
101101
private function readStyles(SimpleXMLElement $styleRegion, int $maxRow, int $maxCol): void
102102
{
103103
foreach ($styleRegion as $style) {
104-
if ($style === null) {
105-
continue;
106-
}
107-
108104
$styleAttributes = $style->attributes();
109105
if ($styleAttributes !== null && ($styleAttributes['startRow'] <= $maxRow) && ($styleAttributes['startCol'] <= $maxCol)) {
110106
$cellRange = $this->readStyleRange($styleAttributes, $maxCol, $maxRow);
@@ -114,8 +110,8 @@ private function readStyles(SimpleXMLElement $styleRegion, int $maxRow, int $max
114110
$styleArray = [];
115111
// We still set the number format mask for date/time values, even if readDataOnly is true
116112
// so that we can identify whether a float is a float or a date value
117-
$formatCode = (string) $styleAttributes['Format'];
118-
if (Date::isDateTimeFormatCode($formatCode)) {
113+
$formatCode = $styleAttributes ? (string) $styleAttributes['Format'] : null;
114+
if ($formatCode && Date::isDateTimeFormatCode($formatCode)) {
119115
$styleArray['numberFormat']['formatCode'] = $formatCode;
120116
}
121117
if ($this->readDataOnly === false && $styleAttributes !== null) {
@@ -183,7 +179,7 @@ private static function parseBorderAttributes(?SimpleXMLElement $borderAttribute
183179
$styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes['Color']);
184180
}
185181

186-
self::addStyle($styleArray, 'borderStyle', $borderAttributes['Style']);
182+
self::addStyle($styleArray, 'borderStyle', (string) $borderAttributes['Style']);
187183
}
188184

189185
return $styleArray;
@@ -201,12 +197,12 @@ private static function parseGnumericColour(string $gnmColour): string
201197

202198
private function addColors(array &$styleArray, SimpleXMLElement $styleAttributes): void
203199
{
204-
$RGB = self::parseGnumericColour($styleAttributes['Fore']);
200+
$RGB = self::parseGnumericColour((string) $styleAttributes['Fore']);
205201
$styleArray['font']['color']['rgb'] = $RGB;
206-
$RGB = self::parseGnumericColour($styleAttributes['Back']);
202+
$RGB = self::parseGnumericColour((string) $styleAttributes['Back']);
207203
$shade = (string) $styleAttributes['Shade'];
208204
if (($RGB !== '000000') || ($shade !== '0')) {
209-
$RGB2 = self::parseGnumericColour($styleAttributes['PatternColor']);
205+
$RGB2 = self::parseGnumericColour((string) $styleAttributes['PatternColor']);
210206
if ($shade === '1') {
211207
$styleArray['fill']['startColor']['rgb'] = $RGB;
212208
$styleArray['fill']['endColor']['rgb'] = $RGB2;
@@ -234,8 +230,8 @@ private function readStyleRange(SimpleXMLElement $styleAttributes, int $maxCol,
234230

235231
private function readStyle(array $styleArray, SimpleXMLElement $styleAttributes, SimpleXMLElement $style): array
236232
{
237-
self::addStyle2($styleArray, 'alignment', 'horizontal', $styleAttributes['HAlign']);
238-
self::addStyle2($styleArray, 'alignment', 'vertical', $styleAttributes['VAlign']);
233+
self::addStyle2($styleArray, 'alignment', 'horizontal', (string) $styleAttributes['HAlign']);
234+
self::addStyle2($styleArray, 'alignment', 'vertical', (string) $styleAttributes['VAlign']);
239235
$styleArray['alignment']['wrapText'] = $styleAttributes['WrapText'] == '1';
240236
$styleArray['alignment']['textRotation'] = $this->calcRotation($styleAttributes);
241237
$styleArray['alignment']['shrinkToFit'] = $styleAttributes['ShrinkToFit'] == '1';
@@ -250,7 +246,7 @@ private function readStyle(array $styleArray, SimpleXMLElement $styleAttributes,
250246
$styleArray['font']['bold'] = $fontAttributes['Bold'] == '1';
251247
$styleArray['font']['italic'] = $fontAttributes['Italic'] == '1';
252248
$styleArray['font']['strikethrough'] = $fontAttributes['StrikeThrough'] == '1';
253-
self::addStyle2($styleArray, 'font', 'underline', $fontAttributes['Underline']);
249+
self::addStyle2($styleArray, 'font', 'underline', (string) $fontAttributes['Underline']);
254250

255251
switch ($fontAttributes['Script']) {
256252
case '1':

0 commit comments

Comments
 (0)