Phpstan and Xlsx Reader (#3044)

Eliminate most Phpstan messages in Xlsx Reader. In combination with similar changes to Xlsx Writer, baseline will shrink to just over 3,000 lines.
This commit is contained in:
oleibman 2022-09-04 09:45:29 -07:00 committed by GitHub
parent 5f33ec0eea
commit 57a72037b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 109 additions and 510 deletions

View File

@ -1660,456 +1660,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Xls/RC4.php
-
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot access offset 0 on array\\<int, string\\>\\|false\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot access property \\$r on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method addChart\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Comparison operation \"\\>\" between SimpleXMLElement\\|null and 0 results in an error\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has parameter \\$c with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has parameter \\$c with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$c with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$calculatedValue with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$castBaseType with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$cellDataType with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$r with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$sharedFormulas with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$value with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has parameter \\$c with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$add with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$base with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$array with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$key with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getFromZipArchive\\(\\) should return string but returns string\\|false\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$dir with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$docSheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$dir with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$docSheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has parameter \\$style with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$fontSizeInPoints of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:fontSizeToPixels\\(\\) expects int, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, int\\|string given\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$sizeInCm of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:centimeterSizeToPixels\\(\\) expects int, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$sizeInInch of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:inchSizeToPixels\\(\\) expects int, string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, array\\|string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string given\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Xlsx.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$autoFilterRange with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$xmlSheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
-
message: "#^Parameter \\#1 \\$operator of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\\\Column\\\\Rule\\:\\:setRule\\(\\) expects string, null given\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\BaseParserClass\\:\\:boolean\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\BaseParserClass\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredColumn\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredColumn\\(\\) has parameter \\$columnCoordinate with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredRow\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredRow\\(\\) has parameter \\$rowCoordinate with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnAttributes\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnRangeAttributes\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnRangeAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readRowAttributes\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readRowAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readConditionalStyles\\(\\) has parameter \\$xmlSheet with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarExtLstOfConditionalRule\\(\\) has parameter \\$cfRule with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarExtLstOfConditionalRule\\(\\) has parameter \\$conditionalFormattingRuleExtensions with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarOfConditionalRule\\(\\) has parameter \\$cfRule with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarOfConditionalRule\\(\\) has parameter \\$conditionalFormattingRuleExtensions with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has parameter \\$cfRules with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has parameter \\$extLst with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:setConditionalStyles\\(\\) has parameter \\$xmlExtLst with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$dxfs has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\DataValidations\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\DataValidations\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Hyperlinks\\:\\:\\$hyperlinks has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Hyperlinks\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:load\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:pageSetup\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\SheetViewOptions\\:\\:\\$worksheet has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\SheetViewOptions\\:\\:\\$worksheetXml has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#"
count: 1

View File

@ -31,6 +31,7 @@ use PhpOffice\PhpSpreadsheet\Shared\Font;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Font as StyleFont;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
@ -293,7 +294,7 @@ class Xlsx extends BaseReader
return $worksheetInfo;
}
private static function castToBoolean($c)
private static function castToBoolean(SimpleXMLElement $c): bool
{
$value = isset($c->v) ? (string) $c->v : null;
if ($value == '0') {
@ -305,17 +306,21 @@ class Xlsx extends BaseReader
return (bool) $c->v;
}
private static function castToError($c)
private static function castToError(SimpleXMLElement $c): ?string
{
return isset($c->v) ? (string) $c->v : null;
}
private static function castToString($c)
private static function castToString(SimpleXMLElement $c): ?string
{
return isset($c->v) ? (string) $c->v : null;
}
private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType): void
/**
* @param mixed $value
* @param mixed $calculatedValue
*/
private function castToFormula(SimpleXMLElement $c, string $r, string &$cellDataType, &$value, &$calculatedValue, array &$sharedFormulas, string $castBaseType): void
{
$attr = $c->f->attributes();
$cellDataType = 'f';
@ -389,7 +394,7 @@ class Xlsx extends BaseReader
$contents = $archive->getFromName(substr($fileName, 1), 0, ZipArchive::FL_NOCASE);
}
return $contents;
return ($contents === false) ? '' : $contents;
}
/**
@ -1143,7 +1148,7 @@ class Xlsx extends BaseReader
}
// Header/footer images
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->readDataOnly) {
if ($xmlSheet && $xmlSheet->legacyDrawingHF) {
if ($zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) {
$relsWorksheet = $this->loadZipNoNamespace(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels', Namespaces::RELATIONSHIPS);
$vmlRelationship = '';
@ -1550,7 +1555,7 @@ class Xlsx extends BaseReader
break;
case '_xlnm.Print_Area':
$rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) ?: [];
$newRangeSets = [];
foreach ($rangeSets as $rangeSet) {
[, $rangeSet] = Worksheet::extractSheetTitle($rangeSet, true);
@ -1605,7 +1610,7 @@ class Xlsx extends BaseReader
if (strpos((string) $definedName, '!') !== false) {
$range[0] = str_replace("''", "'", $range[0]);
$range[0] = str_replace("'", '', $range[0]);
if ($worksheet = $excel->getSheetByName($range[0])) {
if ($worksheet = $excel->getSheetByName($range[0])) { // @phpstan-ignore-line
$excel->addDefinedName(DefinedName::createInstance((string) $definedName['name'], $worksheet, $extractedRange, true, $scope));
} else {
$excel->addDefinedName(DefinedName::createInstance((string) $definedName['name'], $scope, $extractedRange, true, $scope));
@ -1626,7 +1631,7 @@ class Xlsx extends BaseReader
// Need to split on a comma or a space if not in quotes, and extract the first part.
$definedNameValueParts = preg_split("/[ ,](?=([^']*'[^']*')*[^']*$)/miuU", $definedRange);
// Extract sheet name
[$extractedSheetName] = Worksheet::extractSheetTitle((string) $definedNameValueParts[0], true);
[$extractedSheetName] = Worksheet::extractSheetTitle((string) $definedNameValueParts[0], true); // @phpstan-ignore-line
$extractedSheetName = trim($extractedSheetName, "'");
// Locate sheet
@ -1673,7 +1678,7 @@ class Xlsx extends BaseReader
if (isset($charts[$chartEntryRef])) {
$chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id'];
if (isset($chartDetails[$chartPositionRef])) {
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); // @phpstan-ignore-line
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
// For oneCellAnchor or absoluteAnchor positioned charts,
// toCoordinate is not in the data. Does it need to be calculated?
@ -1721,28 +1726,29 @@ class Xlsx extends BaseReader
if (isset($is->t)) {
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t));
} else {
if (is_object($is->r)) {
if (isset($is->r) && is_object($is->r)) {
/** @var SimpleXMLElement $run */
foreach ($is->r as $run) {
if (!isset($run->rPr)) {
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
} else {
$objText = $value->createTextRun(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
$objFont = $objText->getFont() ?? new StyleFont();
if (isset($run->rPr->rFont)) {
$attr = $run->rPr->rFont->attributes();
if (isset($attr['val'])) {
$objText->getFont()->setName((string) $attr['val']);
$objFont->setName((string) $attr['val']);
}
}
if (isset($run->rPr->sz)) {
$attr = $run->rPr->sz->attributes();
if (isset($attr['val'])) {
$objText->getFont()->setSize((float) $attr['val']);
$objFont->setSize((float) $attr['val']);
}
}
if (isset($run->rPr->color)) {
$objText->getFont()->setColor(new Color($this->styleReader->readColor($run->rPr->color)));
$objFont->setColor(new Color($this->styleReader->readColor($run->rPr->color)));
}
if (isset($run->rPr->b)) {
$attr = $run->rPr->b->attributes();
@ -1750,7 +1756,7 @@ class Xlsx extends BaseReader
(isset($attr['val']) && self::boolean((string) $attr['val'])) ||
(!isset($attr['val']))
) {
$objText->getFont()->setBold(true);
$objFont->setBold(true);
}
}
if (isset($run->rPr->i)) {
@ -1759,7 +1765,7 @@ class Xlsx extends BaseReader
(isset($attr['val']) && self::boolean((string) $attr['val'])) ||
(!isset($attr['val']))
) {
$objText->getFont()->setItalic(true);
$objFont->setItalic(true);
}
}
if (isset($run->rPr->vertAlign)) {
@ -1767,19 +1773,19 @@ class Xlsx extends BaseReader
if (isset($attr['val'])) {
$vertAlign = strtolower((string) $attr['val']);
if ($vertAlign == 'superscript') {
$objText->getFont()->setSuperscript(true);
$objFont->setSuperscript(true);
}
if ($vertAlign == 'subscript') {
$objText->getFont()->setSubscript(true);
$objFont->setSubscript(true);
}
}
}
if (isset($run->rPr->u)) {
$attr = $run->rPr->u->attributes();
if (!isset($attr['val'])) {
$objText->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
$objFont->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
} else {
$objText->getFont()->setUnderline((string) $attr['val']);
$objFont->setUnderline((string) $attr['val']);
}
}
if (isset($run->rPr->strike)) {
@ -1788,7 +1794,7 @@ class Xlsx extends BaseReader
(isset($attr['val']) && self::boolean((string) $attr['val'])) ||
(!isset($attr['val']))
) {
$objText->getFont()->setStrikethrough(true);
$objFont->setStrikethrough(true);
}
}
}
@ -1841,17 +1847,30 @@ class Xlsx extends BaseReader
}
}
/**
* @param null|array|bool|SimpleXMLElement $array
* @param int|string $key
*
* @return mixed
*/
private static function getArrayItem($array, $key = 0)
{
return $array[$key] ?? null;
return ($array === null || is_bool($array)) ? null : ($array[$key] ?? null);
}
/**
* @param null|SimpleXMLElement|string $base
* @param null|SimpleXMLElement|string $add
*/
private static function dirAdd($base, $add): string
{
$base = (string) $base;
$add = (string) $add;
return (string) preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
}
private static function toCSSArray($style): array
private static function toCSSArray(string $style): array
{
$style = self::stripWhiteSpaceFromStyleString($style);
@ -1865,15 +1884,15 @@ class Xlsx extends BaseReader
}
if (strpos($item[1], 'pt') !== false) {
$item[1] = str_replace('pt', '', $item[1]);
$item[1] = Font::fontSizeToPixels($item[1]);
$item[1] = (string) Font::fontSizeToPixels((int) $item[1]);
}
if (strpos($item[1], 'in') !== false) {
$item[1] = str_replace('in', '', $item[1]);
$item[1] = Font::inchSizeToPixels($item[1]);
$item[1] = (string) Font::inchSizeToPixels((int) $item[1]);
}
if (strpos($item[1], 'cm') !== false) {
$item[1] = str_replace('cm', '', $item[1]);
$item[1] = Font::centimeterSizeToPixels($item[1]);
$item[1] = (string) Font::centimeterSizeToPixels((int) $item[1]);
}
$style[$item[0]] = $item[1];
@ -1882,11 +1901,14 @@ class Xlsx extends BaseReader
return $style;
}
public static function stripWhiteSpaceFromStyleString($string): string
public static function stripWhiteSpaceFromStyleString(string $string): string
{
return trim(str_replace(["\r", "\n", ' '], '', $string), ';');
}
/**
* @param mixed $value
*/
private static function boolean($value): bool
{
if (is_object($value)) {
@ -1955,7 +1977,7 @@ class Xlsx extends BaseReader
return $returnValue;
}
private function readFormControlProperties(Spreadsheet $excel, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void
private function readFormControlProperties(Spreadsheet $excel, string $dir, string $fileWorksheet, Worksheet $docSheet, array &$unparsedLoadedData): void
{
$zip = $this->zip;
if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) {
@ -1982,7 +2004,7 @@ class Xlsx extends BaseReader
unset($unparsedCtrlProps);
}
private function readPrinterSettings(Spreadsheet $excel, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData): void
private function readPrinterSettings(Spreadsheet $excel, string $dir, string $fileWorksheet, Worksheet $docSheet, array &$unparsedLoadedData): void
{
$zip = $this->zip;
if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) {
@ -2070,7 +2092,7 @@ class Xlsx extends BaseReader
if ($xmlSheet && $xmlSheet->autoFilter) {
// In older files, autofilter structure is defined in the worksheet file
(new AutoFilter($docSheet, $xmlSheet))->load();
} elseif ($xmlSheet && $xmlSheet->tableParts && $xmlSheet->tableParts['count'] > 0) {
} elseif ($xmlSheet && $xmlSheet->tableParts && (int) $xmlSheet->tableParts['count'] > 0) {
// But for Office365, MS decided to make it all just a bit more complicated
$this->readAutoFilterTablesInTablesFile($xmlSheet, $dir, $fileWorksheet, $zip, $docSheet);
}

View File

@ -9,8 +9,10 @@ use SimpleXMLElement;
class AutoFilter
{
/** @var Worksheet */
private $worksheet;
/** @var SimpleXMLElement */
private $worksheetXml;
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml)
@ -28,7 +30,7 @@ class AutoFilter
}
}
private function readAutoFilter($autoFilterRange, $xmlSheet): void
private function readAutoFilter(string $autoFilterRange, SimpleXMLElement $xmlSheet): void
{
$autoFilter = $this->worksheet->getAutoFilter();
$autoFilter->setRange($autoFilterRange);
@ -39,15 +41,15 @@ class AutoFilter
if ($filterColumn->filters) {
$column->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER);
$filters = $filterColumn->filters;
if ((isset($filters['blank'])) && ($filters['blank'] == 1)) {
if ((isset($filters['blank'])) && ((int) $filters['blank'] == 1)) {
// Operator is undefined, but always treated as EQUAL
$column->createRule()->setRule(null, '')->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER);
$column->createRule()->setRule('', '')->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Standard filters are always an OR join, so no join rule needs to be set
// Entries can be either filter elements
foreach ($filters->filter as $filterRule) {
// Operator is undefined, but always treated as EQUAL
$column->createRule()->setRule(null, (string) $filterRule['val'])->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER);
$column->createRule()->setRule('', (string) $filterRule['val'])->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Or Date Group elements
@ -69,7 +71,7 @@ class AutoFilter
foreach ($filters->dateGroupItem as $dateGroupItem) {
// Operator is undefined, but always treated as EQUAL
$column->createRule()->setRule(
null,
'',
[
'year' => (string) $dateGroupItem['year'],
'month' => (string) $dateGroupItem['month'],
@ -110,7 +112,7 @@ class AutoFilter
foreach ($filterColumn->dynamicFilter as $filterRule) {
// Operator is undefined, but always treated as EQUAL
$column->createRule()->setRule(
null,
'',
(string) $filterRule['val'],
(string) $filterRule['type']
)->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);

View File

@ -4,7 +4,10 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
class BaseParserClass
{
protected static function boolean($value)
/**
* @param mixed $value
*/
protected static function boolean($value): bool
{
if (is_object($value)) {
$value = (string) $value;

View File

@ -10,8 +10,10 @@ use SimpleXMLElement;
class ColumnAndRowAttributes extends BaseParserClass
{
/** @var Worksheet */
private $worksheet;
/** @var ?SimpleXMLElement */
private $worksheetXml;
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
@ -120,7 +122,7 @@ class ColumnAndRowAttributes extends BaseParserClass
}
}
private function isFilteredColumn(IReadFilter $readFilter, $columnCoordinate, array $rowsAttributes)
private function isFilteredColumn(IReadFilter $readFilter, string $columnCoordinate, array $rowsAttributes): bool
{
foreach ($rowsAttributes as $rowCoordinate => $rowAttributes) {
if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) {
@ -131,7 +133,7 @@ class ColumnAndRowAttributes extends BaseParserClass
return false;
}
private function readColumnAttributes(SimpleXMLElement $worksheetCols, $readDataOnly)
private function readColumnAttributes(SimpleXMLElement $worksheetCols, bool $readDataOnly): array
{
$columnAttributes = [];
@ -151,7 +153,7 @@ class ColumnAndRowAttributes extends BaseParserClass
return $columnAttributes;
}
private function readColumnRangeAttributes(SimpleXMLElement $column, $readDataOnly)
private function readColumnRangeAttributes(SimpleXMLElement $column, bool $readDataOnly): array
{
$columnAttributes = [];
@ -172,7 +174,7 @@ class ColumnAndRowAttributes extends BaseParserClass
return $columnAttributes;
}
private function isFilteredRow(IReadFilter $readFilter, $rowCoordinate, array $columnsAttributes)
private function isFilteredRow(IReadFilter $readFilter, int $rowCoordinate, array $columnsAttributes): bool
{
foreach ($columnsAttributes as $columnCoordinate => $columnAttributes) {
if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) {
@ -183,7 +185,7 @@ class ColumnAndRowAttributes extends BaseParserClass
return false;
}
private function readRowAttributes(SimpleXMLElement $worksheetRow, $readDataOnly)
private function readRowAttributes(SimpleXMLElement $worksheetRow, bool $readDataOnly): array
{
$rowAttributes = [];

View File

@ -10,11 +10,14 @@ use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormatValueO
use PhpOffice\PhpSpreadsheet\Style\Style as Style;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use SimpleXMLElement;
use stdClass;
class ConditionalStyles
{
/** @var Worksheet */
private $worksheet;
/** @var SimpleXMLElement */
private $worksheetXml;
/**
@ -22,6 +25,7 @@ class ConditionalStyles
*/
private $ns;
/** @var array */
private $dxfs;
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml, array $dxfs = [])
@ -146,7 +150,7 @@ class ConditionalStyles
return $cfStyle;
}
private function readConditionalStyles($xmlSheet): array
private function readConditionalStyles(SimpleXMLElement $xmlSheet): array
{
$conditionals = [];
foreach ($xmlSheet->conditionalFormatting as $conditional) {
@ -162,7 +166,7 @@ class ConditionalStyles
return $conditionals;
}
private function setConditionalStyles(Worksheet $worksheet, array $conditionals, $xmlExtLst): void
private function setConditionalStyles(Worksheet $worksheet, array $conditionals, SimpleXMLElement $xmlExtLst): void
{
foreach ($conditionals as $cellRangeReference => $cfRules) {
ksort($cfRules);
@ -176,7 +180,7 @@ class ConditionalStyles
}
}
private function readStyleRules($cfRules, $extLst)
private function readStyleRules(array $cfRules, SimpleXMLElement $extLst): array
{
$conditionalFormattingRuleExtensions = ConditionalFormattingRuleExtension::parseExtLstXml($extLst);
$conditionalStyles = [];
@ -213,7 +217,7 @@ class ConditionalStyles
if (isset($cfRule->dataBar)) {
$objConditional->setDataBar(
$this->readDataBarOfConditionalRule($cfRule, $conditionalFormattingRuleExtensions)
$this->readDataBarOfConditionalRule($cfRule, $conditionalFormattingRuleExtensions) // @phpstan-ignore-line
);
} else {
$objConditional->setStyle(clone $this->dxfs[(int) ($cfRule['dxfId'])]);
@ -225,7 +229,10 @@ class ConditionalStyles
return $conditionalStyles;
}
private function readDataBarOfConditionalRule($cfRule, $conditionalFormattingRuleExtensions): ConditionalDataBar
/**
* @param SimpleXMLElement|stdClass $cfRule
*/
private function readDataBarOfConditionalRule($cfRule, array $conditionalFormattingRuleExtensions): ConditionalDataBar
{
$dataBar = new ConditionalDataBar();
//dataBar attribute
@ -257,7 +264,10 @@ class ConditionalStyles
return $dataBar;
}
private function readDataBarExtLstOfConditionalRule(ConditionalDataBar $dataBar, $cfRule, $conditionalFormattingRuleExtensions): void
/**
* @param SimpleXMLElement|stdClass $cfRule
*/
private function readDataBarExtLstOfConditionalRule(ConditionalDataBar $dataBar, $cfRule, array $conditionalFormattingRuleExtensions): void
{
if (isset($cfRule->extLst)) {
$ns = $cfRule->extLst->getNamespaces(true);

View File

@ -8,8 +8,10 @@ use SimpleXMLElement;
class DataValidations
{
/** @var Worksheet */
private $worksheet;
/** @var SimpleXMLElement */
private $worksheetXml;
public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml)
@ -22,7 +24,7 @@ class DataValidations
{
foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) {
// Uppercase coordinate
$range = strtoupper($dataValidation['sqref']);
$range = strtoupper((string) $dataValidation['sqref']);
$rangeSet = explode(' ', $range);
foreach ($rangeSet as $range) {
$stRange = $this->worksheet->shrinkRangeToFit($range);

View File

@ -9,8 +9,10 @@ use SimpleXMLElement;
class Hyperlinks
{
/** @var Worksheet */
private $worksheet;
/** @var array */
private $hyperlinks = [];
public function __construct(Worksheet $workSheet)

View File

@ -8,8 +8,10 @@ use SimpleXMLElement;
class PageSetup extends BaseParserClass
{
/** @var Worksheet */
private $worksheet;
/** @var ?SimpleXMLElement */
private $worksheetXml;
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
@ -18,16 +20,17 @@ class PageSetup extends BaseParserClass
$this->worksheetXml = $worksheetXml;
}
public function load(array $unparsedLoadedData)
public function load(array $unparsedLoadedData): array
{
if (!$this->worksheetXml) {
$worksheetXml = $this->worksheetXml;
if ($worksheetXml === null) {
return $unparsedLoadedData;
}
$this->margins($this->worksheetXml, $this->worksheet);
$unparsedLoadedData = $this->pageSetup($this->worksheetXml, $this->worksheet, $unparsedLoadedData);
$this->headerFooter($this->worksheetXml, $this->worksheet);
$this->pageBreaks($this->worksheetXml, $this->worksheet);
$this->margins($worksheetXml, $this->worksheet);
$unparsedLoadedData = $this->pageSetup($worksheetXml, $this->worksheet, $unparsedLoadedData);
$this->headerFooter($worksheetXml, $this->worksheet);
$this->pageBreaks($worksheetXml, $this->worksheet);
return $unparsedLoadedData;
}
@ -45,7 +48,7 @@ class PageSetup extends BaseParserClass
}
}
private function pageSetup(SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData)
private function pageSetup(SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData): array
{
if ($xmlSheet->pageSetup) {
$docPageSetup = $worksheet->getPageSetup();

View File

@ -7,8 +7,10 @@ use SimpleXMLElement;
class SheetViewOptions extends BaseParserClass
{
/** @var Worksheet */
private $worksheet;
/** @var ?SimpleXMLElement */
private $worksheetXml;
public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml = null)
@ -24,10 +26,11 @@ class SheetViewOptions extends BaseParserClass
}
if (isset($this->worksheetXml->sheetPr)) {
$this->tabColor($this->worksheetXml->sheetPr, $styleReader);
$this->codeName($this->worksheetXml->sheetPr);
$this->outlines($this->worksheetXml->sheetPr);
$this->pageSetup($this->worksheetXml->sheetPr);
$sheetPr = $this->worksheetXml->sheetPr;
$this->tabColor($sheetPr, $styleReader);
$this->codeName($sheetPr);
$this->outlines($sheetPr);
$this->pageSetup($sheetPr);
}
if (isset($this->worksheetXml->sheetFormatPr)) {