Merge branch 'master' into Calculation-Examples

This commit is contained in:
Mark Baker 2022-09-04 22:46:11 +02:00 committed by GitHub
commit 350f38ca60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 366 additions and 914 deletions

View File

@ -1660,456 +1660,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Reader/Xls/RC4.php 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\\.$#" message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#"
count: 1 count: 1
@ -3474,198 +3024,3 @@ parameters:
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:\\$diag is never read, only written\\.$#" message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:\\$diag is never read, only written\\.$#"
count: 1 count: 1
path: src/PhpSpreadsheet/Writer/Xls/Xf.php path: src/PhpSpreadsheet/Writer/Xls/Xf.php
-
message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx.php
-
message: "#^Parameter \\#1 \\$path of function basename expects string, array\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx.php
-
message: "#^Parameter \\#1 \\$path of function dirname expects string, array\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx.php
-
message: "#^Possibly invalid array key type array\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\:\\:\\$pathNames has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/DefinedNames.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$relationship with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$type with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
-
message: "#^Parameter \\#2 \\$id of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeRelationship\\(\\) expects int, string given\\.$#"
count: 5
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
-
message: "#^Parameter \\#4 \\$target of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeRelationship\\(\\) expects string, array\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
-
message: "#^Cannot call method getBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Instanceof between \\*NEVER\\* and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Instanceof between string and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Parameter \\#1 \\$text of method PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText\\:\\:createTextRun\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#"
count: 4
path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php
-
message: "#^Cannot call method getStyle\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Comparison operation \"\\<\" between int\\<min, \\-1\\> and 0 is always true\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$borders of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeBorder\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Borders, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Borders\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$fill of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeFill\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$numberFormat of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeNumFmt\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#"
count: 22
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<1, max\\> given\\.$#"
count: 2
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#"
count: 7
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php
-
message: "#^Result of \\|\\| is always true\\.$#"
count: 1
path: src/PhpSpreadsheet/Writer/Xlsx/Style.php

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart\Axis; use PhpOffice\PhpSpreadsheet\Chart\Axis as ChartAxis;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor; use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
@ -121,12 +121,12 @@ $dataSeriesValues[2] // triangle border
$dataSeriesValues[2]->setScatterLines(false); // points not connected $dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers // Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis(); $xAxis = new ChartAxis();
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE ); //$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true); $xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
$xAxis->setAxisOption('textRotation', '45'); $xAxis->setAxisOption('textRotation', '45');
$yAxis = new Axis(); $yAxis = new ChartAxis();
$yAxis->setLineStyleProperties( $yAxis->setLineStyleProperties(
2.5, // width in points 2.5, // width in points
Properties::LINE_STYLE_COMPOUND_SIMPLE, Properties::LINE_STYLE_COMPOUND_SIMPLE,

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart\Axis; use PhpOffice\PhpSpreadsheet\Chart\Axis as ChartAxis;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor; use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
@ -121,13 +121,13 @@ $dataSeriesValues[2] // triangle border
$dataSeriesValues[2]->setScatterLines(false); // points not connected $dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers // Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis(); $xAxis = new ChartAxis();
//$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE ); //$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE );
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true); $xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
$xAxis->setAxisOption('textRotation', '45'); $xAxis->setAxisOption('textRotation', '45');
$xAxis->setAxisOption('hidden', '1'); $xAxis->setAxisOption('hidden', '1');
$yAxis = new Axis(); $yAxis = new ChartAxis();
$yAxis->setLineStyleProperties( $yAxis->setLineStyleProperties(
2.5, // width in points 2.5, // width in points
Properties::LINE_STYLE_COMPOUND_SIMPLE, Properties::LINE_STYLE_COMPOUND_SIMPLE,

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart\Axis; use PhpOffice\PhpSpreadsheet\Chart\Axis as ChartAxis;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor; use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
@ -77,10 +77,10 @@ $dataSeriesValues = [
// marker details // marker details
$dataSeriesValues[0] $dataSeriesValues[0]
->getMarkerFillColor() ->getMarkerFillColor()
->setColorProperties('0070C0', null, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setColorProperties('0070C0', null, ChartColor::EXCEL_COLOR_TYPE_RGB);
$dataSeriesValues[0] $dataSeriesValues[0]
->getMarkerBorderColor() ->getMarkerBorderColor()
->setColorProperties('002060', null, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setColorProperties('002060', null, ChartColor::EXCEL_COLOR_TYPE_RGB);
// line details - dashed, smooth line (Bezier) with arrows, 40% transparent // line details - dashed, smooth line (Bezier) with arrows, 40% transparent
$dataSeriesValues[0] $dataSeriesValues[0]
@ -105,24 +105,24 @@ $dataSeriesValues[1] // square marker border color
->setColorProperties('accent6', 3, ChartColor::EXCEL_COLOR_TYPE_SCHEME); ->setColorProperties('accent6', 3, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[1] // square marker fill color $dataSeriesValues[1] // square marker fill color
->getMarkerFillColor() ->getMarkerFillColor()
->setColorProperties('0FFF00', null, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setColorProperties('0FFF00', null, ChartColor::EXCEL_COLOR_TYPE_RGB);
$dataSeriesValues[1] $dataSeriesValues[1]
->setScatterLines(true) ->setScatterLines(true)
->setSmoothLine(false) ->setSmoothLine(false)
->setLineColorProperties('FF0000', 80, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setLineColorProperties('FF0000', 80, ChartColor::EXCEL_COLOR_TYPE_RGB);
$dataSeriesValues[1]->setLineWidth(2.0); $dataSeriesValues[1]->setLineWidth(2.0);
// series 3 - metric3, markers, no line // series 3 - metric3, markers, no line
$dataSeriesValues[2] // triangle? fill $dataSeriesValues[2] // triangle? fill
//->setPointMarker('triangle') // let Excel choose shape, which is predicted to be a triangle //->setPointMarker('triangle') // let Excel choose shape, which is predicted to be a triangle
->getMarkerFillColor() ->getMarkerFillColor()
->setColorProperties('FFFF00', null, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setColorProperties('FFFF00', null, ChartColor::EXCEL_COLOR_TYPE_RGB);
$dataSeriesValues[2] // triangle border $dataSeriesValues[2] // triangle border
->getMarkerBorderColor() ->getMarkerBorderColor()
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME); ->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[2]->setScatterLines(false); // points not connected $dataSeriesValues[2]->setScatterLines(false); // points not connected
// Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers // Added so that Xaxis shows dates instead of Excel-equivalent-year1900-numbers
$xAxis = new Axis(); $xAxis = new ChartAxis();
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true); $xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601, true);
// Build the dataseries // Build the dataseries
@ -204,7 +204,7 @@ $dataSeriesValues[0]->setTrendLines($trendLines);
$dataSeriesValues[0]->setScatterLines(false); // points not connected $dataSeriesValues[0]->setScatterLines(false); // points not connected
$dataSeriesValues[0]->getMarkerFillColor() $dataSeriesValues[0]->getMarkerFillColor()
->setColorProperties('FFFF00', null, ChartColor::EXCEL_COLOR_TYPE_ARGB); ->setColorProperties('FFFF00', null, ChartColor::EXCEL_COLOR_TYPE_RGB);
$dataSeriesValues[0]->getMarkerBorderColor() $dataSeriesValues[0]->getMarkerBorderColor()
->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME); ->setColorProperties('accent4', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
@ -218,7 +218,7 @@ $dataSeriesValues[0]->getTrendLines()[1]->setLineStyleProperties(1.25);
$dataSeriesValues[0]->getTrendLines()[2]->getLineColor()->setColorProperties('accent2', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME); $dataSeriesValues[0]->getTrendLines()[2]->getLineColor()->setColorProperties('accent2', null, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$dataSeriesValues[0]->getTrendLines()[2]->setLineStyleProperties(1.5, null, null, null, null, null, null, Properties::LINE_STYLE_ARROW_TYPE_OPEN, 8); $dataSeriesValues[0]->getTrendLines()[2]->setLineStyleProperties(1.5, null, null, null, null, null, null, Properties::LINE_STYLE_ARROW_TYPE_OPEN, 8);
$xAxis = new Axis(); $xAxis = new ChartAxis();
$xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601); // m/d/yyyy $xAxis->setAxisNumberProperties(Properties::FORMAT_CODE_DATE_ISO8601); // m/d/yyyy
// Build the dataseries // Build the dataseries

View File

@ -324,13 +324,13 @@ class DataSeriesValues extends Properties
if (is_array($this->fillColor)) { if (is_array($this->fillColor)) {
$array = []; $array = [];
foreach ($this->fillColor as $chartColor) { foreach ($this->fillColor as $chartColor) {
$array[] = self::chartColorToString($chartColor); $array[] = $this->chartColorToString($chartColor);
} }
return $array; return $array;
} }
return self::chartColorToString($this->fillColor); return $this->chartColorToString($this->fillColor);
} }
/** /**
@ -348,13 +348,13 @@ class DataSeriesValues extends Properties
if ($fillString instanceof ChartColor) { if ($fillString instanceof ChartColor) {
$this->fillColor[] = $fillString; $this->fillColor[] = $fillString;
} else { } else {
$this->fillColor[] = self::stringToChartColor($fillString); $this->fillColor[] = $this->stringToChartColor($fillString);
} }
} }
} elseif ($color instanceof ChartColor) { } elseif ($color instanceof ChartColor) {
$this->fillColor = $color; $this->fillColor = $color;
} elseif (is_string($color)) { } else {
$this->fillColor = self::stringToChartColor($color); $this->fillColor = $this->stringToChartColor($color);
} }
return $this; return $this;

View File

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

View File

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

View File

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

View File

@ -311,7 +311,7 @@ class Chart
break; break;
case 'stockChart': case 'stockChart':
$plotSeries[] = $this->chartDataSeries($chartDetail, $chartDetailKey); $plotSeries[] = $this->chartDataSeries($chartDetail, $chartDetailKey);
$plotAttributes = $this->readChartAttributes($plotAreaLayout); $plotAttributes = $this->readChartAttributes($chartDetail);
break; break;
} }
@ -1068,7 +1068,7 @@ class Chart
} }
/** /**
* @param null|Layout|SimpleXMLElement $chartDetail * @param ?SimpleXMLElement $chartDetail
*/ */
private function readChartAttributes($chartDetail): array private function readChartAttributes($chartDetail): array
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -349,7 +349,7 @@ class Font
// Special case if there are one or more newline characters ("\n") // Special case if there are one or more newline characters ("\n")
$cellText = $cellText ?? ''; $cellText = $cellText ?? '';
if (strpos($cellText, "\n") !== false) { if (strpos(/** @scrutinizer ignore-type */ $cellText, "\n") !== false) {
$lineTexts = explode("\n", $cellText); $lineTexts = explode("\n", $cellText);
$lineWidths = []; $lineWidths = [];
foreach ($lineTexts as $lineText) { foreach ($lineTexts as $lineText) {

View File

@ -337,9 +337,19 @@ class StringHelper
mb_substitute_character(65533); // Unicode substitution character mb_substitute_character(65533); // Unicode substitution character
// Phpstan does not think this can return false. // Phpstan does not think this can return false.
$returnValue = mb_convert_encoding($textValue, 'UTF-8', 'UTF-8'); $returnValue = mb_convert_encoding($textValue, 'UTF-8', 'UTF-8');
mb_substitute_character($subst); mb_substitute_character(/** @scrutinizer ignore-type */ $subst);
return $returnValue; return self::returnString($returnValue);
}
/**
* Strictly to satisfy Scrutinizer.
*
* @param mixed $value
*/
private static function returnString($value): string
{
return is_string($value) ? $value : '';
} }
/** /**
@ -433,7 +443,7 @@ class StringHelper
} }
} }
return mb_convert_encoding($textValue, $to, $from); return self::returnString(mb_convert_encoding($textValue, $to, $from));
} }
/** /**

View File

@ -743,14 +743,14 @@ class Font extends Supervisor
private function hashChartColor(?ChartColor $underlineColor): string private function hashChartColor(?ChartColor $underlineColor): string
{ {
if ($this->underlineColor === null) { if ($underlineColor === null) {
return ''; return '';
} }
return return
$this->underlineColor->getValue() $underlineColor->getValue()
. $this->underlineColor->getType() . $underlineColor->getType()
. (string) $this->underlineColor->getAlpha(); . (string) $underlineColor->getAlpha();
} }
/** /**

View File

@ -33,9 +33,6 @@ class Dompdf extends Pdf
{ {
$fileHandle = parent::prepareForSave($filename); $fileHandle = parent::prepareForSave($filename);
// Default PDF paper size
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation // Check for paper size and page orientation
$setup = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageSetup(); $setup = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageSetup();
$orientation = $this->getOrientation() ?? $setup->getOrientation(); $orientation = $this->getOrientation() ?? $setup->getOrientation();

View File

@ -349,12 +349,15 @@ class Xlsx extends BaseWriter
//a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels) //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
if ($this->spreadSheet->hasRibbon()) { if ($this->spreadSheet->hasRibbon()) {
$tmpRibbonTarget = $this->spreadSheet->getRibbonXMLData('target'); $tmpRibbonTarget = $this->spreadSheet->getRibbonXMLData('target');
$tmpRibbonTarget = is_string($tmpRibbonTarget) ? $tmpRibbonTarget : '';
$zipContent[$tmpRibbonTarget] = $this->spreadSheet->getRibbonXMLData('data'); $zipContent[$tmpRibbonTarget] = $this->spreadSheet->getRibbonXMLData('data');
if ($this->spreadSheet->hasRibbonBinObjects()) { if ($this->spreadSheet->hasRibbonBinObjects()) {
$tmpRootPath = dirname($tmpRibbonTarget) . '/'; $tmpRootPath = dirname($tmpRibbonTarget) . '/';
$ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write
foreach ($ribbonBinObjects as $aPath => $aContent) { if (is_array($ribbonBinObjects)) {
$zipContent[$tmpRootPath . $aPath] = $aContent; foreach ($ribbonBinObjects as $aPath => $aContent) {
$zipContent[$tmpRootPath . $aPath] = $aContent;
}
} }
//the rels for files //the rels for files
$zipContent[$tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels'] = $this->getWriterPartRelsRibbon()->writeRibbonRelationships($this->spreadSheet); $zipContent[$tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels'] = $this->getWriterPartRelsRibbon()->writeRibbonRelationships($this->spreadSheet);
@ -684,6 +687,7 @@ class Xlsx extends BaseWriter
return $this; return $this;
} }
/** @var array */
private $pathNames = []; private $pathNames = [];
private function addZipFile(string $path, string $content): void private function addZipFile(string $path, string $content): void

View File

@ -233,8 +233,6 @@ class Chart extends WriterPart
if ($plotArea === null) { if ($plotArea === null) {
return; return;
} }
$majorGridlines = ($yAxis === null) ? null : $yAxis->getMajorGridlines();
$minorGridlines = ($yAxis === null) ? null : $yAxis->getMinorGridlines();
$id1 = $id2 = $id3 = '0'; $id1 = $id2 = $id3 = '0';
$this->seriesIndex = 0; $this->seriesIndex = 0;
@ -1163,7 +1161,6 @@ class Chart extends WriterPart
$intercept = $trendLine->getIntercept(); $intercept = $trendLine->getIntercept();
$name = $trendLine->getName(); $name = $trendLine->getName();
$trendLineColor = $trendLine->getLineColor(); // ChartColor $trendLineColor = $trendLine->getLineColor(); // ChartColor
$trendLineWidth = $trendLine->getLineStyleProperty('width');
$objWriter->startElement('c:trendline'); // N.B. lowercase 'ell' $objWriter->startElement('c:trendline'); // N.B. lowercase 'ell'
if ($name !== '') { if ($name !== '') {

View File

@ -118,7 +118,7 @@ class DefinedNames
$range[1] = Coordinate::absoluteCoordinate($range[1]); $range[1] = Coordinate::absoluteCoordinate($range[1]);
$range = implode(':', $range); $range = implode(':', $range);
$this->objWriter->writeRawData('\'' . str_replace("'", "''", $worksheet->getTitle() ?? '') . '\'!' . $range); $this->objWriter->writeRawData('\'' . str_replace("'", "''", $worksheet->getTitle()) . '\'!' . $range);
$this->objWriter->endElement(); $this->objWriter->endElement();
} }

View File

@ -67,12 +67,13 @@ class Rels extends WriterPart
'xl/workbook.xml' 'xl/workbook.xml'
); );
// a custom UI in workbook ? // a custom UI in workbook ?
$target = $spreadsheet->getRibbonXMLData('target');
if ($spreadsheet->hasRibbon()) { if ($spreadsheet->hasRibbon()) {
$this->writeRelationShip( $this->writeRelationShip(
$objWriter, $objWriter,
5, 5,
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility', 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
$spreadsheet->getRibbonXMLData('target') is_string($target) ? $target : ''
); );
} }
@ -284,7 +285,7 @@ class Rels extends WriterPart
return $objWriter->getData(); return $objWriter->getData();
} }
private function writeUnparsedRelationship(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet, XMLWriter $objWriter, $relationship, $type): void private function writeUnparsedRelationship(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet, XMLWriter $objWriter, string $relationship, string $type): void
{ {
$unparsedLoadedData = $worksheet->getParent()->getUnparsedLoadedData(); $unparsedLoadedData = $worksheet->getParent()->getUnparsedLoadedData();
if (!isset($unparsedLoadedData['sheets'][$worksheet->getCodeName()][$relationship])) { if (!isset($unparsedLoadedData['sheets'][$worksheet->getCodeName()][$relationship])) {
@ -448,7 +449,7 @@ class Rels extends WriterPart
/** /**
* Write Override content type. * Write Override content type.
* *
* @param int $id Relationship ID. rId will be prepended! * @param int|string $id Relationship ID. rId will be prepended!
* @param string $type Relationship type * @param string $type Relationship type
* @param string $target Relationship target * @param string $target Relationship target
* @param string $targetMode Relationship target mode * @param string $targetMode Relationship target mode

View File

@ -66,7 +66,7 @@ class StringTable extends WriterPart
/** /**
* Write string table to XML format. * Write string table to XML format.
* *
* @param string[] $stringTable * @param (string|RichText)[] $stringTable
* *
* @return string XML Output * @return string XML Output
*/ */
@ -86,13 +86,13 @@ class StringTable extends WriterPart
// String table // String table
$objWriter->startElement('sst'); $objWriter->startElement('sst');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
$objWriter->writeAttribute('uniqueCount', count($stringTable)); $objWriter->writeAttribute('uniqueCount', (string) count($stringTable));
// Loop through string table // Loop through string table
foreach ($stringTable as $textElement) { foreach ($stringTable as $textElement) {
$objWriter->startElement('si'); $objWriter->startElement('si');
if (!$textElement instanceof RichText) { if (!($textElement instanceof RichText)) {
$textToWrite = StringHelper::controlCharacterPHP2OOXML($textElement); $textToWrite = StringHelper::controlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t'); $objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) { if ($textToWrite !== trim($textToWrite)) {
@ -100,7 +100,7 @@ class StringTable extends WriterPart
} }
$objWriter->writeRawData($textToWrite); $objWriter->writeRawData($textToWrite);
$objWriter->endElement(); $objWriter->endElement();
} elseif ($textElement instanceof RichText) { } else {
$this->writeRichText($objWriter, $textElement); $this->writeRichText($objWriter, $textElement);
} }
@ -130,14 +130,16 @@ class StringTable extends WriterPart
$objWriter->startElement($prefix . 'r'); $objWriter->startElement($prefix . 'r');
// rPr // rPr
if ($element instanceof Run) { if ($element instanceof Run && $element->getFont() !== null) {
// rPr // rPr
$objWriter->startElement($prefix . 'rPr'); $objWriter->startElement($prefix . 'rPr');
// rFont // rFont
$objWriter->startElement($prefix . 'rFont'); if ($element->getFont()->getName() !== null) {
$objWriter->writeAttribute('val', $element->getFont()->getName()); $objWriter->startElement($prefix . 'rFont');
$objWriter->endElement(); $objWriter->writeAttribute('val', $element->getFont()->getName());
$objWriter->endElement();
}
// Bold // Bold
$objWriter->startElement($prefix . 'b'); $objWriter->startElement($prefix . 'b');
@ -166,19 +168,25 @@ class StringTable extends WriterPart
$objWriter->endElement(); $objWriter->endElement();
// Color // Color
$objWriter->startElement($prefix . 'color'); if ($element->getFont()->getColor()->getARGB() !== null) {
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB()); $objWriter->startElement($prefix . 'color');
$objWriter->endElement(); $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
$objWriter->endElement();
}
// Size // Size
$objWriter->startElement($prefix . 'sz'); if ($element->getFont()->getSize() !== null) {
$objWriter->writeAttribute('val', $element->getFont()->getSize()); $objWriter->startElement($prefix . 'sz');
$objWriter->endElement(); $objWriter->writeAttribute('val', (string) $element->getFont()->getSize());
$objWriter->endElement();
}
// Underline // Underline
$objWriter->startElement($prefix . 'u'); if ($element->getFont()->getUnderline() !== null) {
$objWriter->writeAttribute('val', $element->getFont()->getUnderline()); $objWriter->startElement($prefix . 'u');
$objWriter->endElement(); $objWriter->writeAttribute('val', $element->getFont()->getUnderline());
$objWriter->endElement();
}
$objWriter->endElement(); $objWriter->endElement();
} }
@ -201,10 +209,10 @@ class StringTable extends WriterPart
*/ */
public function writeRichTextForCharts(XMLWriter $objWriter, $richText = null, $prefix = ''): void public function writeRichTextForCharts(XMLWriter $objWriter, $richText = null, $prefix = ''): void
{ {
if (!$richText instanceof RichText) { if (!($richText instanceof RichText)) {
$textRun = $richText; $textRun = $richText;
$richText = new RichText(); $richText = new RichText();
$run = $richText->createTextRun($textRun); $run = $richText->createTextRun($textRun ?? '');
$run->setFont(null); $run->setFont(null);
} }
@ -226,9 +234,9 @@ class StringTable extends WriterPart
} }
// Bold // Bold
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0)); $objWriter->writeAttribute('b', ($element->getFont()->getBold() ? '1' : '0'));
// Italic // Italic
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0)); $objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? '1' : '0'));
// Underline // Underline
$underlineType = $element->getFont()->getUnderline(); $underlineType = $element->getFont()->getUnderline();
switch ($underlineType) { switch ($underlineType) {
@ -241,7 +249,9 @@ class StringTable extends WriterPart
break; break;
} }
$objWriter->writeAttribute('u', $underlineType); if ($underlineType !== null) {
$objWriter->writeAttribute('u', $underlineType);
}
// Strikethrough // Strikethrough
$objWriter->writeAttribute('strike', ($element->getFont()->getStriketype() ?: 'noStrike')); $objWriter->writeAttribute('strike', ($element->getFont()->getStriketype() ?: 'noStrike'));
// Superscript/subscript // Superscript/subscript

View File

@ -40,7 +40,7 @@ class Style extends WriterPart
// numFmts // numFmts
$objWriter->startElement('numFmts'); $objWriter->startElement('numFmts');
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count()); $objWriter->writeAttribute('count', (string) $this->getParentWriter()->getNumFmtHashTable()->count());
// numFmt // numFmt
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
@ -51,54 +51,63 @@ class Style extends WriterPart
// fonts // fonts
$objWriter->startElement('fonts'); $objWriter->startElement('fonts');
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count()); $objWriter->writeAttribute('count', (string) $this->getParentWriter()->getFontHashTable()->count());
// font // font
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
$this->writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i)); $thisfont = $this->getParentWriter()->getFontHashTable()->getByIndex($i);
if ($thisfont !== null) {
$this->writeFont($objWriter, $thisfont);
}
} }
$objWriter->endElement(); $objWriter->endElement();
// fills // fills
$objWriter->startElement('fills'); $objWriter->startElement('fills');
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count()); $objWriter->writeAttribute('count', (string) $this->getParentWriter()->getFillHashTable()->count());
// fill // fill
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
$this->writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i)); $thisfill = $this->getParentWriter()->getFillHashTable()->getByIndex($i);
if ($thisfill !== null) {
$this->writeFill($objWriter, $thisfill);
}
} }
$objWriter->endElement(); $objWriter->endElement();
// borders // borders
$objWriter->startElement('borders'); $objWriter->startElement('borders');
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count()); $objWriter->writeAttribute('count', (string) $this->getParentWriter()->getBordersHashTable()->count());
// border // border
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
$this->writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i)); $thisborder = $this->getParentWriter()->getBordersHashTable()->getByIndex($i);
if ($thisborder !== null) {
$this->writeBorder($objWriter, $thisborder);
}
} }
$objWriter->endElement(); $objWriter->endElement();
// cellStyleXfs // cellStyleXfs
$objWriter->startElement('cellStyleXfs'); $objWriter->startElement('cellStyleXfs');
$objWriter->writeAttribute('count', 1); $objWriter->writeAttribute('count', '1');
// xf // xf
$objWriter->startElement('xf'); $objWriter->startElement('xf');
$objWriter->writeAttribute('numFmtId', 0); $objWriter->writeAttribute('numFmtId', '0');
$objWriter->writeAttribute('fontId', 0); $objWriter->writeAttribute('fontId', '0');
$objWriter->writeAttribute('fillId', 0); $objWriter->writeAttribute('fillId', '0');
$objWriter->writeAttribute('borderId', 0); $objWriter->writeAttribute('borderId', '0');
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
// cellXfs // cellXfs
$objWriter->startElement('cellXfs'); $objWriter->startElement('cellXfs');
$objWriter->writeAttribute('count', count($spreadsheet->getCellXfCollection())); $objWriter->writeAttribute('count', (string) count($spreadsheet->getCellXfCollection()));
// xf // xf
foreach ($spreadsheet->getCellXfCollection() as $cellXf) { foreach ($spreadsheet->getCellXfCollection() as $cellXf) {
@ -109,24 +118,27 @@ class Style extends WriterPart
// cellStyles // cellStyles
$objWriter->startElement('cellStyles'); $objWriter->startElement('cellStyles');
$objWriter->writeAttribute('count', 1); $objWriter->writeAttribute('count', '1');
// cellStyle // cellStyle
$objWriter->startElement('cellStyle'); $objWriter->startElement('cellStyle');
$objWriter->writeAttribute('name', 'Normal'); $objWriter->writeAttribute('name', 'Normal');
$objWriter->writeAttribute('xfId', 0); $objWriter->writeAttribute('xfId', '0');
$objWriter->writeAttribute('builtinId', 0); $objWriter->writeAttribute('builtinId', '0');
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
// dxfs // dxfs
$objWriter->startElement('dxfs'); $objWriter->startElement('dxfs');
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count()); $objWriter->writeAttribute('count', (string) $this->getParentWriter()->getStylesConditionalHashTable()->count());
// dxf // dxf
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
$this->writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle()); $thisstyle = $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i);
if ($thisstyle !== null) {
$this->writeCellStyleDxf($objWriter, $thisstyle->getStyle());
}
} }
$objWriter->endElement(); $objWriter->endElement();
@ -171,17 +183,19 @@ class Style extends WriterPart
// gradientFill // gradientFill
$objWriter->startElement('gradientFill'); $objWriter->startElement('gradientFill');
$objWriter->writeAttribute('type', $fill->getFillType()); $objWriter->writeAttribute('type', (string) $fill->getFillType());
$objWriter->writeAttribute('degree', $fill->getRotation()); $objWriter->writeAttribute('degree', (string) $fill->getRotation());
// stop // stop
$objWriter->startElement('stop'); $objWriter->startElement('stop');
$objWriter->writeAttribute('position', '0'); $objWriter->writeAttribute('position', '0');
// color // color
$objWriter->startElement('color'); if ($fill->getStartColor()->getARGB() !== null) {
$objWriter->writeAttribute('rgb', $fill->getStartColor()->getARGB()); $objWriter->startElement('color');
$objWriter->endElement(); $objWriter->writeAttribute('rgb', $fill->getStartColor()->getARGB());
$objWriter->endElement();
}
$objWriter->endElement(); $objWriter->endElement();
@ -190,9 +204,11 @@ class Style extends WriterPart
$objWriter->writeAttribute('position', '1'); $objWriter->writeAttribute('position', '1');
// color // color
$objWriter->startElement('color'); if ($fill->getEndColor()->getARGB() !== null) {
$objWriter->writeAttribute('rgb', $fill->getEndColor()->getARGB()); $objWriter->startElement('color');
$objWriter->endElement(); $objWriter->writeAttribute('rgb', $fill->getEndColor()->getARGB());
$objWriter->endElement();
}
$objWriter->endElement(); $objWriter->endElement();
@ -220,7 +236,7 @@ class Style extends WriterPart
// patternFill // patternFill
$objWriter->startElement('patternFill'); $objWriter->startElement('patternFill');
$objWriter->writeAttribute('patternType', $fill->getFillType()); $objWriter->writeAttribute('patternType', (string) $fill->getFillType());
if (self::writePatternColors($fill)) { if (self::writePatternColors($fill)) {
// fgColor // fgColor
@ -360,20 +376,20 @@ class Style extends WriterPart
{ {
// xf // xf
$objWriter->startElement('xf'); $objWriter->startElement('xf');
$objWriter->writeAttribute('xfId', 0); $objWriter->writeAttribute('xfId', '0');
$objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($style->getFont()->getHashCode())); $objWriter->writeAttribute('fontId', (string) (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($style->getFont()->getHashCode()));
if ($style->getQuotePrefix()) { if ($style->getQuotePrefix()) {
$objWriter->writeAttribute('quotePrefix', 1); $objWriter->writeAttribute('quotePrefix', '1');
} }
if ($style->getNumberFormat()->getBuiltInFormatCode() === false) { if ($style->getNumberFormat()->getBuiltInFormatCode() === false) {
$objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($style->getNumberFormat()->getHashCode()) + 164)); $objWriter->writeAttribute('numFmtId', (string) (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($style->getNumberFormat()->getHashCode()) + 164));
} else { } else {
$objWriter->writeAttribute('numFmtId', (int) $style->getNumberFormat()->getBuiltInFormatCode()); $objWriter->writeAttribute('numFmtId', (string) (int) $style->getNumberFormat()->getBuiltInFormatCode());
} }
$objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($style->getFill()->getHashCode())); $objWriter->writeAttribute('fillId', (string) (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($style->getFill()->getHashCode()));
$objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($style->getBorders()->getHashCode())); $objWriter->writeAttribute('borderId', (string) (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($style->getBorders()->getHashCode()));
// Apply styles? // Apply styles?
$objWriter->writeAttribute('applyFont', ($spreadsheet->getDefaultStyle()->getFont()->getHashCode() != $style->getFont()->getHashCode()) ? '1' : '0'); $objWriter->writeAttribute('applyFont', ($spreadsheet->getDefaultStyle()->getFont()->getHashCode() != $style->getFont()->getHashCode()) ? '1' : '0');
@ -387,25 +403,25 @@ class Style extends WriterPart
// alignment // alignment
$objWriter->startElement('alignment'); $objWriter->startElement('alignment');
$objWriter->writeAttribute('horizontal', $style->getAlignment()->getHorizontal()); $objWriter->writeAttribute('horizontal', (string) $style->getAlignment()->getHorizontal());
$objWriter->writeAttribute('vertical', $style->getAlignment()->getVertical()); $objWriter->writeAttribute('vertical', (string) $style->getAlignment()->getVertical());
$textRotation = 0; $textRotation = 0;
if ($style->getAlignment()->getTextRotation() >= 0) { if ($style->getAlignment()->getTextRotation() >= 0) {
$textRotation = $style->getAlignment()->getTextRotation(); $textRotation = $style->getAlignment()->getTextRotation();
} elseif ($style->getAlignment()->getTextRotation() < 0) { } else {
$textRotation = 90 - $style->getAlignment()->getTextRotation(); $textRotation = 90 - $style->getAlignment()->getTextRotation();
} }
$objWriter->writeAttribute('textRotation', $textRotation); $objWriter->writeAttribute('textRotation', (string) $textRotation);
$objWriter->writeAttribute('wrapText', ($style->getAlignment()->getWrapText() ? 'true' : 'false')); $objWriter->writeAttribute('wrapText', ($style->getAlignment()->getWrapText() ? 'true' : 'false'));
$objWriter->writeAttribute('shrinkToFit', ($style->getAlignment()->getShrinkToFit() ? 'true' : 'false')); $objWriter->writeAttribute('shrinkToFit', ($style->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
if ($style->getAlignment()->getIndent() > 0) { if ($style->getAlignment()->getIndent() > 0) {
$objWriter->writeAttribute('indent', $style->getAlignment()->getIndent()); $objWriter->writeAttribute('indent', (string) $style->getAlignment()->getIndent());
} }
if ($style->getAlignment()->getReadOrder() > 0) { if ($style->getAlignment()->getReadOrder() > 0) {
$objWriter->writeAttribute('readingOrder', $style->getAlignment()->getReadOrder()); $objWriter->writeAttribute('readingOrder', (string) $style->getAlignment()->getReadOrder());
} }
$objWriter->endElement(); $objWriter->endElement();
@ -454,10 +470,10 @@ class Style extends WriterPart
$textRotation = 0; $textRotation = 0;
if ($style->getAlignment()->getTextRotation() >= 0) { if ($style->getAlignment()->getTextRotation() >= 0) {
$textRotation = $style->getAlignment()->getTextRotation(); $textRotation = $style->getAlignment()->getTextRotation();
} elseif ($style->getAlignment()->getTextRotation() < 0) { } else {
$textRotation = 90 - $style->getAlignment()->getTextRotation(); $textRotation = 90 - $style->getAlignment()->getTextRotation();
} }
$objWriter->writeAttribute('textRotation', $textRotation); $objWriter->writeAttribute('textRotation', (string) $textRotation);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -465,7 +481,7 @@ class Style extends WriterPart
$this->writeBorder($objWriter, $style->getBorders()); $this->writeBorder($objWriter, $style->getBorders());
// protection // protection
if (($style->getProtection()->getLocked() !== null) || ($style->getProtection()->getHidden() !== null)) { if ((!empty($style->getProtection()->getLocked())) || (!empty($style->getProtection()->getHidden()))) {
if ( if (
$style->getProtection()->getLocked() !== Protection::PROTECTION_INHERIT || $style->getProtection()->getLocked() !== Protection::PROTECTION_INHERIT ||
$style->getProtection()->getHidden() !== Protection::PROTECTION_INHERIT $style->getProtection()->getHidden() !== Protection::PROTECTION_INHERIT
@ -503,11 +519,13 @@ class Style extends WriterPart
$objWriter->writeAttribute('style', $border->getBorderStyle()); $objWriter->writeAttribute('style', $border->getBorderStyle());
// color // color
$objWriter->startElement('color'); if ($border->getColor()->getARGB() !== null) {
$objWriter->writeAttribute('rgb', $border->getColor()->getARGB()); $objWriter->startElement('color');
$objWriter->endElement(); $objWriter->writeAttribute('rgb', $border->getColor()->getARGB());
$objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
}
} }
} }
@ -516,15 +534,15 @@ class Style extends WriterPart
* *
* @param int $id Number Format identifier * @param int $id Number Format identifier
*/ */
private function writeNumFmt(XMLWriter $objWriter, NumberFormat $numberFormat, $id = 0): void private function writeNumFmt(XMLWriter $objWriter, ?NumberFormat $numberFormat, $id = 0): void
{ {
// Translate formatcode // Translate formatcode
$formatCode = $numberFormat->getFormatCode(); $formatCode = ($numberFormat === null) ? null : $numberFormat->getFormatCode();
// numFmt // numFmt
if ($formatCode !== null) { if ($formatCode !== null) {
$objWriter->startElement('numFmt'); $objWriter->startElement('numFmt');
$objWriter->writeAttribute('numFmtId', ($id + 164)); $objWriter->writeAttribute('numFmtId', (string) ($id + 164));
$objWriter->writeAttribute('formatCode', $formatCode); $objWriter->writeAttribute('formatCode', $formatCode);
$objWriter->endElement(); $objWriter->endElement();
} }

View File

@ -12,7 +12,7 @@ class FormulaParserTest extends TestCase
{ {
$this->expectException(CalcException::class); $this->expectException(CalcException::class);
$this->expectExceptionMessage('Invalid parameter passed: formula'); $this->expectExceptionMessage('Invalid parameter passed: formula');
$result = new FormulaParser(null); new FormulaParser(null);
} }
public function testInvalidTokenId(): void public function testInvalidTokenId(): void

View File

@ -3,11 +3,11 @@
namespace PhpOffice\PhpSpreadsheetTests\Chart; namespace PhpOffice\PhpSpreadsheetTests\Chart;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend; use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Properties;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader; use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -107,7 +107,7 @@ class AxisGlowTest extends AbstractFunctional
$yAxis = $chart->getChartAxisY(); $yAxis = $chart->getChartAxisY();
$xAxis = $chart->getChartAxisX(); $xAxis = $chart->getChartAxisX();
$yGlowSize = 10.0; $yGlowSize = 10.0;
$yAxis->setGlowProperties($yGlowSize, 'FFFF00', 30, Properties::EXCEL_COLOR_TYPE_ARGB); $yAxis->setGlowProperties($yGlowSize, 'FFFF00', 30, ChartColor::EXCEL_COLOR_TYPE_RGB);
$expectedGlowColor = [ $expectedGlowColor = [
'type' => 'srgbClr', 'type' => 'srgbClr',
'value' => 'FFFF00', 'value' => 'FFFF00',
@ -231,7 +231,7 @@ class AxisGlowTest extends AbstractFunctional
); );
$yAxis = $chart->getChartAxisX(); // deliberate $yAxis = $chart->getChartAxisX(); // deliberate
$yGlowSize = 20.0; $yGlowSize = 20.0;
$yAxis->setGlowProperties($yGlowSize, 'accent1', 20, Properties::EXCEL_COLOR_TYPE_SCHEME); $yAxis->setGlowProperties($yGlowSize, 'accent1', 20, ChartColor::EXCEL_COLOR_TYPE_SCHEME);
$expectedGlowColor = [ $expectedGlowColor = [
'type' => 'schemeClr', 'type' => 'schemeClr',
'value' => 'accent1', 'value' => 'accent1',

View File

@ -3,11 +3,11 @@
namespace PhpOffice\PhpSpreadsheetTests\Chart; namespace PhpOffice\PhpSpreadsheetTests\Chart;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend; use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Properties;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader; use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -113,7 +113,7 @@ class AxisShadowTest extends AbstractFunctional
'distance' => 3, 'distance' => 3,
'rotWithShape' => 0, 'rotWithShape' => 0,
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_STANDARD, 'type' => ChartColor::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
], ],
@ -139,7 +139,7 @@ class AxisShadowTest extends AbstractFunctional
'ky' => null, 'ky' => null,
], ],
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_ARGB, 'type' => ChartColor::EXCEL_COLOR_TYPE_RGB,
'value' => 'FF0000', 'value' => 'FF0000',
'alpha' => 20, 'alpha' => 20,
], ],

View File

@ -4,12 +4,12 @@ namespace PhpOffice\PhpSpreadsheetTests\Chart;
use PhpOffice\PhpSpreadsheet\Chart\Axis; use PhpOffice\PhpSpreadsheet\Chart\Axis;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\GridLines; use PhpOffice\PhpSpreadsheet\Chart\GridLines;
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend; use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Properties;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader; use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -98,7 +98,7 @@ class GridlinesShadowGlowTest extends AbstractFunctional
$majorGridlines = new GridLines(); $majorGridlines = new GridLines();
$yAxis->setMajorGridlines($majorGridlines); $yAxis->setMajorGridlines($majorGridlines);
$majorGlowSize = 10.0; $majorGlowSize = 10.0;
$majorGridlines->setGlowProperties($majorGlowSize, 'FFFF00', 30, Properties::EXCEL_COLOR_TYPE_ARGB); $majorGridlines->setGlowProperties($majorGlowSize, 'FFFF00', 30, ChartColor::EXCEL_COLOR_TYPE_RGB);
$softEdgeSize = 2.5; $softEdgeSize = 2.5;
$majorGridlines->setSoftEdges($softEdgeSize); $majorGridlines->setSoftEdges($softEdgeSize);
$expectedGlowColor = [ $expectedGlowColor = [
@ -122,7 +122,7 @@ class GridlinesShadowGlowTest extends AbstractFunctional
'distance' => 3, 'distance' => 3,
'rotWithShape' => 0, 'rotWithShape' => 0,
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_STANDARD, 'type' => ChartColor::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
], ],

View File

@ -23,7 +23,7 @@ class Issue2506Test extends AbstractFunctional
public function testDataSeriesValues(): void public function testDataSeriesValues(): void
{ {
$reader = new XlsxReader(); $reader = new XlsxReader();
self::readCharts($reader); $this->readCharts($reader);
$spreadsheet = $reader->load(self::DIRECTORY . 'issue.2506.xlsx'); $spreadsheet = $reader->load(self::DIRECTORY . 'issue.2506.xlsx');
$worksheet = $spreadsheet->getActiveSheet(); $worksheet = $spreadsheet->getActiveSheet();
$charts = $worksheet->getChartCollection(); $charts = $worksheet->getChartCollection();

View File

@ -3,11 +3,11 @@
namespace PhpOffice\PhpSpreadsheetTests\Chart; namespace PhpOffice\PhpSpreadsheetTests\Chart;
use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend; use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Properties;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\File;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -109,7 +109,7 @@ class MultiplierTest extends TestCase
'ky' => null, 'ky' => null,
], ],
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_ARGB, 'type' => ChartColor::EXCEL_COLOR_TYPE_RGB,
'value' => 'FF0000', 'value' => 'FF0000',
'alpha' => 20, 'alpha' => 20,
], ],

View File

@ -3,6 +3,7 @@
namespace PhpOffice\PhpSpreadsheetTests\Chart; namespace PhpOffice\PhpSpreadsheetTests\Chart;
use PhpOffice\PhpSpreadsheet\Chart\Axis; use PhpOffice\PhpSpreadsheet\Chart\Axis;
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
use PhpOffice\PhpSpreadsheet\Chart\GridLines; use PhpOffice\PhpSpreadsheet\Chart\GridLines;
use PhpOffice\PhpSpreadsheet\Chart\Properties; use PhpOffice\PhpSpreadsheet\Chart\Properties;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@ -131,7 +132,7 @@ class ShadowPresetsTest extends TestCase
'presets' => Properties::SHADOW_PRESETS_NOSHADOW, 'presets' => Properties::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_STANDARD, 'type' => ChartColor::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
], ],
@ -160,7 +161,7 @@ class ShadowPresetsTest extends TestCase
'presets' => Properties::SHADOW_PRESETS_NOSHADOW, 'presets' => Properties::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_STANDARD, 'type' => ChartColor::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
], ],
@ -189,7 +190,7 @@ class ShadowPresetsTest extends TestCase
'presets' => Properties::SHADOW_PRESETS_NOSHADOW, 'presets' => Properties::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => [ 'color' => [
'type' => Properties::EXCEL_COLOR_TYPE_STANDARD, 'type' => ChartColor::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
], ],

View File

@ -11,12 +11,14 @@ class AutoFilter2Test extends TestCase
{ {
private const TESTBOOK = 'tests/data/Reader/XLSX/autofilter2.xlsx'; private const TESTBOOK = 'tests/data/Reader/XLSX/autofilter2.xlsx';
public function getVisibleSheet(Worksheet $sheet, int $maxRow): array public function getVisibleSheet(?Worksheet $sheet, int $maxRow): array
{ {
$actualVisible = []; $actualVisible = [];
for ($row = 2; $row <= $maxRow; ++$row) { if ($sheet !== null) {
if ($sheet->getRowDimension($row)->getVisible()) { for ($row = 2; $row <= $maxRow; ++$row) {
$actualVisible[] = $row; if ($sheet->getRowDimension($row)->getVisible()) {
$actualVisible[] = $row;
}
} }
} }
@ -35,13 +37,14 @@ class AutoFilter2Test extends TestCase
self::assertCount(1, $columns); self::assertCount(1, $columns);
$column = $columns['A'] ?? null; $column = $columns['A'] ?? null;
self::assertNotNull($column); self::assertNotNull($column);
/** @scrutinizer ignore-call */
$ruleset = $column->getRules(); $ruleset = $column->getRules();
self::assertCount(1, $ruleset); self::assertCount(1, $ruleset);
$rule = $ruleset[0]; $rule = $ruleset[0];
self::assertSame(Rule::AUTOFILTER_RULETYPE_DATEGROUP, $rule->getRuleType()); self::assertSame(Rule::AUTOFILTER_RULETYPE_DATEGROUP, $rule->getRuleType());
$value = $rule->getValue(); $value = $rule->getValue();
self::assertIsArray($value); self::assertIsArray($value);
self::assertCount(6, $value); self::assertCount(6, /** @scrutinizer ignore-type */ $value);
self::assertSame('2002', $value['year']); self::assertSame('2002', $value['year']);
self::assertSame('', $value['month']); self::assertSame('', $value['month']);
self::assertSame('', $value['day']); self::assertSame('', $value['day']);

View File

@ -24,14 +24,14 @@ class RibbonTest extends AbstractFunctional
self::assertSame('customUI/customUI.xml', $target); self::assertSame('customUI/customUI.xml', $target);
$data = $spreadsheet->getRibbonXMLData('data'); $data = $spreadsheet->getRibbonXMLData('data');
self::assertIsString($data); self::assertIsString($data);
self::assertSame(1522, strlen($data)); self::assertSame(1522, strlen(/** @scrutinizer ignore-type */ $data));
$vbaCode = (string) $spreadsheet->getMacrosCode(); $vbaCode = (string) $spreadsheet->getMacrosCode();
self::assertSame(13312, strlen($vbaCode)); self::assertSame(13312, strlen($vbaCode));
self::assertNull($spreadsheet->getRibbonBinObjects()); self::assertNull($spreadsheet->getRibbonBinObjects());
self::assertNull($spreadsheet->getRibbonBinObjects('names')); foreach (['names', 'data', 'xxxxx'] as $type) {
self::assertNull($spreadsheet->getRibbonBinObjects('data')); self::assertNull($spreadsheet->getRibbonBinObjects($type), "Expecting null when type is $type");
}
self::assertEmpty($spreadsheet->getRibbonBinObjects('types')); self::assertEmpty($spreadsheet->getRibbonBinObjects('types'));
self::assertNull($spreadsheet->getRibbonBinObjects('xxxxx'));
$reloadedSpreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx'); $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx');
$spreadsheet->disconnectWorksheets(); $spreadsheet->disconnectWorksheets();
@ -58,7 +58,7 @@ class RibbonTest extends AbstractFunctional
self::assertSame('customUI/customUI.xml', $target); self::assertSame('customUI/customUI.xml', $target);
$data = $spreadsheet->getRibbonXMLData('data'); $data = $spreadsheet->getRibbonXMLData('data');
self::assertIsString($data); self::assertIsString($data);
self::assertSame(1522, strlen($data)); self::assertSame(1522, strlen(/** @scrutinizer ignore-type */ $data));
$vbaCode = (string) $spreadsheet->getMacrosCode(); $vbaCode = (string) $spreadsheet->getMacrosCode();
self::assertSame(13312, strlen($vbaCode)); self::assertSame(13312, strlen($vbaCode));
$spreadsheet->discardMacros(); $spreadsheet->discardMacros();

View File

@ -28,7 +28,9 @@ class RichTextTest extends TestCase
public function testTextElements(): void public function testTextElements(): void
{ {
$element1 = new TextElement('A'); $element1 = new TextElement('A');
self::assertNull($element1->getFont()); if ($element1->getFont() !== null) {
self::fail('Expected font to be null');
}
$element2 = new TextElement('B'); $element2 = new TextElement('B');
$element3 = new TextElement('C'); $element3 = new TextElement('C');
$richText = new RichText(); $richText = new RichText();

View File

@ -9,81 +9,93 @@ use PHPUnit\Framework\TestCase;
class SpreadsheetCoverageTest extends TestCase class SpreadsheetCoverageTest extends TestCase
{ {
/** @var ?Spreadsheet */
private $spreadsheet;
/** @var ?Spreadsheet */
private $spreadsheet2;
protected function tearDown(): void
{
if ($this->spreadsheet !== null) {
$this->spreadsheet->disconnectWorksheets();
$this->spreadsheet = null;
}
if ($this->spreadsheet2 !== null) {
$this->spreadsheet2->disconnectWorksheets();
$this->spreadsheet2 = null;
}
}
public function testDocumentProperties(): void public function testDocumentProperties(): void
{ {
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$properties = $spreadsheet->getProperties(); $properties = $this->spreadsheet->getProperties();
$properties->setCreator('Anyone'); $properties->setCreator('Anyone');
$properties->setTitle('Description'); $properties->setTitle('Description');
$spreadsheet2 = new Spreadsheet(); $this->spreadsheet2 = new Spreadsheet();
self::assertNotEquals($properties, $spreadsheet2->getProperties()); self::assertNotEquals($properties, $this->spreadsheet2->getProperties());
$properties2 = clone $properties; $properties2 = clone $properties;
$spreadsheet2->setProperties($properties2); $this->spreadsheet2->setProperties($properties2);
self::assertEquals($properties, $spreadsheet2->getProperties()); self::assertEquals($properties, $this->spreadsheet2->getProperties());
$spreadsheet->disconnectWorksheets();
$spreadsheet2->disconnectWorksheets();
} }
public function testDocumentSecurity(): void public function testDocumentSecurity(): void
{ {
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$security = $spreadsheet->getSecurity(); $security = $this->spreadsheet->getSecurity();
$security->setLockRevision(true); $security->setLockRevision(true);
$revisionsPassword = 'revpasswd'; $revisionsPassword = 'revpasswd';
$security->setRevisionsPassword($revisionsPassword); $security->setRevisionsPassword($revisionsPassword);
$spreadsheet2 = new Spreadsheet(); $this->spreadsheet2 = new Spreadsheet();
self::assertNotEquals($security, $spreadsheet2->getSecurity()); self::assertNotEquals($security, $this->spreadsheet2->getSecurity());
$security2 = clone $security; $security2 = clone $security;
$spreadsheet2->setSecurity($security2); $this->spreadsheet2->setSecurity($security2);
self::assertEquals($security, $spreadsheet2->getSecurity()); self::assertEquals($security, $this->spreadsheet2->getSecurity());
$spreadsheet->disconnectWorksheets();
$spreadsheet2->disconnectWorksheets();
} }
public function testCellXfCollection(): void public function testCellXfCollection(): void
{ {
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $this->spreadsheet->getActiveSheet();
$sheet->getStyle('A1')->getFont()->setName('font1'); $sheet->getStyle('A1')->getFont()->setName('font1');
$sheet->getStyle('A2')->getFont()->setName('font2'); $sheet->getStyle('A2')->getFont()->setName('font2');
$sheet->getStyle('A3')->getFont()->setName('font3'); $sheet->getStyle('A3')->getFont()->setName('font3');
$sheet->getStyle('B1')->getFont()->setName('font1'); $sheet->getStyle('B1')->getFont()->setName('font1');
$sheet->getStyle('B2')->getFont()->setName('font2'); $sheet->getStyle('B2')->getFont()->setName('font2');
$collection = $spreadsheet->getCellXfCollection(); $collection = $this->spreadsheet->getCellXfCollection();
self::assertCount(4, $collection); self::assertCount(4, $collection);
$font1Style = $collection[1]; $font1Style = $collection[1];
self::assertTrue($spreadsheet->cellXfExists($font1Style)); self::assertTrue($this->spreadsheet->cellXfExists($font1Style));
self::assertSame('font1', $spreadsheet->getCellXfCollection()[1]->getFont()->getName()); self::assertSame('font1', $this->spreadsheet->getCellXfCollection()[1]->getFont()->getName());
self::assertSame('font1', $sheet->getStyle('A1')->getFont()->getName()); self::assertSame('font1', $sheet->getStyle('A1')->getFont()->getName());
self::assertSame('font2', $sheet->getStyle('A2')->getFont()->getName()); self::assertSame('font2', $sheet->getStyle('A2')->getFont()->getName());
self::assertSame('font3', $sheet->getStyle('A3')->getFont()->getName()); self::assertSame('font3', $sheet->getStyle('A3')->getFont()->getName());
self::assertSame('font1', $sheet->getStyle('B1')->getFont()->getName()); self::assertSame('font1', $sheet->getStyle('B1')->getFont()->getName());
self::assertSame('font2', $sheet->getStyle('B2')->getFont()->getName()); self::assertSame('font2', $sheet->getStyle('B2')->getFont()->getName());
$spreadsheet->removeCellXfByIndex(1); $this->spreadsheet->removeCellXfByIndex(1);
self::assertFalse($spreadsheet->cellXfExists($font1Style)); self::assertFalse($this->spreadsheet->cellXfExists($font1Style));
self::assertSame('font2', $spreadsheet->getCellXfCollection()[1]->getFont()->getName()); self::assertSame('font2', $this->spreadsheet->getCellXfCollection()[1]->getFont()->getName());
self::assertSame('Calibri', $sheet->getStyle('A1')->getFont()->getName()); self::assertSame('Calibri', $sheet->getStyle('A1')->getFont()->getName());
self::assertSame('font2', $sheet->getStyle('A2')->getFont()->getName()); self::assertSame('font2', $sheet->getStyle('A2')->getFont()->getName());
self::assertSame('font3', $sheet->getStyle('A3')->getFont()->getName()); self::assertSame('font3', $sheet->getStyle('A3')->getFont()->getName());
self::assertSame('Calibri', $sheet->getStyle('B1')->getFont()->getName()); self::assertSame('Calibri', $sheet->getStyle('B1')->getFont()->getName());
self::assertSame('font2', $sheet->getStyle('B2')->getFont()->getName()); self::assertSame('font2', $sheet->getStyle('B2')->getFont()->getName());
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidRemoveCellXfByIndex(): void public function testInvalidRemoveCellXfByIndex(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('CellXf index is out of bounds.'); $this->expectExceptionMessage('CellXf index is out of bounds.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $this->spreadsheet->getActiveSheet();
$sheet->getStyle('A1')->getFont()->setName('font1'); $sheet->getStyle('A1')->getFont()->setName('font1');
$sheet->getStyle('A2')->getFont()->setName('font2'); $sheet->getStyle('A2')->getFont()->setName('font2');
$sheet->getStyle('A3')->getFont()->setName('font3'); $sheet->getStyle('A3')->getFont()->setName('font3');
$sheet->getStyle('B1')->getFont()->setName('font1'); $sheet->getStyle('B1')->getFont()->setName('font1');
$sheet->getStyle('B2')->getFont()->setName('font2'); $sheet->getStyle('B2')->getFont()->setName('font2');
$spreadsheet->removeCellXfByIndex(5); $this->spreadsheet->removeCellXfByIndex(5);
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidRemoveDefaultStyle(): void public function testInvalidRemoveDefaultStyle(): void
@ -91,71 +103,63 @@ class SpreadsheetCoverageTest extends TestCase
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('No default style found for this workbook'); $this->expectExceptionMessage('No default style found for this workbook');
// Removing default style probably should be disallowed. // Removing default style probably should be disallowed.
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $this->spreadsheet->removeCellXfByIndex(0);
$spreadsheet->removeCellXfByIndex(0); $this->spreadsheet->getDefaultStyle();
$style = $spreadsheet->getDefaultStyle();
$spreadsheet->disconnectWorksheets();
} }
public function testCellStyleXF(): void public function testCellStyleXF(): void
{ {
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$collection = $spreadsheet->getCellStyleXfCollection(); $collection = $this->spreadsheet->getCellStyleXfCollection();
self::assertCount(1, $collection); self::assertCount(1, $collection);
$styleXf = $collection[0]; $styleXf = $collection[0];
self::assertSame($styleXf, $spreadsheet->getCellStyleXfByIndex(0)); self::assertSame($styleXf, $this->spreadsheet->getCellStyleXfByIndex(0));
$hash = $styleXf->getHashCode(); $hash = $styleXf->getHashCode();
self::assertSame($styleXf, $spreadsheet->getCellStyleXfByHashCode($hash)); self::assertSame($styleXf, $this->spreadsheet->getCellStyleXfByHashCode($hash));
self::assertFalse($spreadsheet->getCellStyleXfByHashCode($hash . 'x')); self::assertFalse($this->spreadsheet->getCellStyleXfByHashCode($hash . 'x'));
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidRemoveCellStyleXfByIndex(): void public function testInvalidRemoveCellStyleXfByIndex(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('CellStyleXf index is out of bounds.'); $this->expectExceptionMessage('CellStyleXf index is out of bounds.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $this->spreadsheet->removeCellStyleXfByIndex(5);
$spreadsheet->removeCellStyleXfByIndex(5);
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidFirstSheetIndex(): void public function testInvalidFirstSheetIndex(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('First sheet index must be a positive integer.'); $this->expectExceptionMessage('First sheet index must be a positive integer.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$spreadsheet->setFirstSheetIndex(-1); $this->spreadsheet->setFirstSheetIndex(-1);
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidVisibility(): void public function testInvalidVisibility(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('Invalid visibility value.'); $this->expectExceptionMessage('Invalid visibility value.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$spreadsheet->setVisibility(Spreadsheet::VISIBILITY_HIDDEN); $this->spreadsheet->setVisibility(Spreadsheet::VISIBILITY_HIDDEN);
self::assertSame(Spreadsheet::VISIBILITY_HIDDEN, $spreadsheet->getVisibility()); self::assertSame(Spreadsheet::VISIBILITY_HIDDEN, $this->spreadsheet->getVisibility());
$spreadsheet->setVisibility(null); $this->spreadsheet->setVisibility(null);
self::assertSame(Spreadsheet::VISIBILITY_VISIBLE, $spreadsheet->getVisibility()); self::assertSame(Spreadsheet::VISIBILITY_VISIBLE, $this->spreadsheet->getVisibility());
$spreadsheet->setVisibility('badvalue'); $this->spreadsheet->setVisibility('badvalue');
$spreadsheet->disconnectWorksheets();
} }
public function testInvalidTabRatio(): void public function testInvalidTabRatio(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('Tab ratio must be between 0 and 1000.'); $this->expectExceptionMessage('Tab ratio must be between 0 and 1000.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$spreadsheet->setTabRatio(2000); $this->spreadsheet->setTabRatio(2000);
$spreadsheet->disconnectWorksheets();
} }
public function testCopy(): void public function testCopy(): void
{ {
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $this->spreadsheet->getActiveSheet();
$sheet->getStyle('A1')->getFont()->setName('font1'); $sheet->getStyle('A1')->getFont()->setName('font1');
$sheet->getStyle('A2')->getFont()->setName('font2'); $sheet->getStyle('A2')->getFont()->setName('font2');
$sheet->getStyle('A3')->getFont()->setName('font3'); $sheet->getStyle('A3')->getFont()->setName('font3');
@ -166,8 +170,8 @@ class SpreadsheetCoverageTest extends TestCase
$sheet->getCell('A3')->setValue('this is a3'); $sheet->getCell('A3')->setValue('this is a3');
$sheet->getCell('B1')->setValue('this is b1'); $sheet->getCell('B1')->setValue('this is b1');
$sheet->getCell('B2')->setValue('this is b2'); $sheet->getCell('B2')->setValue('this is b2');
$copied = $spreadsheet->copy(); $this->spreadsheet2 = $this->spreadsheet->copy();
$copysheet = $copied->getActiveSheet(); $copysheet = $this->spreadsheet2->getActiveSheet();
$copysheet->getStyle('A2')->getFont()->setName('font12'); $copysheet->getStyle('A2')->getFont()->setName('font12');
$copysheet->getCell('A2')->setValue('this was a2'); $copysheet->getCell('A2')->setValue('this was a2');
@ -192,18 +196,13 @@ class SpreadsheetCoverageTest extends TestCase
self::assertSame('this is a3', $copysheet->getCell('A3')->getValue()); self::assertSame('this is a3', $copysheet->getCell('A3')->getValue());
self::assertSame('this is b1', $copysheet->getCell('B1')->getValue()); self::assertSame('this is b1', $copysheet->getCell('B1')->getValue());
self::assertSame('this is b2', $copysheet->getCell('B2')->getValue()); self::assertSame('this is b2', $copysheet->getCell('B2')->getValue());
$spreadsheet->disconnectWorksheets();
$copied->disconnectWorksheets();
} }
public function testClone(): void public function testClone(): void
{ {
$this->expectException(SSException::class); $this->expectException(SSException::class);
$this->expectExceptionMessage('Do not use clone on spreadsheet. Use spreadsheet->copy() instead.'); $this->expectExceptionMessage('Do not use clone on spreadsheet. Use spreadsheet->copy() instead.');
$spreadsheet = new Spreadsheet(); $this->spreadsheet = new Spreadsheet();
$clone = clone $spreadsheet; $this->spreadsheet2 = clone $this->spreadsheet;
$spreadsheet->disconnectWorksheets();
$clone->disconnectWorksheets();
} }
} }

View File

@ -40,6 +40,7 @@ class ColumnCellIteratorTest extends TestCase
$values = []; $values = [];
foreach ($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
self::assertNotNull($ColumnCell); self::assertNotNull($ColumnCell);
/** @scrutinizer ignore-call */
$values[] = $ColumnCell->getValue(); $values[] = $ColumnCell->getValue();
self::assertEquals($ColumnCellIndexResult++, $key); self::assertEquals($ColumnCellIndexResult++, $key);
self::assertInstanceOf(Cell::class, $ColumnCell); self::assertInstanceOf(Cell::class, $ColumnCell);
@ -60,6 +61,7 @@ class ColumnCellIteratorTest extends TestCase
$values = []; $values = [];
foreach ($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
self::assertNotNull($ColumnCell); self::assertNotNull($ColumnCell);
/** @scrutinizer ignore-call */
$values[] = $ColumnCell->getValue(); $values[] = $ColumnCell->getValue();
self::assertEquals($ColumnCellIndexResult++, $key); self::assertEquals($ColumnCellIndexResult++, $key);
self::assertInstanceOf(Cell::class, $ColumnCell); self::assertInstanceOf(Cell::class, $ColumnCell);
@ -81,6 +83,7 @@ class ColumnCellIteratorTest extends TestCase
while ($iterator->valid()) { while ($iterator->valid()) {
$current = $iterator->current(); $current = $iterator->current();
self::assertNotNull($current); self::assertNotNull($current);
/** @scrutinizer ignore-call */
$cell = $current->getCoordinate(); $cell = $current->getCoordinate();
$values[] = $sheet->getCell($cell)->getValue(); $values[] = $sheet->getCell($cell)->getValue();
$iterator->prev(); $iterator->prev();

View File

@ -40,6 +40,7 @@ class RowCellIteratorTest extends TestCase
$values = []; $values = [];
foreach ($iterator as $key => $RowCell) { foreach ($iterator as $key => $RowCell) {
self::assertNotNull($RowCell); self::assertNotNull($RowCell);
/** @scrutinizer ignore-call */
$values[] = $RowCell->getValue(); $values[] = $RowCell->getValue();
self::assertEquals($RowCellIndexResult++, $key); self::assertEquals($RowCellIndexResult++, $key);
self::assertInstanceOf(Cell::class, $RowCell); self::assertInstanceOf(Cell::class, $RowCell);
@ -59,6 +60,7 @@ class RowCellIteratorTest extends TestCase
$values = []; $values = [];
foreach ($iterator as $key => $RowCell) { foreach ($iterator as $key => $RowCell) {
self::assertNotNull($RowCell); self::assertNotNull($RowCell);
/** @scrutinizer ignore-call */
$values[] = $RowCell->getValue(); $values[] = $RowCell->getValue();
self::assertEquals($RowCellIndexResult++, $key); self::assertEquals($RowCellIndexResult++, $key);
self::assertInstanceOf(Cell::class, $RowCell); self::assertInstanceOf(Cell::class, $RowCell);
@ -80,6 +82,7 @@ class RowCellIteratorTest extends TestCase
while ($iterator->valid()) { while ($iterator->valid()) {
$current = $iterator->current(); $current = $iterator->current();
self::assertNotNull($current); self::assertNotNull($current);
/** @scrutinizer ignore-call */
$cell = $current->getCoordinate(); $cell = $current->getCoordinate();
$values[] = $sheet->getCell($cell)->getValue(); $values[] = $sheet->getCell($cell)->getValue();
$iterator->prev(); $iterator->prev();