diff --git a/README.md b/README.md index 694dbcd..c494b8d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ You can download the current version / older version of PhpSpreadsheet-Joomla-Li Version ------- -* The current Joomla! Library is using PhpSpreadsheet 1.20.0. +* The current Joomla! Library is using PhpSpreadsheet 1.23.0. Usage ----- @@ -56,3 +56,10 @@ Credits License ------- PhpSpreadsheet is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/license.md) + +Note +---- + +The library folder was build using the given composer.json file and executing: + + composer update --no-dev --prefer-dist \ No newline at end of file diff --git a/composer.lock b/composer.lock index ee63b9d..186d3da 100644 --- a/composer.lock +++ b/composer.lock @@ -25,12 +25,12 @@ }, "type": "library", "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, "files": [ "library/HTMLPurifier.composer.php" ], + "psr-0": { + "HTMLPurifier": "library/" + }, "exclude-from-classmap": [ "/library/HTMLPurifier/Language/" ] @@ -297,16 +297,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.20.0", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02" + "reference": "21e4cf62699eebf007db28775f7d1554e612ed9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/44436f270bb134b4a94670f3d020a85dfa0a3c02", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/21e4cf62699eebf007db28775f7d1554e612ed9e", + "reference": "21e4cf62699eebf007db28775f7d1554e612ed9e", "shasum": "" }, "require": { @@ -330,14 +330,14 @@ "php": "^7.3 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/simple-cache": "^1.0" + "psr/simple-cache": "^1.0 || ^2.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-master", "dompdf/dompdf": "^1.0", "friendsofphp/php-cs-fixer": "^3.2", "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", + "mpdf/mpdf": "8.0.17", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", @@ -395,9 +395,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.20.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.23.0" }, - "time": "2021-11-23T15:23:42+00:00" + "time": "2022-04-24T13:53:10+00:00" }, { "name": "psr/http-client", @@ -612,7 +612,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -644,12 +644,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -675,7 +675,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { diff --git a/phpspreadsheet.xml b/phpspreadsheet.xml index e4f4cd1..5e2ac16 100644 --- a/phpspreadsheet.xml +++ b/phpspreadsheet.xml @@ -8,7 +8,7 @@ http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL info@ivan.ramos.name ivan.ramos.name - 1.0.4 + 1.0.5 phpspreadsheet.php vendor diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 22b3a93..649a7d3 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -296,17 +296,17 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.20.0", - "version_normalized": "1.20.0.0", + "version": "1.23.0", + "version_normalized": "1.23.0.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02" + "reference": "21e4cf62699eebf007db28775f7d1554e612ed9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/44436f270bb134b4a94670f3d020a85dfa0a3c02", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/21e4cf62699eebf007db28775f7d1554e612ed9e", + "reference": "21e4cf62699eebf007db28775f7d1554e612ed9e", "shasum": "" }, "require": { @@ -330,14 +330,14 @@ "php": "^7.3 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/simple-cache": "^1.0" + "psr/simple-cache": "^1.0 || ^2.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-master", "dompdf/dompdf": "^1.0", "friendsofphp/php-cs-fixer": "^3.2", "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", + "mpdf/mpdf": "8.0.17", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", @@ -351,7 +351,7 @@ "mpdf/mpdf": "Option for rendering PDF with PDF Writer", "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)" }, - "time": "2021-11-23T15:23:42+00:00", + "time": "2022-04-24T13:53:10+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -397,7 +397,7 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.20.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.23.0" }, "install-path": "../phpoffice/phpspreadsheet" }, @@ -620,8 +620,8 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", - "version_normalized": "1.24.0.0", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -655,12 +655,12 @@ }, "installation-source": "dist", "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -686,7 +686,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -705,6 +705,6 @@ "install-path": "../symfony/polyfill-mbstring" } ], - "dev": true, + "dev": false, "dev-package-names": [] } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 433d888..cd7966e 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,9 +5,9 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '8b35f05304bf4cf39c052645d67f4cc565ca1b93', + 'reference' => 'bc2250d5b9881a09ed85062a6aa98825e8655d54', 'name' => '__root__', - 'dev' => true, + 'dev' => false, ), 'versions' => array( '__root__' => array( @@ -16,7 +16,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '8b35f05304bf4cf39c052645d67f4cc565ca1b93', + 'reference' => 'bc2250d5b9881a09ed85062a6aa98825e8655d54', 'dev_requirement' => false, ), 'ezyang/htmlpurifier' => array( @@ -65,12 +65,12 @@ 'dev_requirement' => false, ), 'phpoffice/phpspreadsheet' => array( - 'pretty_version' => '1.20.0', - 'version' => '1.20.0.0', + 'pretty_version' => '1.23.0', + 'version' => '1.23.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet', 'aliases' => array(), - 'reference' => '44436f270bb134b4a94670f3d020a85dfa0a3c02', + 'reference' => '21e4cf62699eebf007db28775f7d1554e612ed9e', 'dev_requirement' => false, ), 'psr/http-client' => array( @@ -110,8 +110,8 @@ 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.24.0', - 'version' => '1.24.0.0', + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), diff --git a/vendor/phpoffice/phpspreadsheet/.php-cs-fixer.dist.php b/vendor/phpoffice/phpspreadsheet/.php-cs-fixer.dist.php index c0e8f9d..ca2feb4 100644 --- a/vendor/phpoffice/phpspreadsheet/.php-cs-fixer.dist.php +++ b/vendor/phpoffice/phpspreadsheet/.php-cs-fixer.dist.php @@ -21,12 +21,12 @@ 'braces' => true, 'cast_spaces' => true, 'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const - 'class_definition' => true, + 'class_definition' => false, 'class_keyword_remove' => false, // ::class keyword gives us better support in IDE 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'combine_nested_dirname' => true, - 'comment_to_phpdoc' => true, + 'comment_to_phpdoc' => false, // interferes with annotations 'compact_nullable_typehint' => true, 'concat_space' => ['spacing' => 'one'], 'constant_case' => true, @@ -55,7 +55,7 @@ 'function_declaration' => true, 'function_to_constant' => true, 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'method', 'throws']], + 'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']], 'global_namespace_import' => true, 'header_comment' => false, // We don't use common header in all our files 'heredoc_indentation' => false, // Requires PHP >= 7.3 @@ -171,7 +171,7 @@ 'phpdoc_separation' => true, 'phpdoc_single_line_var_spacing' => true, 'phpdoc_summary' => true, - 'phpdoc_to_comment' => true, + 'phpdoc_to_comment' => false, // interferes with annotations 'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use 'phpdoc_to_return_type' => false, // idem 'phpdoc_trim' => true, diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.md index 64b4b7e..dbe6121 100644 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md +++ b/vendor/phpoffice/phpspreadsheet/CHANGELOG.md @@ -5,6 +5,209 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org). +## 1.23.0 - 2022-04-24 + +### Added + +- Ods Writer support for Freeze Pane [Issue #2013](https://github.com/PHPOffice/PhpSpreadsheet/issues/2013) [PR #2755](https://github.com/PHPOffice/PhpSpreadsheet/pull/2755) +- Ods Writer support for setting column width/row height (including the use of AutoSize) [Issue #2346](https://github.com/PHPOffice/PhpSpreadsheet/issues/2346) [PR #2753](https://github.com/PHPOffice/PhpSpreadsheet/pull/2753) +- Introduced CellAddress, CellRange, RowRange and ColumnRange value objects that can be used as an alternative to a string value (e.g. `'C5'`, `'B2:D4'`, `'2:2'` or `'B:C'`) in appropriate contexts. +- Implementation of the FILTER(), SORT(), SORTBY() and UNIQUE() Lookup/Reference (array) functions. +- Implementation of the ISREF() Information function. +- Added support for reading "formatted" numeric values from Csv files; although default behaviour of reading these values as strings is preserved. + + (i.e a value of "12,345.67" can be read as numeric `12345.67`, not simply as a string `"12,345.67"`, if the `castFormattedNumberToNumeric()` setting is enabled. + + This functionality is locale-aware, using the server's locale settings to identify the thousands and decimal separators. + +- Support for two cell anchor drawing of images. [#2532](https://github.com/PHPOffice/PhpSpreadsheet/pull/2532) [#2674](https://github.com/PHPOffice/PhpSpreadsheet/pull/2674) +- Limited support for Xls Reader to handle Conditional Formatting: + + Ranges and Rules are read, but style is currently limited to font size, weight and color; and to fill style and color. + +- Add ability to suppress Mac line ending check for CSV [#2623](https://github.com/PHPOffice/PhpSpreadsheet/pull/2623) +- Initial support for creating and writing Tables (Xlsx Writer only) [PR #2671](https://github.com/PHPOffice/PhpSpreadsheet/pull/2671) + + See `/samples/Table` for examples of use. + + Note that PreCalculateFormulas needs to be disabled when saving spreadsheets containing tables with formulae (totals or column formulae). + +### Changed + +- Gnumeric Reader now loads number formatting for cells. +- Gnumeric Reader now correctly identifies selected worksheet and selected cells in a worksheet. +- Some Refactoring of the Ods Reader, moving all formula and address translation from Ods to Excel into a separate class to eliminate code duplication and ensure consistency. +- Make Boolean Conversion in Csv Reader locale-aware when using the String Value Binder. + + This is determined by the Calculation Engine locale setting. + + (i.e. `"Vrai"` wil be converted to a boolean `true` if the Locale is set to `fr`.) +- Allow `psr/simple-cache` 2.x + +### Deprecated + +- All Excel Function implementations in `Calculation\Functions` (including the Error functions) have been moved to dedicated classes for groups of related functions. See the docblocks against all the deprecated methods for details of the new methods to call instead. At some point, these old classes will be deleted. +- Worksheet methods that reference cells "byColumnandRow". All such methods have an equivalent that references the cell by its address (e.g. '`E3'` rather than `5, 3`). + + These functions now accept either a cell address string (`'E3')` or an array with columnId and rowId (`[5, 3]`) or a new `CellAddress` object as their `cellAddress`/`coordinate` argument. + This includes the methods: + - `setCellValueByColumnAndRow()` use the equivalent `setCellValue()` + - `setCellValueExplicitByColumnAndRow()` use the equivalent `setCellValueExplicit()` + - `getCellByColumnAndRow()` use the equivalent `getCell()` + - `cellExistsByColumnAndRow()` use the equivalent `cellExists()` + - `getStyleByColumnAndRow()` use the equivalent `getStyle()` + - `setBreakByColumnAndRow()` use the equivalent `setBreak()` + - `mergeCellsByColumnAndRow()` use the equivalent `mergeCells()` + - `unmergeCellsByColumnAndRow()` use the equivalent `unmergeCells()` + - `protectCellsByColumnAndRow()` use the equivalent `protectCells()` + - `unprotectCellsByColumnAndRow()` use the equivalent `unprotectCells()` + - `setAutoFilterByColumnAndRow()` use the equivalent `setAutoFilter()` + - `freezePaneByColumnAndRow()` use the equivalent `freezePane()` + - `getCommentByColumnAndRow()` use the equivalent `getComment()` + - `setSelectedCellByColumnAndRow()` use the equivalent `setSelectedCells()` + + This change provides more consistency in the methods (not every "by cell address" method has an equivalent "byColumnAndRow" method); + and the "by cell address" methods often provide more flexibility, such as allowing a range of cells, or referencing them by passing the defined name of a named range as the argument. + +### Removed + +- Nothing + +### Fixed + +- Make allowance for the AutoFilter dropdown icon in the first row of an Autofilter range when using Autosize columns. [Issue #2413](https://github.com/PHPOffice/PhpSpreadsheet/issues/2413) [PR #2754](https://github.com/PHPOffice/PhpSpreadsheet/pull/2754) +- Support for "chained" ranges (e.g. `A5:C10:C20:F1`) in the Calculation Engine; and also support for using named ranges with the Range operator (e.g. `NamedRange1:NamedRange2`) [Issue #2730](https://github.com/PHPOffice/PhpSpreadsheet/issues/2730) [PR #2746](https://github.com/PHPOffice/PhpSpreadsheet/pull/2746) +- Update Conditional Formatting ranges and rule conditions when inserting/deleting rows/columns [Issue #2678](https://github.com/PHPOffice/PhpSpreadsheet/issues/2678) [PR #2689](https://github.com/PHPOffice/PhpSpreadsheet/pull/2689) +- Allow `INDIRECT()` to accept row/column ranges as well as cell ranges [PR #2687](https://github.com/PHPOffice/PhpSpreadsheet/pull/2687) +- Fix bug when deleting cells with hyperlinks, where the hyperlink was then being "inherited" by whatever cell moved to that cell address. +- Fix bug in Conditional Formatting in the Xls Writer that resulted in a broken file when there were multiple conditional ranges in a worksheet. +- Fix Conditional Formatting in the Xls Writer to work with rules that contain string literals, cell references and formulae. +- Fix for setting Active Sheet to the first loaded worksheet when bookViews element isn't defined [Issue #2666](https://github.com/PHPOffice/PhpSpreadsheet/issues/2666) [PR #2669](https://github.com/PHPOffice/PhpSpreadsheet/pull/2669) +- Fixed behaviour of XLSX font style vertical align settings [PR #2619](https://github.com/PHPOffice/PhpSpreadsheet/pull/2619) +- Resolved formula translations to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels. + + Note that this method is used when translating Excel functions between `en_us` and other locale languages, as well as when converting formulae between different spreadsheet formats (e.g. Ods to Excel). + + Nor is this a perfect solution, as there may still be issues when function calls have array arguments that themselves contain function calls; but it's still better than the current logic. +- Fix for escaping double quotes within a formula [Issue #1971](https://github.com/PHPOffice/PhpSpreadsheet/issues/1971) [PR #2651](https://github.com/PHPOffice/PhpSpreadsheet/pull/2651) +- Change open mode for output from `wb+` to `wb` [Issue #2372](https://github.com/PHPOffice/PhpSpreadsheet/issues/2372) [PR #2657](https://github.com/PHPOffice/PhpSpreadsheet/pull/2657) +- Use color palette if supplied [Issue #2499](https://github.com/PHPOffice/PhpSpreadsheet/issues/2499) [PR #2595](https://github.com/PHPOffice/PhpSpreadsheet/pull/2595) +- Xls reader treat drawing offsets as int rather than float [PR #2648](https://github.com/PHPOffice/PhpSpreadsheet/pull/2648) +- Handle booleans in conditional styles properly [PR #2654](https://github.com/PHPOffice/PhpSpreadsheet/pull/2654) +- Fix for reading files in the root directory of a ZipFile, which should not be prefixed by relative paths ("./") as dirname($filename) does by default. +- Fix invalid style of cells in empty columns with columnDimensions and rows with rowDimensions in added external sheet. [PR #2739](https://github.com/PHPOffice/PhpSpreadsheet/pull/2739) +- Time Interval Formatting [Issue #2768](https://github.com/PHPOffice/PhpSpreadsheet/issues/2768) [PR #2772](https://github.com/PHPOffice/PhpSpreadsheet/pull/2772) + +## 1.22.0 - 2022-02-18 + +### Added + +- Namespacing phase 2 - styles. +[PR #2471](https://github.com/PHPOffice/PhpSpreadsheet/pull/2471) + +- Improved support for passing of array arguments to Excel function implementations to return array results (where appropriate). [Issue #2551](https://github.com/PHPOffice/PhpSpreadsheet/issues/2551) + + This is the first stage in an ongoing process of adding array support to all appropriate function implementations, +- Support for the Excel365 Math/Trig SEQUENCE() function [PR #2536](https://github.com/PHPOffice/PhpSpreadsheet/pull/2536) +- Support for the Excel365 Math/Trig RANDARRAY() function [PR #2540](https://github.com/PHPOffice/PhpSpreadsheet/pull/2540) + + Note that the Spill Operator is not yet supported in the Calculation Engine; but this can still be useful for defining array constants. +- Improved support for Conditional Formatting Rules [PR #2491](https://github.com/PHPOffice/PhpSpreadsheet/pull/2491) + - Provide support for a wider range of Conditional Formatting Rules for Xlsx Reader/Writer: + - Cells Containing (cellIs) + - Specific Text (containing, notContaining, beginsWith, endsWith) + - Dates Occurring (all supported timePeriods) + - Blanks/NoBlanks + - Errors/NoErrors + - Duplicates/Unique + - Expression + - Provision of CF Wizards (for all the above listed rule types) to help create/modify CF Rules without having to manage all the combinations of types/operators, and the complexities of formula expressions, or the text/timePeriod attributes. + + See [documentation](https://phpspreadsheet.readthedocs.io/en/latest/topics/conditional-formatting/) for details + + - Full support of the above CF Rules for the Xlsx Reader and Writer; even when the file being loaded has CF rules listed in the `` element for the worksheet rather than the `` element. + - Provision of a CellMatcher to identify if rules are matched for a cell, and which matching style will be applied. + - Improved documentation and examples, covering all supported CF rule types. + - Add support for one digit decimals (FORMAT_NUMBER_0, FORMAT_PERCENTAGE_0). [PR #2525](https://github.com/PHPOffice/PhpSpreadsheet/pull/2525) + - Initial work enabling Excel function implementations for handling arrays as arguments when used in "array formulae" [#2562](https://github.com/PHPOffice/PhpSpreadsheet/issues/2562) + - Enable most of the Date/Time functions to accept array arguments [#2573](https://github.com/PHPOffice/PhpSpreadsheet/issues/2573) + - Array ready functions - Text, Math/Trig, Statistical, Engineering and Logical [#2580](https://github.com/PHPOffice/PhpSpreadsheet/issues/2580) + +### Changed + +- Additional Russian translations for Excel Functions (courtesy of aleks-samurai). +- Improved code coverage for NumberFormat. [PR #2556](https://github.com/PHPOffice/PhpSpreadsheet/pull/2556) +- Extract some methods from the Calculation Engine into dedicated classes [#2537](https://github.com/PHPOffice/PhpSpreadsheet/issues/2537) +- Eliminate calls to `flattenSingleValue()` that are no longer required when we're checking for array values as arguments [#2590](https://github.com/PHPOffice/PhpSpreadsheet/issues/2590) + +### Deprecated + +- Nothing + +### Removed + +- Nothing + +### Fixed + +- Fixed `ReferenceHelper@insertNewBefore` behavior when removing column before last column with null value [PR #2541](https://github.com/PHPOffice/PhpSpreadsheet/pull/2541) +- Fix bug with `DOLLARDE()` and `DOLLARFR()` functions when the dollar value is negative [Issue #2578](https://github.com/PHPOffice/PhpSpreadsheet/issues/2578) [PR #2579](https://github.com/PHPOffice/PhpSpreadsheet/pull/2579) +- Fix partial function name matching when translating formulae from Russian to English [Issue #2533](https://github.com/PHPOffice/PhpSpreadsheet/issues/2533) [PR #2534](https://github.com/PHPOffice/PhpSpreadsheet/pull/2534) +- Various bugs related to Conditional Formatting Rules, and errors in the Xlsx Writer for Conditional Formatting [PR #2491](https://github.com/PHPOffice/PhpSpreadsheet/pull/2491) +- Xlsx Reader merge range fixes. [Issue #2501](https://github.com/PHPOffice/PhpSpreadsheet/issues/2501) [PR #2504](https://github.com/PHPOffice/PhpSpreadsheet/pull/2504) +- Handle explicit "date" type for Cell in Xlsx Reader. [Issue #2373](https://github.com/PHPOffice/PhpSpreadsheet/issues/2373) [PR #2485](https://github.com/PHPOffice/PhpSpreadsheet/pull/2485) +- Recalibrate Row/Column Dimensions after removeRow/Column. [Issue #2442](https://github.com/PHPOffice/PhpSpreadsheet/issues/2442) [PR #2486](https://github.com/PHPOffice/PhpSpreadsheet/pull/2486) +- Refinement for XIRR. [Issue #2469](https://github.com/PHPOffice/PhpSpreadsheet/issues/2469) [PR #2487](https://github.com/PHPOffice/PhpSpreadsheet/pull/2487) +- Xlsx Reader handle cell with non-null explicit type but null value. [Issue #2488](https://github.com/PHPOffice/PhpSpreadsheet/issues/2488) [PR #2489](https://github.com/PHPOffice/PhpSpreadsheet/pull/2489) +- Xlsx Reader fix height and width for oneCellAnchorDrawings. [PR #2492](https://github.com/PHPOffice/PhpSpreadsheet/pull/2492) +- Fix rounding error in NumberFormat::NUMBER_PERCENTAGE, NumberFormat::NUMBER_PERCENTAGE_00. [PR #2555](https://github.com/PHPOffice/PhpSpreadsheet/pull/2555) +- Don't treat thumbnail file as xml. [Issue #2516](https://github.com/PHPOffice/PhpSpreadsheet/issues/2516) [PR #2517](https://github.com/PHPOffice/PhpSpreadsheet/pull/2517) +- Eliminating Xlsx Reader warning when no sz tag for RichText. [Issue #2542](https://github.com/PHPOffice/PhpSpreadsheet/issues/2542) [PR #2550](https://github.com/PHPOffice/PhpSpreadsheet/pull/2550) +- Fix Xlsx/Xls Writer handling of inline strings. [Issue #353](https://github.com/PHPOffice/PhpSpreadsheet/issues/353) [PR #2569](https://github.com/PHPOffice/PhpSpreadsheet/pull/2569) +- Richtext colors were not being read correctly after namespace change [#2458](https://github.com/PHPOffice/PhpSpreadsheet/issues/2458) +- Fix discrepancy between the way markdown tables are rendered in ReadTheDocs and in PHPStorm [#2520](https://github.com/PHPOffice/PhpSpreadsheet/issues/2520) +- Update Russian Functions Text File [#2557](https://github.com/PHPOffice/PhpSpreadsheet/issues/2557) +- Fix documentation, instantiation example [#2564](https://github.com/PHPOffice/PhpSpreadsheet/issues/2564) + + +## 1.21.0 - 2022-01-06 + +### Added + +- Ability to add a picture to the background of the comment. Supports four image formats: png, jpeg, gif, bmp. New `Comment::setSizeAsBackgroundImage()` to change the size of a comment to the size of a background image. [Issue #1547](https://github.com/PHPOffice/PhpSpreadsheet/issues/1547) [PR #2422](https://github.com/PHPOffice/PhpSpreadsheet/pull/2422) +- Ability to set default paper size and orientation [PR #2410](https://github.com/PHPOffice/PhpSpreadsheet/pull/2410) +- Ability to extend AutoFilter to Maximum Row [PR #2414](https://github.com/PHPOffice/PhpSpreadsheet/pull/2414) + +### Changed + +- Xlsx Writer will evaluate AutoFilter only if it is as yet unevaluated, or has changed since it was last evaluated [PR #2414](https://github.com/PHPOffice/PhpSpreadsheet/pull/2414) + +### Deprecated + +- Nothing + +### Removed + +- Nothing + +### Fixed + +- Rounding in `NumberFormatter` [Issue #2385](https://github.com/PHPOffice/PhpSpreadsheet/issues/2385) [PR #2399](https://github.com/PHPOffice/PhpSpreadsheet/pull/2399) +- Support for themes [Issue #2075](https://github.com/PHPOffice/PhpSpreadsheet/issues/2075) [Issue #2387](https://github.com/PHPOffice/PhpSpreadsheet/issues/2387) [PR #2403](https://github.com/PHPOffice/PhpSpreadsheet/pull/2403) +- Read spreadsheet with `#` in name [Issue #2405](https://github.com/PHPOffice/PhpSpreadsheet/issues/2405) [PR #2409](https://github.com/PHPOffice/PhpSpreadsheet/pull/2409) +- Improve PDF support for page size and orientation [Issue #1691](https://github.com/PHPOffice/PhpSpreadsheet/issues/1691) [PR #2410](https://github.com/PHPOffice/PhpSpreadsheet/pull/2410) +- Wildcard handling issues in text match [Issue #2430](https://github.com/PHPOffice/PhpSpreadsheet/issues/2430) [PR #2431](https://github.com/PHPOffice/PhpSpreadsheet/pull/2431) +- Respect DataType in `insertNewBefore` [PR #2433](https://github.com/PHPOffice/PhpSpreadsheet/pull/2433) +- Handle rows explicitly hidden after AutoFilter [Issue #1641](https://github.com/PHPOffice/PhpSpreadsheet/issues/1641) [PR #2414](https://github.com/PHPOffice/PhpSpreadsheet/pull/2414) +- Special characters in image file name [Issue #1470](https://github.com/PHPOffice/PhpSpreadsheet/issues/1470) [Issue #2415](https://github.com/PHPOffice/PhpSpreadsheet/issues/2415) [PR #2416](https://github.com/PHPOffice/PhpSpreadsheet/pull/2416) +- Mpdf with very many styles [Issue #2432](https://github.com/PHPOffice/PhpSpreadsheet/issues/2432) [PR #2434](https://github.com/PHPOffice/PhpSpreadsheet/pull/2434) +- Name clashes between parsed and unparsed drawings [Issue #1767](https://github.com/PHPOffice/PhpSpreadsheet/issues/1767) [Issue #2396](https://github.com/PHPOffice/PhpSpreadsheet/issues/2396) [PR #2423](https://github.com/PHPOffice/PhpSpreadsheet/pull/2423) +- Fill pattern start and end colors [Issue #2441](https://github.com/PHPOffice/PhpSpreadsheet/issues/2441) [PR #2444](https://github.com/PHPOffice/PhpSpreadsheet/pull/2444) +- General style specified in wrong case [Issue #2450](https://github.com/PHPOffice/PhpSpreadsheet/issues/2450) [PR #2451](https://github.com/PHPOffice/PhpSpreadsheet/pull/2451) +- Null passed to `AutoFilter::setRange()` [Issue #2281](https://github.com/PHPOffice/PhpSpreadsheet/issues/2281) [PR #2454](https://github.com/PHPOffice/PhpSpreadsheet/pull/2454) +- Another undefined index in Xls reader (#2470) [Issue #2463](https://github.com/PHPOffice/PhpSpreadsheet/issues/2463) [PR #2470](https://github.com/PHPOffice/PhpSpreadsheet/pull/2470) +- Allow single-cell checks on conditional styles, even when the style is configured for a range of cells (#) [PR #2483](https://github.com/PHPOffice/PhpSpreadsheet/pull/2483) + ## 1.20.0 - 2021-11-23 ### Added @@ -64,7 +267,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). ### Deprecated -- PHP 8.1 will deprecate auto_detect_line_endings. As a result of this change, Csv Reader using PHP8.1+ will no longer be able to handle a Csv with Mac line endings. +- PHP 8.1 will deprecate auto_detect_line_endings. As a result of this change, Csv Reader using some release after PHP8.1 will no longer be able to handle a Csv with Mac line endings. ### Removed diff --git a/vendor/phpoffice/phpspreadsheet/composer.json b/vendor/phpoffice/phpspreadsheet/composer.json index d80fc62..a0064df 100644 --- a/vendor/phpoffice/phpspreadsheet/composer.json +++ b/vendor/phpoffice/phpspreadsheet/composer.json @@ -12,7 +12,10 @@ "spreadsheet" ], "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", "type": "library", @@ -72,14 +75,14 @@ "markbaker/matrix": "^3.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/simple-cache": "^1.0" + "psr/simple-cache": "^1.0 || ^2.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-master", "dompdf/dompdf": "^1.0", "friendsofphp/php-cs-fixer": "^3.2", "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", + "mpdf/mpdf": "8.0.17", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", diff --git a/vendor/phpoffice/phpspreadsheet/phpstan-baseline.neon b/vendor/phpoffice/phpspreadsheet/phpstan-baseline.neon index 84e4ba1..bdbbf4a 100644 --- a/vendor/phpoffice/phpspreadsheet/phpstan-baseline.neon +++ b/vendor/phpoffice/phpspreadsheet/phpstan-baseline.neon @@ -5,51 +5,6 @@ parameters: count: 3 path: src/PhpSpreadsheet/Calculation/Calculation.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'onlyIf' on mixed\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'onlyIfNot' on mixed\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'reference' on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'storeKey' on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'type' on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 'value' on mixed\\.$#" - count: 16 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Cannot access offset int on mixed\\.$#" - count: 16 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Cannot call method attach\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" count: 1 @@ -100,11 +55,6 @@ parameters: count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 6 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:_translateFormulaToEnglish\\(\\) has no return type specified\\.$#" count: 1 @@ -145,11 +95,6 @@ parameters: count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:getUnusedBranchStoreKey\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:localeFunc\\(\\) has no return type specified\\.$#" count: 1 @@ -160,16 +105,6 @@ parameters: count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:raiseFormulaError\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:raiseFormulaError\\(\\) has parameter \\$errorMessage with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:validateBinaryOperand\\(\\) has no return type specified\\.$#" count: 1 @@ -186,23 +121,13 @@ parameters: path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$cellRange of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:extractAllCellReferencesInRange\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$column of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getHighestDataRow\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$definedName of static method PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:resolveName\\(\\) expects string, mixed given\\.$#" - count: 1 + message: "#^Offset 'type' does not exist on array\\|null\\.$#" + count: 3 path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$formula of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:_calculateFormulaValue\\(\\) expects string, mixed given\\.$#" - count: 1 + message: "#^Offset 'value' does not exist on array\\|null\\.$#" + count: 5 path: src/PhpSpreadsheet/Calculation/Calculation.php - @@ -225,61 +150,6 @@ parameters: count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$str1 of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:strcmpAllowNull\\(\\) expects string\\|null, mixed given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$str1 of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:strcmpLowercaseFirst\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$string of function strlen expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:strCaseReverse\\(\\) expects string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#2 \\$str2 of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:strcmpAllowNull\\(\\) expects string\\|null, mixed given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#2 \\$worksheet of static method PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:resolveName\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet, PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null given\\.$#" count: 1 @@ -287,51 +157,6 @@ parameters: - message: "#^Parameter \\#3 \\$formula of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:translateSeparator\\(\\) expects string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#4 \\$operation of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:executeBinaryComparisonOperation\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#4 \\$storeKey of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:push\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#5 \\$onlyIf of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:push\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Parameter \\#6 \\$onlyIfNot of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:push\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Part \\$argumentCount \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Part \\$token \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Part \\$val \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:\\$branchPruningEnabled has no type specified\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php @@ -411,18 +236,13 @@ parameters: path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Strict comparison using \\=\\=\\= between mixed and null will always evaluate to false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Calculation.php - - - - message: "#^Variable \\$inversedStr1 on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Strict comparison using \\=\\=\\= between array and '\\(' will always evaluate to false\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Variable \\$inversedStr2 on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 + message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array and null will always evaluate to false\\.$#" + count: 2 path: src/PhpSpreadsheet/Calculation/Calculation.php - @@ -470,11 +290,6 @@ parameters: count: 1 path: src/PhpSpreadsheet/Calculation/Database.php - - - message: "#^Cannot access offset int\\|string\\|null on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:buildCondition\\(\\) has parameter \\$criterion with no type specified\\.$#" count: 1 @@ -506,8632 +321,5077 @@ parameters: path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php - - message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, 'strtoupper' given\\.$#" + message: "#^Variable \\$dateValue on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php - - message: "#^Parameter \\#1 \\$criteriaNames of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:buildQuery\\(\\) expects array, mixed given\\.$#" + message: "#^Variable \\$timeValue on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BesselJ\\:\\:besselj2a\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BesselJ\\:\\:besselj2b\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php - - message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBase\\:\\:validatePlaces\\(\\) has parameter \\$places with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:executeQuery\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBase\\:\\:validateValue\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php - - message: "#^Parameter \\#4 \\$fields of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:executeQuery\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:getUOMDetails\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php + path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:resolveTemperatureSynonyms\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php + path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php - - message: "#^Parameter \\#1 \\$day of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:dayStringToNumber\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:erfValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php + path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php - - message: "#^Parameter \\#1 \\$monthName of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:monthStringToNumber\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:erfValue\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php + path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:\\$twoSqrtPi has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php + path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php - - message: "#^Variable \\$dateValue on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:erfcValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php + path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:erfcValue\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php + path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php - - message: "#^Parameter \\#1 \\$excelTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:excelToDateTimeObject\\(\\) expects float\\|int, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:\\$oneSqrtPi has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php - - - - message: "#^Parameter \\#1 \\$x of function fmod expects float, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php + path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, array\\{'PhpOffice\\\\\\\\PhpSpreadsheet\\\\\\\\Calculation\\\\\\\\Exception', 'errorHandlerCallback'\\} given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php + path: src/PhpSpreadsheet/Calculation/ExceptionHandler.php - - message: "#^Variable \\$timeValue on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:ISPMT\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php + path: src/PhpSpreadsheet/Calculation/Financial.php - - message: "#^Binary operation \"/\" between int\\|string and \\(float\\|int\\) results in an error\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:ISPMT\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php - - - - message: "#^Binary operation \"/\" between int\\|string and 360 results in an error\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php + path: src/PhpSpreadsheet/Calculation/Financial.php - - message: "#^Binary operation \"/\" between int\\|string and 365 results in an error\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:NPV\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php + path: src/PhpSpreadsheet/Calculation/Financial.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engine\\\\Logger\\:\\:writeDebugLog\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Parameter \\#1 \\$year of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:isLeapYear\\(\\) expects int\\|string, array\\|int\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engine/Logger.php + path: src/PhpSpreadsheet/Calculation/Financial/Amortization.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:BITLSHIFT\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:BITRSHIFT\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$futureValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$category of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:getConversionCategoryUnitDetails\\(\\) expects string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$numberOfPeriods with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$category of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:getConversionCategoryUnits\\(\\) expects string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$payment with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBinary\\:\\:toDecimal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$presentValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBinary\\:\\:toHex\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$rate with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBinary\\:\\:toOctal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$type with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toBinary\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:schedulePayment\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toHex\\(\\) expects string, mixed given\\.$#" + message: "#^Binary operation \"\\-\" between float\\|string and 0\\|float results in an error\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toOctal\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\InterestAndPrincipal\\:\\:\\$interest has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertHex\\:\\:toBinary\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\InterestAndPrincipal\\:\\:\\$principal has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertHex\\:\\:toDecimal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Variable\\\\NonPeriodic\\:\\:xnpvOrdered\\(\\) should return float\\|string but returns array\\|string\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertHex\\:\\:toOctal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Variable\\\\Periodic\\:\\:presentValue\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertOctal\\:\\:toBinary\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$year of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Helpers\\:\\:daysPerYear\\(\\) expects int\\|string, array\\|int\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Coupons.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertOctal\\:\\:toDecimal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateCost\\(\\) has parameter \\$cost with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertOctal\\:\\:toHex\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateFactor\\(\\) has parameter \\$factor with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBinary\\:\\:toHex\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateLife\\(\\) has parameter \\$life with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBinary\\:\\:toOctal\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateMonth\\(\\) has parameter \\$month with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toBinary\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validatePeriod\\(\\) has parameter \\$period with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toHex\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateSalvage\\(\\) has parameter \\$salvage with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertDecimal\\:\\:toOctal\\(\\) expects int\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + message: "#^Binary operation \"/\" between float\\|string and float\\|string results in an error\\.$#" + count: 2 + path: src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertHex\\:\\:toBinary\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Securities\\\\Price\\:\\:received\\(\\) should return float\\|string but returns array\\|string\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertHex\\:\\:toOctal\\(\\) expects int\\|null, mixed given\\.$#" + message: "#^Parameter \\#1 \\$year of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Helpers\\:\\:daysPerYear\\(\\) expects int\\|string, array\\|int\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + path: src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertOctal\\:\\:toBinary\\(\\) expects int\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + message: "#^Parameter \\#1 \\$year of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Helpers\\:\\:daysPerYear\\(\\) expects int\\|string, array\\|int\\|string given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Calculation/Financial/Securities/Yields.php - - message: "#^Parameter \\#2 \\$places of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertOctal\\:\\:toHex\\(\\) expects int\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering.php + message: "#^Cannot call method getTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" + count: 4 + path: src/PhpSpreadsheet/Calculation/FormulaParser.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BesselJ\\:\\:besselj2a\\(\\) has no return type specified\\.$#" + message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" + count: 9 + path: src/PhpSpreadsheet/Calculation/FormulaParser.php + + - + message: "#^Cannot call method setTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" + count: 5 + path: src/PhpSpreadsheet/Calculation/FormulaParser.php + + - + message: "#^Cannot call method setValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" + count: 5 + path: src/PhpSpreadsheet/Calculation/FormulaParser.php + + - + message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php + path: src/PhpSpreadsheet/Calculation/FormulaParser.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BesselJ\\:\\:besselj2b\\(\\) has no return type specified\\.$#" + message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php + path: src/PhpSpreadsheet/Calculation/FormulaParser.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BesselK\\:\\:besselK2\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:ifCondition\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BesselK.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\BitWise\\:\\:validateBitwiseArgument\\(\\) never returns int so it can be removed from the return type\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:ifCondition\\(\\) has parameter \\$condition with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\<0, 281474976710655\\>\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isCellValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isCellValue\\(\\) has parameter \\$idx with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ComplexFunctions\\:\\:IMARGUMENT\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isMatrixValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Parameter \\#1 \\$power of method Complex\\\\Complex\\:\\:pow\\(\\) expects float\\|int, float\\|int\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isMatrixValue\\(\\) has parameter \\$idx with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBase\\:\\:validatePlaces\\(\\) has parameter \\$places with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertBase\\:\\:validateValue\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isValue\\(\\) has parameter \\$idx with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Cannot access offset 'AllowPrefix' on mixed\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:operandSpecialHandling\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Cannot access offset 'Group' on mixed\\.$#" - count: 9 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:operandSpecialHandling\\(\\) has parameter \\$operand with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Functions.php - - message: "#^Cannot access offset 'Unit Name' on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Internal\\\\MakeMatrix\\:\\:make\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + path: src/PhpSpreadsheet/Calculation/Internal/MakeMatrix.php - - message: "#^Cannot access offset 'multiplier' on mixed\\.$#" + message: "#^Call to function is_string\\(\\) with null will always evaluate to false\\.$#" count: 3 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + path: src/PhpSpreadsheet/Calculation/Logical/Operations.php - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + message: "#^Result of && is always false\\.$#" + count: 3 + path: src/PhpSpreadsheet/Calculation/Logical/Operations.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:getUOMDetails\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:CHOOSE\\(\\) has parameter \\$chooseArgs with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + path: src/PhpSpreadsheet/Calculation/LookupRef.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:resolveTemperatureSynonyms\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:OFFSET\\(\\) should return array\\|string but returns array\\|int\\|string\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + path: src/PhpSpreadsheet/Calculation/LookupRef.php - - message: "#^Parameter \\#1 \\$uom of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ConvertUOM\\:\\:getUOMDetails\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:sheetName\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:erfValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:erfValue\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\Erf\\:\\:\\$twoSqrtPi has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/Erf.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:erfcValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:erfcValue\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$keySet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\\\ErfC\\:\\:\\$oneSqrtPi has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Engineering/ErfC.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Parameter \\#1 \\$message of class PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Exception constructor expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Exception.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Parameter \\#2 \\$code of class PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Exception constructor expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Exception.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, array\\{'PhpOffice\\\\\\\\PhpSpreadsheet\\\\\\\\Calculation\\\\\\\\Exception', 'errorHandlerCallback'\\} given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/ExceptionHandler.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:ISPMT\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:ISPMT\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:NPV\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has parameter \\$lookupArray with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has parameter \\$matchType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$futureValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateLookupArray\\(\\) has parameter \\$lookupArray with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$numberOfPeriods with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateLookupValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$payment with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateMatchType\\(\\) has parameter \\$matchType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$presentValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Lookup\\:\\:verifyResultVector\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$rate with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Lookup\\:\\:verifyResultVector\\(\\) has parameter \\$resultVector with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:rateNextGuess\\(\\) has parameter \\$type with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\LookupBase\\:\\:validateIndexLookup\\(\\) has parameter \\$index_number with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\Interest\\:\\:schedulePayment\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php - - message: "#^Binary operation \"\\-\" between float\\|string and 0\\|float results in an error\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\InterestAndPrincipal\\:\\:\\$interest has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has parameter \\$columns with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Constant\\\\Periodic\\\\InterestAndPrincipal\\:\\:\\$principal has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has parameter \\$width with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/InterestAndPrincipal.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Parameter \\#4 \\$x2 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Variable\\\\NonPeriodic\\:\\:xirrPart3\\(\\) expects float, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$endCellRow with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\CashFlow\\\\Variable\\\\Periodic\\:\\:presentValue\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$height with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateCost\\(\\) has parameter \\$cost with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$rows with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateFactor\\(\\) has parameter \\$factor with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:extractRequiredCells\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateLife\\(\\) has parameter \\$life with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:extractWorksheet\\(\\) has parameter \\$cellAddress with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateMonth\\(\\) has parameter \\$month with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + message: "#^Parameter \\#1 \\$columnAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:columnIndexFromString\\(\\) expects string, string\\|null given\\.$#" + count: 3 + path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validatePeriod\\(\\) has parameter \\$period with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Depreciation\\:\\:validateSalvage\\(\\) has parameter \\$salvage with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has parameter \\$a with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Financial/Depreciation.php + path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Cannot cast mixed to int\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has parameter \\$b with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php + message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(T, T\\)\\: int, array\\{'self', 'vlookupSort'\\} given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Parameter \\#1 \\$x of function fmod expects float, mixed given\\.$#" + message: "#^Binary operation \"/\" between array\\|float\\|int\\|string and array\\|float\\|int\\|string results in an error\\.$#" count: 2 - path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php + path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php - - message: "#^Binary operation \"/\" between float\\|string and float\\|string results in an error\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php + message: "#^Parameter \\#1 \\$factVal of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Factorial\\:\\:fact\\(\\) expects array\\|float, int\\\\|int\\<0, max\\> given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php - - message: "#^Cannot call method getTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + message: "#^Binary operation \"/\" between array\\|float\\|int\\|string and float\\|int results in an error\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php - - message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 9 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\IntClass\\:\\:evaluate\\(\\) should return array\\|string but returns int\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php - - message: "#^Cannot call method setTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 5 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + message: "#^PHPDoc tag @var for constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:CALL_FUNCTIONS with type array\\ is not subtype of value array\\{1\\: array\\{'PhpOffice…', 'average'\\}, 2\\: array\\{'PhpOffice…', 'COUNT'\\}, 3\\: array\\{'PhpOffice…', 'COUNTA'\\}, 4\\: array\\{'PhpOffice…', 'max'\\}, 5\\: array\\{'PhpOffice…', 'min'\\}, 6\\: array\\{'PhpOffice…', 'product'\\}, 7\\: array\\{'PhpOffice…', 'STDEV'\\}, 8\\: array\\{'PhpOffice…', 'STDEVP'\\}, \\.\\.\\.\\}\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php - - message: "#^Cannot call method setValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 5 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MAXIFS\\(\\) should return float but returns float\\|string\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Statistical.php - - message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken and null will always evaluate to false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MINIFS\\(\\) should return float but returns float\\|string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + path: src/PhpSpreadsheet/Calculation/Statistical.php - - message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:filterArguments\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php + path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php - - message: "#^Cannot call method getCell\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:filterArguments\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:modeCalc\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:ifCondition\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:modeCalc\\(\\) has parameter \\$data with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:ifCondition\\(\\) has parameter \\$condition with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:SUMIF\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isCellValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditionSet\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isCellValue\\(\\) has parameter \\$idx with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditionSetForValueRange\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isMatrixValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditions\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isMatrixValue\\(\\) has parameter \\$idx with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDataSet\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDatabase\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:isValue\\(\\) has parameter \\$idx with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDatabaseWithValueRange\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:operandSpecialHandling\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheP has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Functions\\:\\:operandSpecialHandling\\(\\) has parameter \\$operand with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheQ has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php - - message: "#^Parameter \\#1 \\$number of function abs expects float\\|int\\|string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheResult has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Functions.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Internal\\\\MakeMatrix\\:\\:make\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:MAX_ITERATIONS is unused\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Internal/MakeMatrix.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Call to function is_string\\(\\) with null will always evaluate to false\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Logical/Operations.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Result of && is always false\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/Logical/Operations.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has parameter \\$n with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:CHOOSE\\(\\) has parameter \\$chooseArgs with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has parameter \\$x with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:HYPERLINK\\(\\) should return string but returns mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:OFFSET\\(\\) should return array\\|string but returns array\\|int\\|string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has parameter \\$n with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:sheetName\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has parameter \\$x with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#1 \\$row of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsA1\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#1 \\$row of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsR1C1\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has parameter \\$n with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#1 \\$sheetName of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:sheetName\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has parameter \\$x with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#2 \\$column of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsA1\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#2 \\$column of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsR1C1\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has parameter \\$chi2 with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#3 \\$relativity of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsA1\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has parameter \\$degrees with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#3 \\$relativity of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Address\\:\\:formatAsR1C1\\(\\) expects int, mixed given\\.$#" + message: "#^Parameter \\#2 \\$columns of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:degrees\\(\\) expects int, float\\|int\\<0, max\\> given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Address.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Cannot cast mixed to int\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:calculateDistribution\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:calculateInverse\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma1\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchFirstValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma2\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma3\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$keySet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma4\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:\\$logGammaCacheResult has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchLargestValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:\\$logGammaCacheX has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\NewtonRaphson\\:\\:execute\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\NewtonRaphson\\:\\:\\$callback has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:matchSmallestValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:inverseNcdf\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:inverseNcdf\\(\\) has parameter \\$p with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Parameter \\#1 \\$factVal of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Factorial\\:\\:fact\\(\\) expects array\\|float, int\\<0, max\\> given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:prepareLookupArray\\(\\) has parameter \\$matchType with no type specified\\.$#" + message: "#^Binary operation \"\\-\" between float\\|string and float\\|int\\|numeric\\-string results in an error\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateLookupArray\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:MAX_ITERATIONS is unused\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateLookupValue\\(\\) has parameter \\$lookupValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\MaxMinBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/MaxMinBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\ExcelMatch\\:\\:validateMatchType\\(\\) has parameter \\$matchType with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\MaxMinBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php + path: src/PhpSpreadsheet/Calculation/Statistical/MaxMinBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Formula\\:\\:text\\(\\) should return string but returns mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:percentileFilterValues\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Formula.php + path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:rankFilterValues\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Formula.php + path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php - - message: "#^Parameter \\#1 \\$lookupArray of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\HLookup\\:\\:convertLiteralArray\\(\\) expects array, mixed given\\.$#" + message: "#^Binary operation \"/\" between array\\|float\\|int\\|string and array\\|float\\|int\\|string results in an error\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php + path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:strToLower\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:GROWTH\\(\\) should return array\\ but returns array\\\\>\\>\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php + path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:TREND\\(\\) should return array\\ but returns array\\\\>\\>\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Helpers.php + path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:checkTrendArrays\\(\\) has parameter \\$array1 with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Helpers.php + path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:checkTrendArrays\\(\\) has parameter \\$array2 with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php - - message: "#^Parameter \\#1 \\$tooltip of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Hyperlink\\:\\:setTooltip\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php + path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php - - message: "#^Parameter \\#1 \\$url of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Hyperlink\\:\\:setUrl\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php + path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Indirect\\:\\:INDIRECT\\(\\) should return array\\|string but returns mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentBooleans\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php + path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Lookup\\:\\:verifyResultVector\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentBooleans\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php + path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Lookup\\:\\:verifyResultVector\\(\\) has parameter \\$resultVector with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\:\\:CONCATENATE\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php + path: src/PhpSpreadsheet/Calculation/TextData.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\LookupBase\\:\\:checkMatch\\(\\) has parameter \\$notExactMatch with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php + message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" + count: 4 + path: src/PhpSpreadsheet/Calculation/TextData/Extract.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\LookupBase\\:\\:validateIndexLookup\\(\\) has no return type specified\\.$#" + message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php + path: src/PhpSpreadsheet/Calculation/TextData/Text.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\LookupBase\\:\\:validateIndexLookup\\(\\) has parameter \\$index_number with no type specified\\.$#" + message: "#^Elseif branch is unreachable because previous condition is always true\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\LookupBase\\:\\:validateIndexLookup\\(\\) has parameter \\$lookup_array with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:getFormulaAttributes\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Parameter \\#1 \\$message of class PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Exception constructor expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$format of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:toFormattedString\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:\\$formulaAttributes has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Binary operation \"\\+\\=\" between string and mixed results in an error\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\) in isset\\(\\) is not nullable\\.$#" + count: 6 + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Cell/Cell.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has no return type specified\\.$#" + message: "#^Call to an undefined method object\\:\\:getHashCode\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Cell/Coordinate.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has parameter \\$columns with no type specified\\.$#" + message: "#^Parameter \\#4 \\$currentRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:validateRange\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Cell/Coordinate.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adjustEndCellColumnForWidth\\(\\) has parameter \\$width with no type specified\\.$#" + message: "#^Parameter \\#5 \\$endRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:validateRange\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Cell/Coordinate.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$endCellRow with no type specified\\.$#" + message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:substring\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Cell/DataType.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$height with no type specified\\.$#" + message: "#^Parameter \\#1 \\$angle of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowAngle\\(\\) expects int, int\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Chart/Axis.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:adustEndCellRowForHeight\\(\\) has parameter \\$rows with no type specified\\.$#" + message: "#^Parameter \\#1 \\$blur of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowBlur\\(\\) expects float, float\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Chart/Axis.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:extractRequiredCells\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#1 \\$distance of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowDistance\\(\\) expects float, float\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Chart/Axis.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Offset\\:\\:extractWorksheet\\(\\) has parameter \\$cellAddress with no type specified\\.$#" + message: "#^Parameter \\#2 \\$alpha of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowColor\\(\\) expects int, int\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Chart/Axis.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Call to an undefined method object\\:\\:render\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightXOffset\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$columnAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:columnIndexFromString\\(\\) expects string, string\\|null given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightYOffset\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php - - - - message: "#^Parameter \\#1 \\$low of function range expects float\\|int\\|string, string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftXOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#2 \\$high of function range expects float\\|int\\|string, string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftYOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has parameter \\$cell with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Cannot access offset \\(int\\|string\\) on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Cannot access offset int\\|string\\|null on mixed\\.$#" - count: 3 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Cannot access offset mixed on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vLookupSearch\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vLookupSearch\\(\\) has parameter \\$column with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vLookupSearch\\(\\) has parameter \\$lookupArray with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vLookupSearch\\(\\) has parameter \\$lookupValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vLookupSearch\\(\\) has parameter \\$notExactMatch with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$legend \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has parameter \\$a with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$majorGridlines \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\VLookup\\:\\:vlookupSort\\(\\) has parameter \\$b with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$minorGridlines \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$array_arg of function uasort expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$plotArea \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$title \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(mixed, mixed\\)\\: int, array\\{'self', 'vlookupSort'\\} given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Cosine\\:\\:acos\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$xAxis \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Cosine\\:\\:acosh\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$xAxisLabel \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Sine\\:\\:asin\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$yAxis \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Sine\\:\\:asinh\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$yAxisLabel \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + path: src/PhpSpreadsheet/Chart/Chart.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Tangent\\:\\:atan\\(\\) expects float, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues and null will always evaluate to false\\.$#" + count: 2 + path: src/PhpSpreadsheet/Chart/DataSeries.php - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Trig\\\\Tangent\\:\\:atanh\\(\\) expects float, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:refresh\\(\\) has parameter \\$flatten with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig.php + path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$dataSource \\(string\\) does not accept string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php + path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int\\|string results in an error\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$dataTypeValues has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int results in an error\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$fillColor \\(array\\\\|string\\) does not accept array\\\\|string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php + path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Cannot call method getWorksheet\\(\\) on mixed\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php + message: "#^Parameter \\#1 \\$angle of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setShadowAngle\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:evaluate\\(\\) should return float\\|string but returns mixed\\.$#" + message: "#^Parameter \\#1 \\$color of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^PHPDoc tag @var for constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Subtotal\\:\\:CALL_FUNCTIONS with type array\\ is not subtype of value array\\{1\\: array\\{'PhpOffice…', 'average'\\}, 2\\: array\\{'PhpOffice…', 'COUNT'\\}, 3\\: array\\{'PhpOffice…', 'COUNTA'\\}, 4\\: array\\{'PhpOffice…', 'max'\\}, 5\\: array\\{'PhpOffice…', 'min'\\}, 6\\: array\\{'PhpOffice…', 'product'\\}, 7\\: array\\{'PhpOffice…', 'STDEV'\\}, 8\\: array\\{'PhpOffice…', 'STDEVP'\\}, \\.\\.\\.\\}\\.$#" + message: "#^Parameter \\#1 \\$distance of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setShadowDistance\\(\\) expects float, float\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Parameter \\#1 \\$input of function array_filter expects array, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php + message: "#^Parameter \\#2 \\$alpha of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php + message: "#^Parameter \\#3 \\$colorType of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MAXIFS\\(\\) should return float but returns float\\|string\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$glowProperties has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MINIFS\\(\\) should return float but returns float\\|string\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$lineProperties has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:AVERAGEIF\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$objectState has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:COUNTIF\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$shadowProperties has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Binary operation \"\\-\" between mixed and float\\|string results in an error\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$softEdges has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php + path: src/PhpSpreadsheet/Chart/GridLines.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:filterArguments\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php + path: src/PhpSpreadsheet/Chart/Legend.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:filterArguments\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\:\\:\\$positionXLref has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php + path: src/PhpSpreadsheet/Chart/Legend.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:modeCalc\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php + path: src/PhpSpreadsheet/Chart/PlotArea.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Averages\\:\\:modeCalc\\(\\) has parameter \\$data with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:SUMIF\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has parameter \\$elements with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditionSet\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has parameter \\$properties with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditionSetForValueRange\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildConditions\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has parameter \\$arrayKaySelector with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDataSet\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has parameter \\$arraySelector with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDatabase\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getShadowPresetsMap\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:buildDatabaseWithValueRange\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getShadowPresetsMap\\(\\) has parameter \\$presetsOption with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:AVERAGEIF\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getTrueAlpha\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:COUNTIF\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getTrueAlpha\\(\\) has parameter \\$alpha with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:databaseFromRangeAndValue\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#2 \\$condition of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:AVERAGEIF\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$alpha with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#2 \\$valueRange of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:databaseFromRangeAndValue\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$color with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Parameter \\#3 \\$averageRange of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Conditional\\:\\:AVERAGEIF\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$colorType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php + path: src/PhpSpreadsheet/Chart/Properties.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheP has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheQ has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$datasetLabels with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheResult has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:regularizedIncompleteBeta\\(\\) is unused\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$labelCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:MAX_ITERATIONS is unused\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$rotation with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has parameter \\$n with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has parameter \\$markerID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gammp\\(\\) has parameter \\$x with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has parameter \\$seriesPlot with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:getCaption\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has parameter \\$n with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:getCaption\\(\\) has parameter \\$captionElement with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gcf\\(\\) has parameter \\$x with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has parameter \\$dataValues with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has parameter \\$n with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has parameter \\$sumValues with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:gser\\(\\) has parameter \\$x with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has parameter \\$chi2 with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has parameter \\$seriesCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has parameter \\$degrees with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderAreaChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderAreaChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#2 \\$columns of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:degrees\\(\\) expects int, float\\|int\\<0, max\\> given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBarChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:calculateDistribution\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBarChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:calculateInverse\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBubbleChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma1\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCartesianPlotArea\\(\\) has parameter \\$type with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma2\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma3\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:logGamma4\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:\\$logGammaCacheResult has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$outputDestination with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:\\$logGammaCacheX has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderContourChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\NewtonRaphson\\:\\:execute\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderContourChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\NewtonRaphson\\:\\:\\$callback has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderLineChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:inverseNcdf\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderLineChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:inverseNcdf\\(\\) has parameter \\$p with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Binary operation \"\\-\" between float\\|string and float\\|int\\|numeric\\-string results in an error\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$doughnut with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Constant PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:MAX_ITERATIONS is unused\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\MaxMinBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$multiplePlots with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/MaxMinBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\MaxMinBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotBar\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/MaxMinBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:percentileFilterValues\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotBar\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:rankFilterValues\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotContour\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Binary operation \"/\" between float\\|int\\|string and float\\|int\\|string results in an error\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$combination with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:GROWTH\\(\\) should return array\\ but returns array\\\\>\\>\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$dimensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:TREND\\(\\) should return array\\ but returns array\\\\>\\>\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$filled with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:checkTrendArrays\\(\\) has parameter \\$array1 with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:checkTrendArrays\\(\\) has parameter \\$array2 with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotRadar\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotScatter\\(\\) has parameter \\$bubble with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentAllowStrings\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotScatter\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentBooleans\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotStock\\(\\) has parameter \\$groupID with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\VarianceBase\\:\\:datatypeAdjustmentBooleans\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderRadarChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Statistical/VarianceBase.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\:\\:CONCATENATE\\(\\) has parameter \\$args with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderScatterChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\:\\:SEARCHINSENSITIVE\\(\\) should return string but returns int\\|string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderStockChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\:\\:SEARCHSENSITIVE\\(\\) should return string but returns int\\|string\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$chart has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\:\\:TRIMNONPRINTABLE\\(\\) should return string but returns string\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$colourSet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#1 \\$glue of function implode expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$graph has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Concatenate.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/TextData/Extract.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$height has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$markSet has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\TextData\\\\Format\\:\\:VALUE\\(\\) should return DateTimeInterface\\|float\\|int\\|string but returns mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$plotColour has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#1 \\$dateValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\DateValue\\:\\:fromString\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$plotMark has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$width has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + path: src/PhpSpreadsheet/Chart/Title.php - - message: "#^Parameter \\#1 \\$timeValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\TimeValue\\:\\:fromString\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Memory\\:\\:\\$cache has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + path: src/PhpSpreadsheet/Collection/Memory.php - - message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$namedRange of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:addNamedRange\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\NamedRange, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\) given\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + path: src/PhpSpreadsheet/DefinedName.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:\\$scope \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + count: 3 + path: src/PhpSpreadsheet/DefinedName.php - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Helpers.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/DefinedName.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Cannot use array destructuring on array\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Helpers.php + path: src/PhpSpreadsheet/Helper/Dimension.php - - message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Text.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Cannot access offset 'value' on mixed\\.$#" + message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has no return type specified\\.$#" + message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$onlyIf with no type specified\\.$#" + message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$onlyIfNot with no type specified\\.$#" + message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$reference with no type specified\\.$#" + message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$storeKey with no type specified\\.$#" + message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$type with no type specified\\.$#" + message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Token\\\\Stack\\:\\:getStackItem\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Calculation/Token/Stack.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$dateValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:stringToExcel\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:startFontTag\\(\\) has parameter \\$tag with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + message: "#^Parameter \\#1 \\$text of method PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\ITextElement\\:\\:setText\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\AdvancedValueBinder\\:\\:setPercentage\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$bold has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\AdvancedValueBinder\\:\\:setTimeHoursMinutes\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$color has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\AdvancedValueBinder\\:\\:setTimeHoursMinutesSeconds\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$colourMap has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" - count: 7 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$endTagCallbacks has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Cell/AdvancedValueBinder.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$face has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 2 - path: src/PhpSpreadsheet/Cell/Cell.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$italic has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Elseif branch is unreachable because previous condition is always true\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$size has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:getFormulaAttributes\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$stack has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\DataType\\:\\:checkString\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText\\|string\\|null, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$startTagCallbacks has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#2 \\$format of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:toFormattedString\\(\\) expects string, string\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$strikethrough has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:\\$formulaAttributes has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$stringData has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\) in isset\\(\\) is not nullable\\.$#" - count: 6 - path: src/PhpSpreadsheet/Cell/Cell.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$subscript has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$superscript has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Cell.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Call to an undefined method object\\:\\:getHashCode\\(\\)\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$underline has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Cannot use array destructuring on array\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Sample\\:\\:getSamples\\(\\) should return array\\\\> but returns array\\\\>\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Cell/Coordinate.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Sample\\:\\:log\\(\\) has parameter \\$message with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#1 \\$cellAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:absoluteCoordinate\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$directory of class RecursiveDirectoryIterator constructor expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#1 \\$cellAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:coordinateFromString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$filename of function unlink expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php - - - - message: "#^Parameter \\#1 \\$input of function array_chunk expects array, array\\\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$path of function pathinfo expects string, array\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, array\\\\|string given\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#4 \\$currentRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:validateRange\\(\\) expects int, string given\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/Helper/Sample.php - - message: "#^Parameter \\#5 \\$endRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:validateRange\\(\\) expects int, string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:createReader\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\IReader but returns object\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/Coordinate.php + path: src/PhpSpreadsheet/IOFactory.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:createWriter\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\IWriter but returns object\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/DataType.php + path: src/PhpSpreadsheet/IOFactory.php - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:substring\\(\\) expects string, string\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:\\$readers has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/DataType.php + path: src/PhpSpreadsheet/IOFactory.php - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:\\$writers has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/DataValidator.php + path: src/PhpSpreadsheet/IOFactory.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\BaseReader\\:\\:getSecurityScanner\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/DefaultValueBinder.php + path: src/PhpSpreadsheet/Reader/BaseReader.php - - message: "#^Parameter \\#1 \\$str of function ltrim expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\BaseReader\\:\\:\\$fileHandle has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/DefaultValueBinder.php + path: src/PhpSpreadsheet/Reader/BaseReader.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Cell/DefaultValueBinder.php + message: "#^Comparison operation \"\\<\" between int and SimpleXMLElement\\|null results in an error\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Gnumeric.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Offset 'percentage' does not exist on SimpleXMLElement\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Cell/StringValueBinder.php + path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php - - message: "#^Cannot access offset 'alpha' on mixed\\.$#" + message: "#^Offset 'value' does not exist on SimpleXMLElement\\|null\\.$#" count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php - - message: "#^Cannot access offset 'size' on mixed\\.$#" - count: 4 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Variable \\$orientation on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php - - message: "#^Cannot access offset 'type' on mixed\\.$#" - count: 4 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Comparison operation \"\\<\\=\" between SimpleXMLElement\\|null and int results in an error\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Gnumeric/Styles.php - - message: "#^Cannot access offset 'value' on mixed\\.$#" + message: "#^Comparison operation \"\\>\" between SimpleXMLElement\\|null and int results in an error\\.$#" count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Gnumeric/Styles.php - - message: "#^Cannot access offset \\(int\\|string\\) on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Html.php - - message: "#^Cannot access offset string on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Cannot call method children\\(\\) on SimpleXMLElement\\|false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Cannot cast mixed to int\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Cannot call method getAttributeNS\\(\\) on DOMElement\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Cannot call method getElementsByTagNameNS\\(\\) on DOMElement\\|null\\.$#" count: 2 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:getAxisNumberFormat\\(\\) should return string but returns mixed\\.$#" + message: "#^Cannot call method getNamedItem\\(\\) on DOMNamedNodeMap\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:getAxisOptionsProperty\\(\\) should return string but returns mixed\\.$#" + message: "#^Cannot call method getNamespaces\\(\\) on SimpleXMLElement\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:getFillProperty\\(\\) should return string but returns mixed\\.$#" + message: "#^Cannot call method setSelectedCellByColumnAndRow\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:getLineProperty\\(\\) should return string but returns mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:listWorksheetNames\\(\\) should return array\\ but returns array\\\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:getSoftEdgesSize\\(\\) should return string but returns mixed\\.$#" + message: "#^Parameter \\#1 \\$element of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:scanElementForText\\(\\) expects DOMNode, DOMElement\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Parameter \\#1 \\$angle of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowAngle\\(\\) expects int, int\\|null given\\.$#" + message: "#^Parameter \\#1 \\$settings of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:lookForActiveSheet\\(\\) expects DOMElement, DOMElement\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Parameter \\#1 \\$blur of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowBlur\\(\\) expects float, float\\|null given\\.$#" + message: "#^Parameter \\#1 \\$settings of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:lookForSelectedCells\\(\\) expects DOMElement, DOMElement\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods.php - - message: "#^Parameter \\#1 \\$color of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setGlowColor\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Cannot call method getElementsByTagNameNS\\(\\) on DOMElement\\|null\\.$#" + count: 3 + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Parameter \\#1 \\$color of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowColor\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" + count: 6 + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Parameter \\#1 \\$distance of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowDistance\\(\\) expects float, float\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$masterPrintStylesCrossReference has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Parameter \\#2 \\$alpha of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowColor\\(\\) expects int, int\\|string given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$masterStylesCrossReference has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Parameter \\#3 \\$alphaType of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setShadowColor\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$officeNs has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Parameter \\#3 \\$colorType of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\:\\:setGlowColor\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$pageLayoutStyles has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Axis.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Call to an undefined method object\\:\\:render\\(\\)\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$stylesFo has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightXOffset\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$stylesNs has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightYOffset\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:load\\(\\) has parameter \\$namespacesMeta with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftXOffset\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setMetaProperties\\(\\) has parameter \\$namespacesMeta with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftYOffset\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setMetaProperties\\(\\) has parameter \\$propertyName with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setUserDefinedProperty\\(\\) has parameter \\$propertyValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has parameter \\$cell with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setUserDefinedProperty\\(\\) has parameter \\$propertyValueAttributes with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:\\$spreadsheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Ods/Properties.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:__construct\\(\\) has parameter \\$pattern with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:getInstance\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:threadSafeLibxmlDisableEntityLoaderAvailability\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:toUtf8\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:toUtf8\\(\\) has parameter \\$xml with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#2 \\$subject of function preg_match expects string, array\\\\|string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:\\$callback has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$legend \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:\\$libxmlDisableEntityLoaderValue has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$majorGridlines \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null\\.$#" + message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:getDgContainer\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$minorGridlines \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null\\.$#" + message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:getDggContainer\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$name \\(string\\) does not accept mixed\\.$#" + message: "#^Call to an undefined method object\\:\\:getEndCoordinates\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$plotArea \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\|null\\.$#" + message: "#^Call to an undefined method object\\:\\:getEndOffsetX\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$plotVisibleOnly \\(bool\\) does not accept mixed\\.$#" + message: "#^Call to an undefined method object\\:\\:getEndOffsetY\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$title \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" + message: "#^Call to an undefined method object\\:\\:getNestingLevel\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + message: "#^Call to an undefined method object\\:\\:getOPT\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$xAxis \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + message: "#^Call to an undefined method object\\:\\:getStartCoordinates\\(\\)\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$xAxisLabel \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" + message: "#^Call to an undefined method object\\:\\:getStartOffsetX\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$yAxis \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null\\.$#" + message: "#^Call to an undefined method object\\:\\:getStartOffsetY\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$yAxisLabel \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null\\.$#" + message: "#^Cannot access offset 1 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Chart.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries\\:\\:\\$plotGrouping \\(string\\) does not accept mixed\\.$#" + message: "#^If condition is always true\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeries.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries\\:\\:\\$plotType \\(string\\) does not accept mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:includeCellRangeFiltered\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeries.php - - - - message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues and null will always evaluate to false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/DataSeries.php - - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:includeCellRangeFiltered\\(\\) has parameter \\$cellRangeAddress with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:refresh\\(\\) has parameter \\$flatten with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:parseRichText\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:parseRichText\\(\\) has parameter \\$is with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$stack of function array_shift expects array, mixed given\\.$#" + message: "#^Negated boolean expression is always false\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + message: "#^Parameter \\#1 \\$block of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:makeKey\\(\\) expects int, float given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$showSummaryBelow of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:setShowSummaryBelow\\(\\) expects bool, int given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$dataSource \\(string\\) does not accept string\\|null\\.$#" + message: "#^Parameter \\#1 \\$showSummaryRight of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:setShowSummaryRight\\(\\) expects bool, int given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$dataTypeValues has no type specified\\.$#" + message: "#^Parameter \\#2 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\IReadFilter\\:\\:readCell\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$dataValues \\(array\\) does not accept mixed\\.$#" + message: "#^Parameter \\#2 \\$row of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:sizeRow\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$fillColor \\(array\\\\|string\\) does not accept array\\\\|string\\|null\\.$#" + message: "#^Parameter \\#2 \\$startRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:getDistanceY\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$formatCode \\(string\\) does not accept mixed\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\:\\:\\$pointMarker \\(string\\) does not accept mixed\\.$#" + message: "#^Parameter \\#4 \\$endRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:getDistanceY\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Cannot access offset \\(int\\|string\\) on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Chart/GridLines.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$data \\(string\\) does not accept string\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$angle of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setShadowAngle\\(\\) expects int, int\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) does not accept string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$color of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$distance of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setShadowDistance\\(\\) expects float, float\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$md5Ctxt is never written, only read\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#2 \\$alpha of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects int, int\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$summaryInformation \\(string\\) does not accept string\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#3 \\$colorType of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$summaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$glowProperties has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 8 + path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$lineProperties has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BIFF5\\:\\:\\$map has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$objectState has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BIFF8\\:\\:\\$map has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$shadowProperties has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BuiltIn\\:\\:\\$map has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$softEdges has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\ErrorCode\\:\\:\\$map has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/GridLines.php + path: src/PhpSpreadsheet/Reader/Xls/ErrorCode.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:f\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Legend.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\:\\:\\$positionXLref has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:g\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Legend.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:h\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/PlotArea.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:i\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has parameter \\$elements with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:rotate\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getArrayElementsValue\\(\\) has parameter \\$properties with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:step\\(\\) has parameter \\$func with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$i has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/RC4.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has parameter \\$arrayKaySelector with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$j has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/RC4.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getLineStyleArrowSize\\(\\) has parameter \\$arraySelector with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$s has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xls/RC4.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getShadowPresetsMap\\(\\) has no return type specified\\.$#" + message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getShadowPresetsMap\\(\\) has parameter \\$presetsOption with no type specified\\.$#" + message: "#^Cannot access offset 0 on array\\\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getTrueAlpha\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + message: "#^Cannot access property \\$r on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:getTrueAlpha\\(\\) has parameter \\$alpha with no type specified\\.$#" + message: "#^Cannot call method addChart\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has no return type specified\\.$#" + message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$alpha with no type specified\\.$#" + message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$color with no type specified\\.$#" + message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Properties\\:\\:setColorProperties\\(\\) has parameter \\$colorType with no type specified\\.$#" + message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has no return type specified\\.$#" + message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$datasetLabels with no type specified\\.$#" + message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$labelCount with no type specified\\.$#" + message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatDataSetLabels\\(\\) has parameter \\$rotation with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has no return type specified\\.$#" + message: "#^Comparison operation \"\\>\" between SimpleXMLElement\\|null and 0 results in an error\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has parameter \\$markerID with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:formatPointMarker\\(\\) has parameter \\$seriesPlot with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:getCaption\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:getCaption\\(\\) has parameter \\$captionElement with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has parameter \\$c with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has parameter \\$dataValues with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has parameter \\$c with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageAdjustValues\\(\\) has parameter \\$sumValues with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$c with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$calculatedValue with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$castBaseType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:percentageSumCalculation\\(\\) has parameter \\$seriesCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$cellDataType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderAreaChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$r with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderAreaChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$sharedFormulas with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBarChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBarChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderBubbleChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has parameter \\$c with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCartesianPlotArea\\(\\) has parameter \\$type with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$add with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$base with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderCombinationChart\\(\\) has parameter \\$outputDestination with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$array with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderContourChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$key with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderContourChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderLineChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getFromZipArchive\\(\\) should return string but returns string\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderLineChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$dir with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$docSheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$doughnut with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$dir with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPieChart\\(\\) has parameter \\$multiplePlots with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$docSheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotBar\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotBar\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotContour\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$combination with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$dimensions with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has parameter \\$style with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$filled with no type specified\\.$#" + message: "#^Negated boolean expression is always true\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotLine\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Parameter \\#1 \\$fontSizeInPoints of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:fontSizeToPixels\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotRadar\\(\\) has parameter \\$groupID with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + message: "#^Parameter \\#1 \\$haystack of function strpos expects string, int\\|string given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotScatter\\(\\) has parameter \\$bubble with no type specified\\.$#" + message: "#^Parameter \\#1 \\$sizeInCm of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:centimeterSizeToPixels\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotScatter\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Parameter \\#1 \\$sizeInInch of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:inchSizeToPixels\\(\\) expects int, string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderPlotStock\\(\\) has parameter \\$groupID with no type specified\\.$#" + message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, array\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderRadarChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.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\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderScatterChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$autoFilterRange with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:renderStockChart\\(\\) has parameter \\$groupCount with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$xmlSheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$chart has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.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\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$colourSet has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$graph has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:\\$worksheetXml has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$height has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\BaseParserClass\\:\\:boolean\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$markSet has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\BaseParserClass\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$plotColour has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + message: "#^Cannot call method getFont\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run\\|null\\.$#" + count: 12 + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$plotMark has no type specified\\.$#" + message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Renderer\\\\JpGraph\\:\\:\\$width has no type specified\\.$#" + message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Renderer/JpGraph.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#" + message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Chart/Title.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method attach\\(\\) on mixed\\.$#" + message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Collection/Cells.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\:\\:get\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null but returns mixed\\.$#" + message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Collection/Cells.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\:\\:\\$currentCell \\(PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\) does not accept mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Collection/Cells.php + message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Memory\\:\\:\\$cache has no type specified\\.$#" + message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Collection/Memory.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$namedRange of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:addNamedRange\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\NamedRange, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\) given\\.$#" + message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/DefinedName.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:\\$scope \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 3 - path: src/PhpSpreadsheet/DefinedName.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/DefinedName.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot cast mixed to float\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Document/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot cast mixed to int\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$chartDetail with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Document/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$timestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:intOrFloatTimestamp\\(\\) expects float\\|int\\|string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Document/Properties.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot use array destructuring on array\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$plotType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Dimension.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$marker with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$seriesDetail with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has parameter \\$dataType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has parameter \\$seriesValueSet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has parameter \\$dataType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:startFontTag\\(\\) has parameter \\$tag with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has parameter \\$seriesValueSet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\), mixed\\} given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$text of method PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\ITextElement\\:\\:setText\\(\\) expects string, string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has parameter \\$chartDetail with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$bold has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$color has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartTitle\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$colourMap has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:parseRichText\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$endTagCallbacks has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readChartAttributes\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$face has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readChartAttributes\\(\\) has parameter \\$chartDetail with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$italic has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$size has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has parameter \\$background with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$stack has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has parameter \\$color with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$startTagCallbacks has no type specified\\.$#" + message: "#^Parameter \\#1 \\$position of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend constructor expects string, bool\\|float\\|int\\|string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$strikethrough has no type specified\\.$#" + message: "#^Parameter \\#3 \\$overlay of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend constructor expects bool, bool\\|float\\|int\\|string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$stringData has no type specified\\.$#" + message: "#^Parameter \\#3 \\$plotOrder of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries constructor expects array\\, array\\ given\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$subscript has no type specified\\.$#" + message: "#^Parameter \\#4 \\$pointCount of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues constructor expects int, null given\\.$#" + count: 4 + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php + + - + message: "#^Parameter \\#6 \\$displayBlanksAs of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart constructor expects string, bool\\|float\\|int\\|string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$superscript has no type specified\\.$#" + message: "#^Parameter \\#7 \\$plotDirection of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries constructor expects string\\|null, bool\\|float\\|int\\|string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:\\$underline has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredColumn\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Cannot access offset 0 on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredColumn\\(\\) has parameter \\$columnCoordinate with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Sample\\:\\:getSamples\\(\\) should return array\\\\> but returns array\\\\>\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredRow\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Sample\\:\\:log\\(\\) has parameter \\$message with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:isFilteredRow\\(\\) has parameter \\$rowCoordinate with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#1 \\$directory of class RecursiveDirectoryIterator constructor expects string, string\\|false given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnAttributes\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#1 \\$filename of function unlink expects string, string\\|false given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#1 \\$path of function pathinfo expects string, array\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnRangeAttributes\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readColumnRangeAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|false given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readRowAttributes\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:readRowAttributes\\(\\) has parameter \\$readDataOnly with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Helper/Sample.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:createReader\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\IReader but returns object\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/IOFactory.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:createWriter\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\IWriter but returns object\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ColumnAndRowAttributes\\:\\:\\$worksheetXml has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/IOFactory.php + path: src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:\\$readers has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readConditionalStyles\\(\\) has parameter \\$xmlSheet with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/IOFactory.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\IOFactory\\:\\:\\$writers has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarExtLstOfConditionalRule\\(\\) has parameter \\$cfRule with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/IOFactory.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\BaseReader\\:\\:getSecurityScanner\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarExtLstOfConditionalRule\\(\\) has parameter \\$conditionalFormattingRuleExtensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/BaseReader.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\BaseReader\\:\\:\\$fileHandle has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarOfConditionalRule\\(\\) has parameter \\$cfRule with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/BaseReader.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readDataBarOfConditionalRule\\(\\) has parameter \\$conditionalFormattingRuleExtensions with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Gnumeric.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Comparison operation \"\\<\" between int and SimpleXMLElement\\|null results in an error\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Gnumeric.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has parameter \\$cfRules with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Gnumeric.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Offset 'percentage' does not exist on SimpleXMLElement\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:readStyleRules\\(\\) has parameter \\$extLst with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Offset 'value' does not exist on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.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: "#^Variable \\$orientation on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$dxfs has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Gnumeric/PageSetup.php + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Comparison operation \"\\<\\=\" between SimpleXMLElement\\|null and int results in an error\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Gnumeric/Styles.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$worksheet has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Comparison operation \"\\>\" between SimpleXMLElement\\|null and int results in an error\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Gnumeric/Styles.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\ConditionalStyles\\:\\:\\$worksheetXml has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\DataValidations\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php - - message: "#^Variable \\$value on left side of \\?\\? always exists and is not nullable\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\DataValidations\\:\\:\\$worksheetXml has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Html.php + path: src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php - - message: "#^Cannot call method children\\(\\) on SimpleXMLElement\\|false\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Hyperlinks\\:\\:\\$hyperlinks has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php - - message: "#^Cannot call method getAttributeNS\\(\\) on DOMElement\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Hyperlinks\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php - - message: "#^Cannot call method getElementsByTagNameNS\\(\\) on DOMElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Ods.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:load\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php - - message: "#^Cannot call method getNamedItem\\(\\) on DOMNamedNodeMap\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:pageSetup\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php - - message: "#^Cannot call method getNamespaces\\(\\) on SimpleXMLElement\\|false\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php - - message: "#^Cannot call method setSelectedCellByColumnAndRow\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\PageSetup\\:\\:\\$worksheetXml has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php - - message: "#^If condition is always true\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\SheetViewOptions\\:\\:\\$worksheet has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:listWorksheetNames\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\SheetViewOptions\\:\\:\\$worksheetXml has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php - - message: "#^Parameter \\#1 \\$element of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:scanElementForText\\(\\) expects DOMNode, DOMElement\\|null given\\.$#" + message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xml.php - - message: "#^Parameter \\#1 \\$settings of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:lookForActiveSheet\\(\\) expects DOMElement, DOMElement\\|null given\\.$#" + message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:convertEncoding\\(\\) expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xml.php - - message: "#^Parameter \\#1 \\$settings of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:lookForSelectedCells\\(\\) expects DOMElement, DOMElement\\|null given\\.$#" + message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods.php + path: src/PhpSpreadsheet/Reader/Xml.php - - message: "#^While loop condition is always true\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Ods.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xml\\:\\:\\$fileContents has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Reader/Xml.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/DefinedNames.php + path: src/PhpSpreadsheet/Reader/Xml/Properties.php - - message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, mixed given\\.$#" + message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/DefinedNames.php + path: src/PhpSpreadsheet/Reader/Xml/Style.php - - message: "#^Cannot call method getElementsByTagNameNS\\(\\) on DOMElement\\|null\\.$#" - count: 3 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + message: "#^Elseif condition is always true\\.$#" + count: 1 + path: src/PhpSpreadsheet/ReferenceHelper.php - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 6 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + count: 1 + path: src/PhpSpreadsheet/ReferenceHelper.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$masterPrintStylesCrossReference has no type specified\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/ReferenceHelper.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$masterStylesCrossReference has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run\\:\\:\\$font \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/RichText/Run.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$officeNs has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:getHttpClient\\(\\) should return Psr\\\\Http\\\\Client\\\\ClientInterface but returns Psr\\\\Http\\\\Client\\\\ClientInterface\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/Settings.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$pageLayoutStyles has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:getRequestFactory\\(\\) should return Psr\\\\Http\\\\Message\\\\RequestFactoryInterface but returns Psr\\\\Http\\\\Message\\\\RequestFactoryInterface\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/Settings.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$stylesFo has no type specified\\.$#" + message: "#^Negated boolean expression is always false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/Settings.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$stylesNs has no type specified\\.$#" + message: "#^Result of && is always false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/PageSettings.php + path: src/PhpSpreadsheet/Settings.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:load\\(\\) has parameter \\$namespacesMeta with no type specified\\.$#" + message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + path: src/PhpSpreadsheet/Settings.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setMetaProperties\\(\\) has parameter \\$namespacesMeta with no type specified\\.$#" + message: "#^Parameter \\#1 \\$excelFormatCode of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:isDateTimeFormatCode\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + path: src/PhpSpreadsheet/Shared/Date.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setMetaProperties\\(\\) has parameter \\$propertyName with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + message: "#^Parameter \\#1 \\$string of function substr expects string, int given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Shared/Date.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setUserDefinedProperty\\(\\) has parameter \\$propertyValue with no type specified\\.$#" + message: "#^Parameter \\#1 \\$unixTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:timestampToExcel\\(\\) expects int, float\\|int\\|string given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + path: src/PhpSpreadsheet/Shared/Date.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:setUserDefinedProperty\\(\\) has parameter \\$propertyValueAttributes with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:\\$possibleDateFormatCharacters has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + path: src/PhpSpreadsheet/Shared/Date.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\Properties\\:\\:\\$spreadsheet has no type specified\\.$#" + message: "#^Cannot access offset 1 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Ods/Properties.php + path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:__construct\\(\\) has parameter \\$pattern with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getDgId\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:getInstance\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getLastSpId\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:threadSafeLibxmlDisableEntityLoaderAvailability\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getSpgrContainer\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:toUtf8\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setDgId\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:toUtf8\\(\\) has parameter \\$xml with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setLastSpId\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, array\\\\|string\\|false given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setSpgrContainer\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:\\$callback has no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setSpgrContainer\\(\\) has parameter \\$spgrContainer with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Security\\\\XmlScanner\\:\\:\\$libxmlDisableEntityLoaderValue has no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:\\$spgrContainer has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Security/XmlScanner.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - message: "#^Parameter \\#4 \\$cellData of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Slk\\:\\:processCFinal\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\:\\:getChildren\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Slk.php + path: src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:getDgContainer\\(\\)\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:\\$parent is never read, only written\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:getDggContainer\\(\\)\\.$#" + message: "#^Cannot access offset 0 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getEndCoordinates\\(\\)\\.$#" + message: "#^Cannot access offset 2 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getEndOffsetX\\(\\)\\.$#" + message: "#^Cannot access offset 4 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getEndOffsetY\\(\\)\\.$#" + message: "#^Cannot access offset 6 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getNestingLevel\\(\\)\\.$#" + message: "#^Parameter \\#1 \\$size of function imagettfbbox expects float, float\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getOPT\\(\\)\\.$#" + message: "#^Parameter \\#2 \\$defaultFont of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:pixelsToCellDimension\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getStartCoordinates\\(\\)\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:\\$autoSizeMethods has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getStartOffsetX\\(\\)\\.$#" + message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Call to an undefined method object\\:\\:getStartOffsetY\\(\\)\\.$#" + message: "#^Variable \\$cellText on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/Font.php - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 4 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\EigenvalueDecomposition\\:\\:\\$cdivi has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php - - message: "#^Cannot access offset 1 on array\\|false\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\EigenvalueDecomposition\\:\\:\\$e has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php - - message: "#^Cannot access offset 1 on mixed\\.$#" - count: 7 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Else branch is unreachable because previous condition is always true\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php - - message: "#^If condition is always true\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\LUDecomposition\\:\\:getDoublePivot\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:includeCellRangeFiltered\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Call to function is_string\\(\\) with float\\|int will always evaluate to false\\.$#" + count: 5 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:includeCellRangeFiltered\\(\\) has parameter \\$cellRangeAddress with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:__construct\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:parseRichText\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayLeftDivide\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:parseRichText\\(\\) has parameter \\$is with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayLeftDivideEquals\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Negated boolean expression is always false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayRightDivide\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$block of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:makeKey\\(\\) expects int, float given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayRightDivideEquals\\(\\) has parameter \\$args with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$errorStyle of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\DataValidation\\:\\:setErrorStyle\\(\\) expects string, int\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayTimes\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayTimesEquals\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$operator of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\DataValidation\\:\\:setOperator\\(\\) expects string, int\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:concat\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$showSummaryBelow of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:setShowSummaryBelow\\(\\) expects bool, int given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:getMatrix\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$showSummaryRight of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:setShowSummaryRight\\(\\) expects bool, int given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:minus\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:minusEquals\\(\\) has parameter \\$args with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$type of method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\DataValidation\\:\\:setType\\(\\) expects string, int\\|string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:plus\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:plusEquals\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:power\\(\\) has parameter \\$args with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#2 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\IReadFilter\\:\\:readCell\\(\\) expects int, string given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:times\\(\\) has parameter \\$args with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#2 \\$row of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:sizeRow\\(\\) expects int, string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Parameter \\#3 \\$c of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:set\\(\\) expects float\\|int\\|null, string given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#2 \\$startRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:getDistanceY\\(\\) expects int, string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Result of && is always false\\.$#" + count: 10 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 19 + path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^If condition is always true\\.$#" + count: 7 + path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - message: "#^Parameter \\#4 \\$endRow of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:getDistanceY\\(\\) expects int, string given\\.$#" + message: "#^Left side of && is always true\\.$#" + count: 4 + path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php + + - + message: "#^Cannot access offset 1 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$data \\(string\\) does not accept string\\|null\\.$#" + message: "#^Cannot access offset 2 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) does not accept string\\|null\\.$#" + message: "#^Cannot access offset 3 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" + message: "#^Cannot access offset 4 on array\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$md5Ctxt is never written, only read\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:getData\\(\\) should return string but returns string\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$summaryInformation \\(string\\) does not accept string\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:getStream\\(\\) should return resource but returns resource\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\:\\:\\$summaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" + message: "#^Parameter \\#1 \\$No of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 8 - path: src/PhpSpreadsheet/Reader/Xls.php + message: "#^Parameter \\#1 \\$oleTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:OLE2LocalDate\\(\\) expects string, string\\|false given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BIFF5\\:\\:\\$map has no type specified\\.$#" + message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BIFF8\\:\\:\\$map has no type specified\\.$#" + message: "#^Parameter \\#2 \\$name of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects string, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Color\\\\BuiltIn\\:\\:\\$map has no type specified\\.$#" + message: "#^Parameter \\#3 \\$type of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\ErrorCode\\:\\:\\$map has no type specified\\.$#" + message: "#^Parameter \\#4 \\$prev of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/ErrorCode.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\Escher\\:\\:\\$object \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\\\SpContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\|PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\) does not accept mixed\\.$#" + message: "#^Parameter \\#5 \\$next of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/Escher.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:f\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#6 \\$dir of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:g\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#9 \\$data of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects string, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:h\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:\\$root \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:i\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#2 \\$offset of function array_slice expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:rotate\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#3 \\$length of function array_slice expects int\\|null, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\MD5\\:\\:step\\(\\) has parameter \\$func with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:\\$_data \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - message: "#^Parameter \\#1 \\$input of function array_values expects array, array\\|false given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:\\$startBlock \\(int\\) on left side of \\?\\? is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/MD5.php + path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$i has no type specified\\.$#" + message: "#^Parameter \\#1 \\$No of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/RC4.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$j has no type specified\\.$#" + message: "#^Parameter \\#4 \\$prev of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/RC4.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xls\\\\RC4\\:\\:\\$s has no type specified\\.$#" + message: "#^Parameter \\#5 \\$next of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xls/RC4.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" + message: "#^Parameter \\#6 \\$dir of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - message: "#^Cannot access offset 0 on array\\\\|false\\.$#" + message: "#^Parameter \\#1 \\$No of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 5 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Parameter \\#1 \\$iSBDcnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot access property \\$r on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Parameter \\#1 \\$iSbdSize of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method addChart\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" + message: "#^Parameter \\#1 \\$iStBlk of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBigData\\(\\) expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#2 \\$iBBcnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#2 \\$iBsize of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#3 \\$iPPScnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#3 \\$iPpsCnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#4 \\$prev of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#5 \\$next of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#6 \\$dir of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#9 \\$data of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects string, null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:\\$bigBlockSize \\(int\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:\\$smallBlockSize \\(int\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - message: "#^Comparison operation \"\\>\" between SimpleXMLElement\\|null and 0 results in an error\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Parameter \\#1 \\$data of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:getInt4d\\(\\) expects string, string\\|false given\\.$#" + count: 8 + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$data has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$documentSummaryInformation has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToBoolean\\(\\) has parameter \\$c with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$summaryInformation has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$wrkbook has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToError\\(\\) has parameter \\$c with no type specified\\.$#" + message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/OLERead.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$c with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:formatNumber\\(\\) should return string but returns array\\|string\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$calculatedValue with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbIsUpper\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$castBaseType with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbIsUpper\\(\\) has parameter \\$character with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$cellDataType with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbStrSplit\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$r with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbStrSplit\\(\\) has parameter \\$string with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$sharedFormulas with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:sanitizeUTF8\\(\\) should return string but returns string\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToFormula\\(\\) has parameter \\$value with no type specified\\.$#" + message: "#^Parameter \\#1 \\$string of function strlen expects string, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, float given\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:castToString\\(\\) has parameter \\$c with no type specified\\.$#" + message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:\\$decimalSeparator \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has no return type specified\\.$#" + message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:\\$thousandsSeparator \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$add with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Variable \\$textValue on left side of \\?\\? always exists and is not nullable\\.$#" + count: 3 + path: src/PhpSpreadsheet/Shared/StringHelper.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$base with no type specified\\.$#" + message: "#^Static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\TimeZone\\:\\:validateTimeZone\\(\\) is unused\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/TimeZone.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$const with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$array with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$meanX with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getArrayItem\\(\\) has parameter \\$key with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$meanY with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:getFromZipArchive\\(\\) should return string but returns string\\|false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumX with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$dir with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumX2 with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$docSheet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumXY with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readFormControlProperties\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumY with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$dir with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumY2 with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$docSheet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:getBestFitType\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:readPrinterSettings\\(\\) has parameter \\$fileWorksheet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:getError\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has no return type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:sumSquares\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$DFResiduals has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has no return type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$SSRegression has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has parameter \\$style with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$SSResiduals has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Negated boolean expression is always true\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$correlation has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$fontSizeInPoints of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:fontSizeToPixels\\(\\) expects int, string given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$covariance has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, int\\|string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$f has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$goodnessOfFit has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$sizeInCm of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:centimeterSizeToPixels\\(\\) expects int, string given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$intersect has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$sizeInInch of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:inchSizeToPixels\\(\\) expects int, string given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$intersectSE has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$slope has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, array\\|string given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$slopeSE has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$stdevOfResiduals has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$xOffset has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$autoFilterRange with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$yOffset has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php + path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\AutoFilter\\:\\:readAutoFilter\\(\\) has parameter \\$xmlSheet with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\PolynomialBestFit\\:\\:getCoefficients\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php + path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.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: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method getFont\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run\\|null\\.$#" - count: 12 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Cannot call method setUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 3 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$chartDetail with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeries\\(\\) has parameter \\$plotType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$marker with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValueSet\\(\\) has parameter \\$seriesDetail with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has parameter \\$dataType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValues\\(\\) has parameter \\$seriesValueSet with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has parameter \\$dataType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartDataSeriesValuesMultiLevel\\(\\) has parameter \\$seriesValueSet with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has parameter \\$chartDetail with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartLayoutDetails\\(\\) has parameter \\$namespacesChartMeta with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:chartTitle\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:parseRichText\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readChartAttributes\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readChartAttributes\\(\\) has parameter \\$chartDetail with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has parameter \\$background with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Chart\\:\\:readColor\\(\\) has parameter \\$color with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$position of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend constructor expects string, bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showBubbleSize of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowBubbleSize\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showCategoryName of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowCatName\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showDataLabelValues of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowVal\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showLeaderLines of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowLeaderLines\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showLegendKey of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowLegendKey\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showPercentage of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowPercent\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$showSeriesName of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\:\\:setShowSerName\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#3 \\$overlay of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend constructor expects bool, bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#3 \\$plotOrder of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries constructor expects array\\, array\\ given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#4 \\$pointCount of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues constructor expects int, null given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#6 \\$displayBlanksAs of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart constructor expects string, bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.php - - - - message: "#^Parameter \\#7 \\$plotDirection of class PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries constructor expects string\\|null, bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Chart.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 no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.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: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:dxfs\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:dxfs\\(\\) has parameter \\$readDataOnly with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:getArrayItem\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:getArrayItem\\(\\) has parameter \\$array with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:getArrayItem\\(\\) has parameter \\$key with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readColor\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readColor\\(\\) has parameter \\$background with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readColor\\(\\) has parameter \\$color with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readProtectionHidden\\(\\) has parameter \\$style with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readProtectionLocked\\(\\) has parameter \\$style with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readStyle\\(\\) has parameter \\$style with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:setStyleBaseData\\(\\) has parameter \\$cellStyles with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:setStyleBaseData\\(\\) has parameter \\$styles with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:styles\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Parameter \\#1 \\$hexColourValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:changeBrightness\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Parameter \\#2 \\$alignmentXml of static method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:readAlignmentStyle\\(\\) expects SimpleXMLElement, object given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:\\$cellStyles has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:\\$styleXml has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:\\$styles has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Styles\\:\\:\\$theme \\(PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Theme\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\\\Theme\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xlsx/Styles.php - - - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml.php - - - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:convertEncoding\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xml\\:\\:\\$fileContents has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml.php - - - - message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml/Properties.php - - - - message: "#^Argument of an invalid type SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/PhpSpreadsheet/Reader/Xml/Style.php - - - - message: "#^Cannot use array destructuring on array\\|null\\.$#" - count: 4 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Elseif condition is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#1 \\$formula of method PhpOffice\\\\PhpSpreadsheet\\\\ReferenceHelper\\:\\:updateFormulaReferences\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#1 \\$index of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension\\:\\:setRowIndex\\(\\) expects int, string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#2 \\$callback of function uksort expects callable\\(\\(int\\|string\\), \\(int\\|string\\)\\)\\: int, array\\{'self', 'cellReverseSort'\\} given\\.$#" - count: 4 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#2 \\$callback of function uksort expects callable\\(\\(int\\|string\\), \\(int\\|string\\)\\)\\: int, array\\{'self', 'cellSort'\\} given\\.$#" - count: 4 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\ReferenceHelper\\:\\:\\$instance \\(PhpOffice\\\\PhpSpreadsheet\\\\ReferenceHelper\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/ReferenceHelper.php - - - - message: "#^Parameter \\#1 \\$text of class PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run constructor expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/RichText/RichText.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run\\:\\:\\$font \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/RichText/Run.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:getHttpClient\\(\\) should return Psr\\\\Http\\\\Client\\\\ClientInterface but returns Psr\\\\Http\\\\Client\\\\ClientInterface\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Settings.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:getRequestFactory\\(\\) should return Psr\\\\Http\\\\Message\\\\RequestFactoryInterface but returns Psr\\\\Http\\\\Message\\\\RequestFactoryInterface\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Settings.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Settings.php - - - - message: "#^Result of && is always false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Settings.php - - - - message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Settings.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:stringToExcel\\(\\) should return float\\|false but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Date.php - - - - message: "#^Parameter \\#1 \\$excelFormatCode of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:isDateTimeFormatCode\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Date.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, int given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/Date.php - - - - message: "#^Parameter \\#1 \\$unixTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:timestampToExcel\\(\\) expects int, float\\|int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Date.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:\\$possibleDateFormatCharacters has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Date.php - - - - message: "#^Cannot access offset 1 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:imagecreatefrombmp\\(\\) should return GdImage\\|resource but returns resource\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#1 \\$fp of function feof expects resource, resource\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#1 \\$fp of function fread expects resource, resource\\|false given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#1 \\$im of function imagesetpixel expects resource, resource\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#1 \\$x_size of function imagecreatetruecolor expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#2 \\$red of function imagecolorallocate expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#2 \\$y_size of function imagecreatetruecolor expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#3 \\$green of function imagecolorallocate expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#3 \\$y of function imagesetpixel expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#4 \\$blue of function imagecolorallocate expects int, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Parameter \\#4 \\$col of function imagesetpixel expects int, int\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Drawing.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getDgId\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getLastSpId\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getSpgrContainer\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setDgId\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setLastSpId\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setSpgrContainer\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:setSpgrContainer\\(\\) has parameter \\$spgrContainer with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:\\$spgrContainer has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer.php - - - - message: "#^Cannot call method setParent\\(\\) on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\\\SpgrContainer\\:\\:getChildren\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:\\$parent is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php - - - - message: "#^Cannot access offset 0 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Cannot access offset 2 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Cannot access offset 4 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Cannot access offset 6 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Parameter \\#1 \\$size of function imagettfbbox expects float, float\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Parameter \\#2 \\$defaultFont of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:pixelsToCellDimension\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:\\$autoSizeMethods has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Variable \\$cellText on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Font.php - - - - message: "#^Parameter \\#1 \\$number of function abs expects float\\|int\\|string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\EigenvalueDecomposition\\:\\:\\$cdivi has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\EigenvalueDecomposition\\:\\:\\$e has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php - - - - message: "#^Else branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\LUDecomposition\\:\\:getDoublePivot\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php - - - - message: "#^Call to function is_string\\(\\) with float\\|int will always evaluate to false\\.$#" - count: 5 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:__construct\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayLeftDivide\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayLeftDivideEquals\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayRightDivide\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayRightDivideEquals\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayTimes\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:arrayTimesEquals\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:concat\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:getMatrix\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:minus\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:minusEquals\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:plus\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:plusEquals\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:power\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:times\\(\\) has parameter \\$args with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, float\\|int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Parameter \\#3 \\$c of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:set\\(\\) expects float\\|int\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Parameter \\#3 \\$c of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\JAMA\\\\Matrix\\:\\:set\\(\\) expects float\\|int\\|null, string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Result of && is always false\\.$#" - count: 10 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 19 - path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - - - message: "#^Cannot call method getArray\\(\\) on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - - - message: "#^Cannot call method getColumnDimension\\(\\) on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - - - message: "#^Cannot call method getRowDimension\\(\\) on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - - - message: "#^If condition is always true\\.$#" - count: 7 - path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - - - message: "#^Left side of && is always true\\.$#" - count: 4 - path: src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php - - - - message: "#^Parameter \\#1 \\$number of function abs expects float\\|int\\|string, mixed given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Shared/JAMA/utils/Maths.php - - - - message: "#^Cannot access offset 1 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Cannot access offset 2 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Cannot access offset 3 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Cannot access offset 4 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Cannot use array destructuring on array\\|false\\.$#" - count: 3 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:getData\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:getStream\\(\\) should return resource but returns resource\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#1 \\$No of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#1 \\$oleTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:OLE2LocalDate\\(\\) expects string, string\\|false given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#2 \\$name of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#3 \\$type of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#4 \\$prev of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#5 \\$next of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#6 \\$dir of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#9 \\$data of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS constructor expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\:\\:\\$root \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE.php - - - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php - - - - message: "#^Parameter \\#2 \\$offset of function array_slice expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - - - message: "#^Parameter \\#3 \\$length of function array_slice expects int\\|null, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:\\$_data \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:\\$startBlock \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS.php - - - - message: "#^Parameter \\#1 \\$No of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - - - message: "#^Parameter \\#4 \\$prev of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - - - message: "#^Parameter \\#5 \\$next of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - - - message: "#^Parameter \\#6 \\$dir of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/File.php - - - - message: "#^Parameter \\#1 \\$No of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#1 \\$iSBDcnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#1 \\$iSbdSize of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#1 \\$iStBlk of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBigData\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#2 \\$iBBcnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#2 \\$iBsize of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#3 \\$iPPScnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveHeader\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#3 \\$iPpsCnt of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:saveBbd\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#4 \\$prev of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#5 \\$next of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#6 \\$dir of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#9 \\$data of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\:\\:__construct\\(\\) expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:\\$bigBlockSize \\(int\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLE\\\\PPS\\\\Root\\:\\:\\$smallBlockSize \\(int\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLE/PPS/Root.php - - - - message: "#^Parameter \\#1 \\$data of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:getInt4d\\(\\) expects string, string\\|false given\\.$#" - count: 8 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$data has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$documentSummaryInformation has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$summaryInformation has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\OLERead\\:\\:\\$wrkbook has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/OLERead.php - - - - message: "#^Cannot access offset 'fontidx' on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Cannot access offset 'strlen' on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Cannot cast mixed to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:countCharacters\\(\\) should return int but returns int\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:formatNumber\\(\\) should return string but returns array\\|string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbIsUpper\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbIsUpper\\(\\) has parameter \\$character with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbStrSplit\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:mbStrSplit\\(\\) has parameter \\$string with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:sanitizeUTF8\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Parameter \\#1 \\$string of function strlen expects string, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:\\$decimalSeparator \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:\\$isIconvEnabled \\(bool\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:\\$thousandsSeparator \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Variable \\$textValue on left side of \\?\\? always exists and is not nullable\\.$#" - count: 3 - path: src/PhpSpreadsheet/Shared/StringHelper.php - - - - message: "#^Static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\TimeZone\\:\\:validateTimeZone\\(\\) is unused\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/TimeZone.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$const with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$meanX with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$meanY with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumX with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumX2 with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumXY with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumY with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:calculateGoodnessOfFit\\(\\) has parameter \\$sumY2 with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:getBestFitType\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:getError\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:sumSquares\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$DFResiduals has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$SSRegression has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$SSResiduals has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$correlation has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$covariance has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$f has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$goodnessOfFit has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$intersect has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$intersectSE has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$slope has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$slopeSE has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$stdevOfResiduals has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$xOffset has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\BestFit\\:\\:\\$yOffset has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/BestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\PolynomialBestFit\\:\\:getCoefficients\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\PolynomialBestFit\\:\\:getCoefficients\\(\\) has parameter \\$dp with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php - - - - message: "#^Array \\(array\\\\) does not accept object\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Call to an undefined method object\\:\\:getGoodnessOfFit\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$const with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$trendType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$xValues with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$yValues with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Parameter \\#1 \\$order of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\PolynomialBestFit constructor expects int, string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:getData\\(\\) should return string but returns string\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/XMLWriter.php - - - - message: "#^Parameter \\#1 \\$uri of method XMLWriter\\:\\:openUri\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/XMLWriter.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:\\$debugEnabled has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/XMLWriter.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:\\$tempFileName \\(string\\) does not accept string\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/XMLWriter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Xls\\:\\:sizeCol\\(\\) should return int but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Shared/Xls.php - - - - message: "#^Call to function is_array\\(\\) with string will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Comparison operation \"\\<\\=\" between int\\ and 1000 is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Parameter \\#1 \\$path of function pathinfo expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Parameter \\#1 \\$worksheet of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getIndex\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet, PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:\\$ribbonXMLData \\(array\\{target\\: string, data\\: string\\}\\|null\\) does not accept array\\{target\\: mixed, data\\: mixed\\}\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:\\$workbookViewVisibilityValues has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Result of \\|\\| is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: src/PhpSpreadsheet/Spreadsheet.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Alignment.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Border.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getStyleArray\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Border.php - - - - message: "#^Parameter \\#1 \\$parent of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Supervisor\\:\\:bindParent\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Border\\) given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Border.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Borders.php - - - - message: "#^Parameter \\#1 \\$parent of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Supervisor\\:\\:bindParent\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Borders\\) given\\.$#" - count: 10 - path: src/PhpSpreadsheet/Style/Borders.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getStyleArray\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Border\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\:\\:getColor\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Border\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\:\\:getEndColor\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Border\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\:\\:getStartColor\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:getColourComponent\\(\\) should return int\\|string but returns float\\|int\\|string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Color.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\:\\:\\$condition \\(array\\\\) does not accept array\\\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Conditional.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\:\\:\\$style \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Conditional.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setConditionalFormattingRuleExt\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setMaximumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setMinimumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setShowValue\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:getXmlAttributes\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:getXmlElements\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:setMaximumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:setMinimumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:__construct\\(\\) has parameter \\$type with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:__construct\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setCellFormula\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setType\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setValue\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$cellFormula has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$type has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$value has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - - - message: "#^Cannot access property \\$axisPosition on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$border on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$direction on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$gradient on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$maxLength on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$minLength on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Cannot access property \\$negativeBarBorderColorSameAsPositive on SimpleXMLElement\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:__construct\\(\\) has parameter \\$id with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:generateUuid\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtDataBarElementChildrenFromXml\\(\\) has parameter \\$ns with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtLstXml\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtLstXml\\(\\) has parameter \\$extLstXml with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Offset 'rgb' does not exist on SimpleXMLElement\\|null\\.$#" - count: 4 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Offset 'theme' does not exist on SimpleXMLElement\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Offset 'tint' does not exist on SimpleXMLElement\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:\\$id has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Fill.php - - - - message: "#^Parameter \\#1 \\$parent of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Supervisor\\:\\:bindParent\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\) given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/Fill.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Font.php - - - - message: "#^Parameter \\#1 \\$parent of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Supervisor\\:\\:bindParent\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style, \\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\) given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Font.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:\\$builtInFormatCode \\(int\\|false\\) does not accept bool\\|int\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\DateFormatter\\:\\:escapeQuotesCallback\\(\\) has parameter \\$matches with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\DateFormatter\\:\\:format\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\DateFormatter\\:\\:setLowercaseCallback\\(\\) has parameter \\$matches with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#1 \\$format of method DateTime\\:\\:format\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#2 \\$callback of function preg_replace_callback expects callable\\(\\)\\: mixed, array\\{'self', 'escapeQuotesCallback'\\} given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#2 \\$callback of function preg_replace_callback expects callable\\(\\)\\: mixed, array\\{'self', 'setLowercaseCallback'\\} given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Parameter \\#3 \\$subject of function preg_replace_callback expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has parameter \\$sections with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$cond with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$dfcond with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$dfval with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$val with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:toFormattedString\\(\\) should return string but returns float\\|int\\|string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:toFormattedString\\(\\) should return string but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_split expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - - - message: "#^Cannot cast mixed to float\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/FractionFormatter.php - - - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Cannot cast mixed to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Parameter \\#1 \\$number of function abs expects float\\|int\\|string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Parameter \\#1 \\$number of function number_format expects float, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Parameter \\#1 \\$x of function fmod expects float, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\PercentageFormatter\\:\\:format\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php - - - - message: "#^Parameter \\#1 \\$format of function sprintf expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getSharedComponent\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Protection.php - - - - message: "#^Call to an undefined method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getCellXfByIndex\\(\\)\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Style.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\:\\:getParent\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet but returns PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Style\\.$#" - count: 1 - path: src/PhpSpreadsheet/Style/Style.php - - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Cannot access offset 'date' on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Cannot access offset 'dateTime' on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Cannot access offset 'time' on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\:\\:filterTestInDateGroupSet\\(\\) should return bool but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\:\\:filterTestInSimpleDataSet\\(\\) should return bool but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:rangeBoundaries\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#1 \\$string of function strlen expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#1 \\$visible of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Dimension\\:\\:setVisible\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#2 \\$haystack of function in_array expects array, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Parameter \\#3 \\$length of function array_slice expects int\\|null, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\:\\:\\$range \\(string\\) does not accept mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter.php - - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Array \\(array\\\\) does not accept mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Cannot call method setParent\\(\\) on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Cannot clone non\\-object variable \\$v of type mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\\\Column\\:\\:getAttribute\\(\\) should return int\\|string\\|null but returns mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\\\Column\\:\\:getAttributes\\(\\) should return array\\ but returns array\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php - - - - message: "#^Cannot call method getCell\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php - - - - message: "#^Cannot call method getDrawingCollection\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php - - - - message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\:\\:\\$shadow \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:adjustForExistingOnlyRange\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/CellIterator.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Column\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Column.php - - - - message: "#^Cannot use array destructuring on array\\|false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Drawing.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\:\\:\\$color \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:getPrintArea\\(\\) should return string but returns string\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:setFirstPageNumber\\(\\) expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, string\\|null given\\.$#" - count: 5 - path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:\\$pageOrder has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - - - message: "#^Strict comparison using \\=\\=\\= between int\\ and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Row\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Row.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\SheetView\\:\\:\\$sheetViewTypes has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/SheetView.php - - - - message: "#^Strict comparison using \\=\\=\\= between int\\ and null will always evaluate to false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/SheetView.php - - - - message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/SheetView.php - - - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot access offset 1 on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getCalculatedValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" - count: 4 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getWorksheet\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot call method rangeToArray\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^If condition is always true\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Left side of && is always true\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartByName\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|false but returns PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$index of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension constructor expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$index of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension constructor expects int, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$input of function array_splice expects array, ArrayObject\\ given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$range of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter constructor expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$range of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\:\\:setRange\\(\\) expects string, null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:rangeDimension\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\:\\:removeRow\\(\\) expects string, int given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#1 \\$worksheetName of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getSheetByName\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#2 \\$format of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:toFormattedString\\(\\) expects string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#2 \\$start of function substr expects int, int\\<0, max\\>\\|false given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Parameter \\#3 \\$rotation of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:calculateColumnWidth\\(\\) expects int, int\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Result of && is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Right side of && is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - - - message: "#^Cannot cast mixed to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Csv.php - - - - message: "#^Call to function array_key_exists\\(\\) with int and array\\{none\\: 'none', dashDot\\: '1px dashed', dashDotDot\\: '1px dotted', dashed\\: '1px dashed', dotted\\: '1px dotted', double\\: '3px double', hair\\: '1px solid', medium\\: '2px solid', \\.\\.\\.\\} will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Cannot access offset 'mime' on array\\|false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Cannot access offset 0 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Cannot access offset 1 on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Cannot call method getSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Cannot call method getSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$candidateSpannedRow with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$sheet with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateHTMLFooter\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has parameter \\$desc with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has parameter \\$val with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$cellAddress with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$columnNumber with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$row with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cell with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cellType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cssClass with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValue\\(\\) has parameter \\$cell with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValue\\(\\) has parameter \\$cellData with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValueRich\\(\\) has parameter \\$cell with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValueRich\\(\\) has parameter \\$cellData with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowIncludeCharts\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowIncludeCharts\\(\\) has parameter \\$coordinate with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$colSpan with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$html with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$rowSpan with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cellData with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cellType with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$colNum with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$colSpan with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$coordinate with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cssClass with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$html with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$row with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$rowSpan with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetPrep\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has parameter \\$rowMin with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has parameter \\$sheet with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$row with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$tbodyStart with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$theadEnd with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$theadStart with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableFooter\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$html with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$id with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTagInline\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTagInline\\(\\) has parameter \\$id with no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:getSheetIndex\\(\\) should return int but returns int\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$borderStyle of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapBorderStyle\\(\\) expects int, string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:createCSSStyleFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$hAlign of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapHAlign\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, GdImage\\|resource given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$str of function base64_encode expects string, string\\|false given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$string of function htmlspecialchars expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#1 \\$vAlign of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapVAlign\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Parameter \\#3 \\$use_include_path of function fopen expects bool, int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Ternary operator condition is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Html.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods.php - - - - message: "#^If condition is always true\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Ods/Cell/Style.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Cell\\\\Style\\:\\:\\$writer has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods/Cell/Style.php - - - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:splitRange\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, mixed given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<2, max\\> given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Content\\:\\:\\$formulaConvertor has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods/Content.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Formula\\:\\:\\$definedNames has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods/Formula.php - - - - message: "#^Parameter \\#1 \\$date of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:dateTimeFromTimestamp\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Ods/Meta.php - - - - message: "#^Parameter \\#1 \\$rawTextData of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:writeRawData\\(\\) expects array\\\\|string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Ods/Meta.php - - - - message: "#^Parameter \\#1 \\$content of method XMLWriter\\:\\:text\\(\\) expects string, int given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Ods/Settings.php - - - - message: "#^Parameter \\#2 \\$str of function fwrite expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Pdf/Dompdf.php - - - - message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Pdf/Dompdf.php - - - - message: "#^Strict comparison using \\=\\=\\= between null and int will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Pdf/Mpdf.php - - - - message: "#^Strict comparison using \\=\\=\\= between int and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php - - - - message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Cannot use array destructuring on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'endCoordinates' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'endOffsetX' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'endOffsetY' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'startCoordinates' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'startOffsetX' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Offset 'startOffsetY' does not exist on array\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Parameter \\#1 \\$blipType of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:setBlipType\\(\\) expects int, int\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Parameter \\#1 \\$data of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\\\Blip\\:\\:setData\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Parameter \\#1 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:addFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, GdImage\\|resource given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, resource\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\:\\:\\$summaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\BIFFwriter\\:\\:writeEof\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php - - - - message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\BIFFwriter\\:\\:\\$byteOrder \\(int\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php - - - - message: "#^Elseif condition is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - - - message: "#^If condition is always true\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Escher\\:\\:\\$data has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Escher\\:\\:\\$object has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - - - message: "#^If condition is always false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Font.php - - - - message: "#^Parameter \\#1 \\$bold of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Font\\:\\:mapBold\\(\\) expects bool, bool\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Font.php - - - - message: "#^Parameter \\#1 \\$fontName of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:getCharsetFromFontName\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Font.php - - - - message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:UTF8toBIFF8UnicodeShort\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Font.php - - - - message: "#^Parameter \\#1 \\$underline of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Font\\:\\:mapUnderline\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Font.php - - - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:advance\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Offset 'left' does not exist on non\\-empty\\-array\\|string\\.$#" - count: 6 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Offset 'right' does not exist on non\\-empty\\-array\\|string\\.$#" - count: 5 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Offset 'value' does not exist on non\\-empty\\-array\\|string\\.$#" - count: 7 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$cell of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:cellToPackedRowcol\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$cell of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertRef2d\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$cell of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertRef3d\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$errorCode of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertError\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$ext_ref of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:getRefIndex\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$haystack of function substr_count expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$name of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertDefinedName\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$range of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertRange2d\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$str of function strrev expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$string of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertString\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#1 \\$token of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:convertRange3d\\(\\) expects string, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" - count: 20 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Part \\$token \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:\\$parseTree \\(string\\) does not accept mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:\\$spreadsheet has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 5 - path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - - - message: "#^Cannot access offset 'encoding' on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeAllDefinedNamesBiff8\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeExternalsheetBiff8\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeMsoDrawingGroup\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeSupbookInternal\\(\\) has no return type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$biffSize is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$colors has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - - - message: "#^Cannot access offset 'comp' on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Cannot access offset 'ident' on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Cannot access offset 'sa' on array\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Cannot access offset 1 on array\\|false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Cannot access offset 2 on array\\|false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$ascii of function chr expects int, float given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$bitmap of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:processBitmap\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$coordinates of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:indexesFromString\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$errorCode of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\ErrorCode\\:\\:error\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$im of function imagecolorat expects resource, GdImage\\|resource given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$col of function imagecolorsforindex expects int, int\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$pieces of function implode expects array, array\\\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#3 \\$formula of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeFormula\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#3 \\$num of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeNumber\\(\\) expects float, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#3 \\$str of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeString\\(\\) expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#3 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeBoolErr\\(\\) expects int, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#4 \\$isError of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeBoolErr\\(\\) expects bool, int given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#5 \\$width of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:positionImage\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#6 \\$height of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:positionImage\\(\\) expects int, float given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$activePane \\(int\\) does not accept int\\|null\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$colors has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$countCellStyleXfs is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$outlineBelow is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$outlineRight is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$selection is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$xlsStringMaxLength is never read, only written\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - - - message: "#^Parameter \\#1 \\$textRotation of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapTextRotation\\(\\) expects int, int\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xls/Xf.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:\\$diag is never read, only written\\.$#" - count: 1 - 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 \\$function of function call_user_func expects callable\\(\\)\\: mixed, string given\\.$#" - 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: "#^Cannot access offset int on mixed\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Cannot call method getDataValues\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Cannot call method getFillColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Else branch is unreachable because previous condition is always true\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$plotSeriesValues of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeBubbles\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues|null, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$rawTextData of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:writeRawData\\(\\) expects array\\\\|string\\|null, int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$rawTextData of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:writeRawData\\(\\) expects array\\\\|string\\|null, mixed given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string given\\.$#" - count: 8 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#" - count: 6 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float\\|int given\\.$#" - count: 4 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 45 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#3 \\$id1 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#4 \\$id1 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects string, int\\|string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#4 \\$id2 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#5 \\$id2 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects string, int\\|string given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#6 \\$yAxis of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#7 \\$xAxis of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#8 \\$majorGridlines of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#9 \\$minorGridlines of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Part \\$xAxis\\-\\>getShadowProperty\\('effect'\\) \\(array\\|int\\|string\\|null\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Part \\$xAxis\\-\\>getShadowProperty\\(\\['color', 'type'\\]\\) \\(array\\|int\\|string\\|null\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:\\$calculateCellValues has no type specified\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea and null will always evaluate to false\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - - - message: "#^Parameter \\#1 \\$string of function substr expects string, int given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Comments.php - - - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Comments.php - - - - message: "#^Cannot use array destructuring on mixed\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/DefinedNames.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/DefinedNames.php - - - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\PolynomialBestFit\\:\\:getCoefficients\\(\\) has parameter \\$dp with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php - - - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php + path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php - - message: "#^Part \\$propertyValue \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Call to an undefined method object\\:\\:getGoodnessOfFit\\(\\)\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Parameter \\#1 \\$index of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartByIndex\\(\\) expects string, int given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Parameter \\#2 \\$chart of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Drawing\\:\\:writeChart\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|false given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$const with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php - - - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#" - count: 12 - path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 8 - path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$trendType with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$relationship with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$xValues with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$type with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$yValues 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: 4 - path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php + path: src/PhpSpreadsheet/Shared/Trend/Trend.php - - message: "#^Parameter \\#4 \\$target of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeRelationship\\(\\) expects string, array\\|string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:getData\\(\\) should return string but returns string\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php - - - - message: "#^Cannot call method getBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Shared/XMLWriter.php - - message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#1 \\$uri of method XMLWriter\\:\\:openUri\\(\\) expects string, string\\|false given\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - - - message: "#^Cannot call method getItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - - - message: "#^Cannot call method getName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Shared/XMLWriter.php - - message: "#^Cannot call method getSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:\\$debugEnabled has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - - - message: "#^Cannot call method getStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 2 - 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: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Shared/XMLWriter.php - - message: "#^Instanceof between \\*NEVER\\* and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:\\$tempFileName \\(string\\) does not accept string\\|false\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Shared/XMLWriter.php - - message: "#^Instanceof between string and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#" + message: "#^Call to function is_array\\(\\) with string will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\StringTable\\:\\:createStringTable\\(\\) should return array\\ but returns array\\.$#" + message: "#^Comparison operation \"\\<\\=\" between int\\ and 1000 is always true\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#1 \\$text of method PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText\\:\\:createTextRun\\(\\) expects string, string\\|null given\\.$#" + message: "#^Parameter \\#1 \\$worksheet of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getIndex\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet, PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null given\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float\\|null given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:\\$workbookViewVisibilityValues has no type specified\\.$#" 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 + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" + message: "#^Result of \\|\\| is always true\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" - count: 5 - path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Cannot call method getStyle\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\|null\\.$#" + message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - - - message: "#^Comparison operation \"\\<\" between int\\ and 0 is always true\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#2 \\$borders of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeBorder\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Borders, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Borders\\|null given\\.$#" + message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#2 \\$fill of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeFill\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Fill\\|null given\\.$#" + message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php + path: src/PhpSpreadsheet/Spreadsheet.php - - message: "#^Parameter \\#2 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setConditionalFormattingRuleExt\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - message: "#^Parameter \\#2 \\$numberFormat of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Style\\:\\:writeNumFmt\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setMaximumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setMinimumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" 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 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setShowValue\\(\\) has no return type specified\\.$#" 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 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:getXmlAttributes\\(\\) has no return type specified\\.$#" 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 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - message: "#^Result of \\|\\| is always true\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:getXmlElements\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 7 - path: src/PhpSpreadsheet/Writer/Xlsx/Workbook.php - - - - message: "#^Cannot cast mixed to string\\.$#" - count: 4 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - message: "#^Cannot use array destructuring on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:setMaximumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBarExtension\\:\\:setMinimumConditionalFormatValueObject\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - - - message: "#^If condition is always true\\.$#" - count: 6 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeAttributeIf\\(\\) has parameter \\$condition with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:__construct\\(\\) has parameter \\$type with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeDataBarElements\\(\\) has parameter \\$dataBar with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:__construct\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeElementIf\\(\\) has parameter \\$condition with no type specified\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setCellFormula\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Negated boolean expression is always false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setType\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - - - message: "#^Offset int on array\\\\> in isset\\(\\) does not exist\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Parameter \\#1 \\$content of method XMLWriter\\:\\:text\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:setValue\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$cellFormula has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Parameter \\#2 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellFormula\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$type has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Parameter \\#2 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellNumeric\\(\\) expects float\\|int, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormatValueObject\\:\\:\\$value has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormatValueObject.php - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$axisPosition on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, mixed given\\.$#" + message: "#^Cannot access property \\$border on SimpleXMLElement\\|null\\.$#" count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" - count: 19 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$direction on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$gradient on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<1, max\\> given\\.$#" - count: 7 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$maxLength on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\|null given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$minLength on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, mixed given\\.$#" - count: 3 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Cannot access property \\$negativeBarBorderColorSameAsPositive on SimpleXMLElement\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:__construct\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellBoolean\\(\\) expects bool, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:generateUuid\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellError\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtDataBarElementChildrenFromXml\\(\\) has parameter \\$ns with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellInlineStr\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtLstXml\\(\\) has no return type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$cellValue of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeCellString\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:parseExtLstXml\\(\\) has parameter \\$extLstXml with no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$namespace of method XMLWriter\\:\\:startElementNs\\(\\) expects string, null given\\.$#" - count: 8 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + message: "#^Offset 'rgb' does not exist on SimpleXMLElement\\|null\\.$#" + count: 4 + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#3 \\$stringTable of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeSheetData\\(\\) expects array\\, array\\\\|null given\\.$#" + message: "#^Offset 'theme' does not exist on SimpleXMLElement\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#4 \\$val of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeAttributeIf\\(\\) expects string, int given\\.$#" + message: "#^Offset 'tint' does not exist on SimpleXMLElement\\|null\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - - - message: "#^Strict comparison using \\=\\=\\= between false and true will always evaluate to false\\.$#" - count: 2 - path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Xlfn\\:\\:addXlfn\\(\\) should return string but returns string\\|null\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalFormattingRuleExtension\\:\\:\\$id has no type specified\\.$#" count: 1 - path: src/PhpSpreadsheet/Writer/Xlsx/Xlfn.php - - - - message: "#^Parameter \\#1 \\$formula of method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:_calculateFormulaValue\\(\\) expects string, mixed given\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/CalculationTest.php + path: src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalFormattingRuleExtension.php - - message: "#^Parameter \\#1 \\$source of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:fromArray\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/CalculationTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has parameter \\$sections with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Engine/RangeTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DAVERAGE\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormat\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DAverageTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DAVERAGE\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DAverageTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DAVERAGE\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$cond with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DAverageTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNTA\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$dfcond with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountATest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNTA\\(\\) expects int\\|string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$dfval with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountATest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNTA\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$val with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountATest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNT\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:splitFormatCompare\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNT\\(\\) expects int\\|string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\Formatter\\:\\:toFormattedString\\(\\) should return string but returns float\\|int\\|string\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DCOUNT\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#2 \\$subject of function preg_split expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DCountTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DGET\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DGetTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/Formatter.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DGET\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\\\PercentageFormatter\\:\\:format\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DGetTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DGET\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$format of function sprintf expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DGetTest.php + path: src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMAX\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:adjustForExistingOnlyRange\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMaxTest.php + path: src/PhpSpreadsheet/Worksheet/CellIterator.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMAX\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Column\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMaxTest.php + path: src/PhpSpreadsheet/Worksheet/Column.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMAX\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\:\\:\\$color \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMaxTest.php + path: src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMIN\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:getPrintArea\\(\\) should return string but returns string\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMinTest.php + path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMIN\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:setFirstPageNumber\\(\\) expects int, null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMinTest.php + path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMIN\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:\\$pageOrder has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DMinTest.php + path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DPRODUCT\\(\\) expects array, mixed given\\.$#" + message: "#^Strict comparison using \\=\\=\\= between int\\ and null will always evaluate to false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DProductTest.php + path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DPRODUCT\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Row\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DProductTest.php + path: src/PhpSpreadsheet/Worksheet/Row.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DPRODUCT\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\SheetView\\:\\:\\$sheetViewTypes has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DProductTest.php + path: src/PhpSpreadsheet/Worksheet/SheetView.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEVP\\(\\) expects array, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevPTest.php + message: "#^Strict comparison using \\=\\=\\= between int\\ and null will always evaluate to false\\.$#" + count: 2 + path: src/PhpSpreadsheet/Worksheet/SheetView.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEVP\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevPTest.php + path: src/PhpSpreadsheet/Worksheet/SheetView.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEVP\\(\\) expects array, mixed given\\.$#" + message: "#^Cannot call method getCalculatedValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevPTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEV\\(\\) expects array, mixed given\\.$#" + message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEV\\(\\) expects int\\|string, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevTest.php + message: "#^Cannot call method getValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" + count: 4 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEV\\(\\) expects array, mixed given\\.$#" + message: "#^Cannot call method getWorksheet\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\DefinedName\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DStDevTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSUM\\(\\) expects array, mixed given\\.$#" + message: "#^Cannot call method getXfIndex\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DSumTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSUM\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Cannot call method rangeToArray\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DSumTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSUM\\(\\) expects array, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DSumTest.php + message: "#^If condition is always true\\.$#" + count: 2 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVARP\\(\\) expects array, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarPTest.php + message: "#^Left side of && is always true\\.$#" + count: 2 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVARP\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartByName\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|false but returns PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarPTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVARP\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$index of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnDimension constructor expects string, null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarPTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$database of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVAR\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$index of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowDimension constructor expects int, null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVAR\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:rangeDimension\\(\\) expects string, string\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#3 \\$criteria of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVAR\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\:\\:removeRow\\(\\) expects string, int given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Database/DVarTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$timeValue \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Parameter \\#1 \\$row of method PhpOffice\\\\PhpSpreadsheet\\\\Collection\\\\Cells\\:\\:removeRow\\(\\) expects string, int\\<1, max\\> given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/DateTime/TimeValueTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Parameter \\#2 \\$format of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:toFormattedString\\(\\) expects string, string\\|null given\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php + message: "#^Parameter \\#3 \\$rotation of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:calculateColumnWidth\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php + message: "#^Right side of && is always true\\.$#" + count: 1 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php + message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php + message: "#^Call to function array_key_exists\\(\\) with int and array\\{none\\: 'none', dashDot\\: '1px dashed', dashDotDot\\: '1px dotted', dashed\\: '1px dashed', dotted\\: '1px dotted', double\\: '3px double', hair\\: '1px solid', medium\\: '2px solid', \\.\\.\\.\\} will always evaluate to false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Cannot access offset 'mime' on array\\|false\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php + message: "#^Cannot access offset 0 on array\\|false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php + message: "#^Cannot access offset 1 on array\\|false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php + + - + message: "#^Cannot call method getSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMABS\\(\\) expects string, mixed given\\.$#" + message: "#^Cannot call method getSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMARGUMENT\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$candidateSpannedRow with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCONJUGATE\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$sheet with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCOS\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:calculateSpansOmitRows\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCOSH\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateHTMLFooter\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCOT\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCSC\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has parameter \\$desc with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMCSCH\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateMeta\\(\\) has parameter \\$val with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMEXP\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMLN\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$cellAddress with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMLOG10\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$columnNumber with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMLOG2\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellCss\\(\\) has parameter \\$row with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMREAL\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMSEC\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cell with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMSECH\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cellType with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMSIN\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellData\\(\\) has parameter \\$cssClass with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMSINH\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValue\\(\\) has parameter \\$cell with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMSQRT\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValue\\(\\) has parameter \\$cellData with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMTAN\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValueRich\\(\\) has parameter \\$cell with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$complexNumber of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engineering\\:\\:IMAGINARY\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowCellDataValueRich\\(\\) has parameter \\$cellData with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowIncludeCharts\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowIncludeCharts\\(\\) has parameter \\$coordinate with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$nominalRate of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:EFFECT\\(\\) expects float, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$colSpan with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/EffectTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#2 \\$periodsPerYear of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:EFFECT\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$html with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/EffectTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$year of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Helpers\\:\\:daysPerYear\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowSpans\\(\\) has parameter \\$rowSpan with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/HelpersTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#2 \\$basis of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\\\Helpers\\:\\:daysPerYear\\(\\) expects int\\|string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cellData with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/HelpersTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$effectiveRate of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:NOMINAL\\(\\) expects float, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cellType with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/NominalTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#2 \\$periodsPerYear of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Financial\\:\\:NOMINAL\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$colNum with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/NominalTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#3 \\$message of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$colSpan with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/XNpvTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#3 \\$message of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$coordinate with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Financial/XirrTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$cellAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:COLUMN\\(\\) expects array\\|string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$cssClass with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$cellAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:OFFSET\\(\\) expects string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$html with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/OffsetTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$cellAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:ROW\\(\\) expects array\\|string\\|null, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$row with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$matrixData of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\:\\:TRANSPOSE\\(\\) expects array, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$rowSpan with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/TransposeTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$number \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateRowWriteCell\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcotTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$number \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetPrep\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AcothTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CotTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has parameter \\$rowMin with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CothTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetStarts\\(\\) has parameter \\$sheet with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CscTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/CschTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$value \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$row with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/EvenTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$tbodyStart with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MRoundTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$matrix \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$theadEnd with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MdeTermTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$value \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateSheetTags\\(\\) has parameter \\$theadStart with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/OddTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Cannot cast mixed to int\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RandBetweenTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableFooter\\(\\) has no return type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$html with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RomanTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundDownTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTag\\(\\) has parameter \\$sheetIndex with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$formula \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTagInline\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/RoundUpTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:generateTableTagInline\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SecTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$angle \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Parameter \\#1 \\$borderStyle of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapBorderStyle\\(\\) expects int, string given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SechTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$value \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Parameter \\#1 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:createCSSStyleFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SignTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Part \\$type \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php + message: "#^Parameter \\#1 \\$hAlign of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapHAlign\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$probability of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:CHIINV\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$string of function htmlspecialchars expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvRightTailTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#2 \\$degrees of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:CHIINV\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$vAlign of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Html\\:\\:mapVAlign\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ChiInvRightTailTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:FISHERINV\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int\\<0, max\\>\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherInvTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:FISHER\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#3 \\$use_include_path of function fopen expects bool, int given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FisherTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:GAMMALN\\(\\) expects float, mixed given\\.$#" + message: "#^Ternary operator condition is always true\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaLnTest.php + path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:GAMMAFunction\\(\\) expects float, mixed given\\.$#" + message: "#^Negated boolean expression is always false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaTest.php + path: src/PhpSpreadsheet/Writer/Ods.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:GAUSS\\(\\) expects float, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GaussTest.php + message: "#^If condition is always true\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Ods/Cell/Style.php - - message: "#^Parameter \\#1 \\$yValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:GROWTH\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Cell\\\\Style\\:\\:\\$writer has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GrowthTest.php + path: src/PhpSpreadsheet/Writer/Ods/Cell/Style.php - - message: "#^Parameter \\#1 \\$yValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LINEST\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:splitRange\\(\\) expects string, string\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LinEstTest.php + path: src/PhpSpreadsheet/Writer/Ods/Content.php - - message: "#^Parameter \\#2 \\$xValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LINEST\\(\\) expects array\\|null, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LinEstTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<2, max\\> given\\.$#" + count: 3 + path: src/PhpSpreadsheet/Writer/Ods/Content.php - - message: "#^Parameter \\#3 \\$const of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LINEST\\(\\) expects bool, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Content\\:\\:\\$formulaConvertor has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LinEstTest.php + path: src/PhpSpreadsheet/Writer/Ods/Content.php - - message: "#^Parameter \\#4 \\$stats of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LINEST\\(\\) expects bool, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Ods\\\\Formula\\:\\:\\$definedNames has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LinEstTest.php + path: src/PhpSpreadsheet/Writer/Ods/Formula.php - - message: "#^Parameter \\#1 \\$yValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LOGEST\\(\\) expects array, mixed given\\.$#" + message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LogEstTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#2 \\$xValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LOGEST\\(\\) expects array\\|null, mixed given\\.$#" + message: "#^Cannot use array destructuring on array\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LogEstTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#3 \\$const of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LOGEST\\(\\) expects bool, mixed given\\.$#" + message: "#^Offset 'endCoordinates' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LogEstTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#4 \\$stats of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:LOGEST\\(\\) expects bool, mixed given\\.$#" + message: "#^Offset 'endOffsetX' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/LogEstTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TDIST\\(\\) expects float, mixed given\\.$#" + message: "#^Offset 'endOffsetY' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TDistTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#2 \\$degrees of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TDIST\\(\\) expects float, mixed given\\.$#" + message: "#^Offset 'startCoordinates' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TDistTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#3 \\$tails of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TDIST\\(\\) expects float, mixed given\\.$#" + message: "#^Offset 'startOffsetX' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TDistTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$probability of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TINV\\(\\) expects float, mixed given\\.$#" + message: "#^Offset 'startOffsetY' does not exist on array\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TinvTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#2 \\$degrees of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TINV\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$blipType of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\:\\:setBlipType\\(\\) expects int, int\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TinvTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$yValues of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:TREND\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$data of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DggContainer\\\\BstoreContainer\\\\BSE\\\\Blip\\:\\:setData\\(\\) expects string, string\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/TrendTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:WEIBULL\\(\\) expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$font of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:addFont\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font, PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/WeibullTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#2 \\$alpha of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:WEIBULL\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\:\\:\\$documentSummaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/WeibullTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#3 \\$beta of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:WEIBULL\\(\\) expects float, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\:\\:\\$summaryInformation \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/WeibullTest.php + path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#4 \\$cumulative of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:WEIBULL\\(\\) expects bool, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\BIFFwriter\\:\\:writeEof\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/WeibullTest.php + path: src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php - - message: "#^Parameter \\#1 \\$dataSet of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:ZTEST\\(\\) expects float, mixed given\\.$#" + message: "#^Static property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\BIFFwriter\\:\\:\\$byteOrder \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ZTestTest.php + path: src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php - - message: "#^Parameter \\#2 \\$m0 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:ZTEST\\(\\) expects float, mixed given\\.$#" + message: "#^Elseif condition is always true\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ZTestTest.php + path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - message: "#^Parameter \\#3 \\$sigma of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:ZTEST\\(\\) expects float\\|null, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/ZTestTest.php + message: "#^If condition is always true\\.$#" + count: 3 + path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Escher\\:\\:\\$data has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LeftTest.php + path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Escher\\:\\:\\$object has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/LowerTest.php + path: src/PhpSpreadsheet/Writer/Xls/Escher.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/MidTest.php + message: "#^If condition is always false\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xls/Font.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$bold of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Font\\:\\:mapBold\\(\\) expects bool, bool\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/ProperTest.php + path: src/PhpSpreadsheet/Writer/Xls/Font.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$fontName of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:getCharsetFromFontName\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/RightTest.php + path: src/PhpSpreadsheet/Writer/Xls/Font.php - - message: "#^Parameter \\#1 \\$locale of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLocale\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$textValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:UTF8toBIFF8UnicodeShort\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/Functions/TextData/UpperTest.php + path: src/PhpSpreadsheet/Writer/Xls/Font.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$underline of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Font\\:\\:mapUnderline\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php + path: src/PhpSpreadsheet/Writer/Xls/Font.php - - message: "#^Parameter \\#1 \\$currencyCode of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:setCurrencyCode\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:advance\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$separator of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:setDecimalSeparator\\(\\) expects string, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php + message: "#^Offset 'left' does not exist on non\\-empty\\-array\\|string\\.$#" + count: 6 + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$separator of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:setThousandsSeparator\\(\\) expects string, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Cell/AdvancedValueBinderTest.php + message: "#^Offset 'right' does not exist on non\\-empty\\-array\\|string\\.$#" + count: 5 + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Cannot access offset \\(int\\|string\\) on mixed\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Cell/CoordinateTest.php + message: "#^Offset 'value' does not exist on non\\-empty\\-array\\|string\\.$#" + count: 7 + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$columnAddress of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:columnIndexFromString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Cell/CoordinateTest.php + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$coordinateCollection of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:mergeRangesInCollection\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Cell/CoordinateTest.php + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$range of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:buildRange\\(\\) expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Parser\\:\\:\\$spreadsheet has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Cell/CoordinateTest.php + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with arguments PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell, null and 'should get exact…' will always evaluate to false\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Collection/CellsTest.php + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 5 + path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Cannot call method getCoordinate\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" + message: "#^Cannot access offset 'encoding' on array\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Collection/CellsTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Cannot call method getParent\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Cell\\|null\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeAllDefinedNamesBiff8\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Collection/CellsTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$propertyName of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:getCustomPropertyType\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeExternalsheetBiff8\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$propertyName of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:getCustomPropertyValue\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeMsoDrawingGroup\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$propertyName of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:isCustomPropertySet\\(\\) expects string, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:writeSupbookInternal\\(\\) has no return type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$propertyName of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setCustomProperty\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$biffSize is never read, only written\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$timestamp of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setCreated\\(\\) expects float\\|int\\|string\\|null, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$colors has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Workbook.php - - message: "#^Parameter \\#1 \\$timestamp of method PhpOffice\\\\PhpSpreadsheet\\\\Document\\\\Properties\\:\\:setModified\\(\\) expects float\\|int\\|string\\|null, mixed given\\.$#" + message: "#^Cannot access offset 'comp' on array\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Part \\$result \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Cannot access offset 'ident' on array\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Document/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Functional\\\\ColumnWidthTest\\:\\:testReadColumnWidth\\(\\) has parameter \\$format with no type specified\\.$#" + message: "#^Cannot access offset 'sa' on array\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/ColumnWidthTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Functional\\\\CommentsTest\\:\\:testComments\\(\\) has parameter \\$format with no type specified\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/CommentsTest.php + message: "#^Cannot access offset 1 on array\\|false\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$condition of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\:\\:addCondition\\(\\) expects string, float given\\.$#" + message: "#^Cannot access offset 2 on array\\|false\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot call method getUrl\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Hyperlink\\|null\\.$#" + message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$coordinates of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:indexesFromString\\(\\) expects string, string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" + message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot call method getPageSetup\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php + message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int\\<0, max\\>\\|false given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#2 \\$format of method PhpOffice\\\\PhpSpreadsheetTests\\\\Functional\\\\AbstractFunctional\\:\\:writeAndReload\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|null given\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Functional/ReadBlankCellsTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#2 \\$format of method PhpOffice\\\\PhpSpreadsheetTests\\\\Functional\\\\AbstractFunctional\\:\\:writeAndReload\\(\\) expects string, mixed given\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Functional/ReadFilterTest.php + message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot access offset 'size' on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: int, 4\\: int, 5\\: int, 6\\: int, 7\\: int, \\.\\.\\.\\}\\|false\\.$#" + message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php + + - + message: "#^Parameter \\#4 \\$isError of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:writeBoolErr\\(\\) expects bool, int given\\.$#" + count: 3 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$filename of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\IWriter\\:\\:save\\(\\) expects resource\\|string, resource\\|false given\\.$#" + message: "#^Parameter \\#5 \\$width of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:positionImage\\(\\) expects int, float given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$fp of function fstat expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#6 \\$height of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:positionImage\\(\\) expects int, float given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$html of method PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\:\\:toRichTextObject\\(\\) expects string, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$activePane \\(int\\) does not accept int\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Helper/HtmlTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$expected of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) expects class\\-string\\, string given\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/IOFactoryTest.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$colors has no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#3 \\$phpSpreadsheetFunctions of class PhpOffice\\\\PhpSpreadsheetInfra\\\\LocaleGenerator constructor expects array, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$countCellStyleXfs is never read, only written\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/LocaleGeneratorTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot call method getValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\NamedFormula\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/NamedFormulaTest.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$outlineBelow is never read, only written\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot call method getValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\NamedRange\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/NamedRangeTest.php + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$outlineRight is never read, only written\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Csv\\\\CsvContiguousFilter\\:\\:\\$startRow \\(int\\) does not accept mixed\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$selection is never read, only written\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Csv/CsvContiguousFilter.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$xlsStringMaxLength is never read, only written\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Csv/CsvContiguousTest.php + path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Part \\$result \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Reader/Ods/OdsPropertiesTest.php + message: "#^Parameter \\#1 \\$textRotation of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:mapTextRotation\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xls/Xf.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Ods\\\\OdsTest\\:\\:\\$spreadsheetData \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) in isset\\(\\) is not nullable\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Xf\\:\\:\\$diag is never read, only written\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Ods/OdsTest.php + path: src/PhpSpreadsheet/Writer/Xls/Xf.php - - message: "#^Property PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Ods\\\\OdsTest\\:\\:\\$spreadsheetOdsTest \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) in isset\\(\\) is not nullable\\.$#" + message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Ods/OdsTest.php + path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" + message: "#^Parameter \\#1 \\$path of function basename expects string, array\\|string\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Ods/OdsTest.php + path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php + message: "#^Parameter \\#1 \\$path of function dirname expects string, array\\|string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Security\\\\XmlScannerTest\\:\\:testInvalidXML\\(\\) has parameter \\$libxmlDisableEntityLoader with no type specified\\.$#" + message: "#^Possibly invalid array key type array\\|string\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php + path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Security\\\\XmlScannerTest\\:\\:testValidXML\\(\\) has parameter \\$libxmlDisableEntityLoader with no type specified\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\:\\:\\$pathNames has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php + path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Parameter \\#1 \\$str of function strrev expects string, mixed given\\.$#" + message: "#^Cannot call method getDataValues\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Xlsx\\\\AutoFilterTest\\:\\:getAutoFilterInstance\\(\\) has no return type specified\\.$#" + message: "#^Cannot call method getFillColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Xlsx\\\\AutoFilterTest\\:\\:getWorksheetInstance\\(\\) has no return type specified\\.$#" + message: "#^Else branch is unreachable because previous condition is always true\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Xlsx\\\\AutoFilterTest\\:\\:getXMLInstance\\(\\) has no return type specified\\.$#" + message: "#^Parameter \\#1 \\$plotSeriesValues of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeBubbles\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|null, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Xlsx\\\\AutoFilterTest\\:\\:getXMLInstance\\(\\) has parameter \\$ref with no type specified\\.$#" + message: "#^Parameter \\#1 \\$rawTextData of method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\XMLWriter\\:\\:writeRawData\\(\\) expects array\\\\|string\\|null, int given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getTitle\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string given\\.$#" + count: 8 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getXAxisLabel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string\\|null given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getYAxisLabel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#" + count: 6 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float\\|int given\\.$#" + count: 4 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getConditionalFormattingRuleExt\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" - count: 8 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" + count: 45 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getMaximumConditionalFormatValueObject\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" - count: 13 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getMinimumConditionalFormatValueObject\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" - count: 13 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + message: "#^Parameter \\#3 \\$id1 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects string, int\\|string given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getShowValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + message: "#^Parameter \\#4 \\$id1 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects string, int\\|string given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method setMinimumConditionalFormatValueObject\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" + message: "#^Parameter \\#4 \\$id2 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects string, int\\|string given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/ConditionalFormattingDataBarXlsxTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/Namespace.Issue2109bTest.php + message: "#^Parameter \\#5 \\$id2 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects string, int\\|string given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot cast mixed to string\\.$#" + message: "#^Parameter \\#6 \\$yAxis of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/Namespace.Openpyxl35Test.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Part \\$result \\(mixed\\) of encapsed string cannot be cast to string\\.$#" + message: "#^Parameter \\#7 \\$xAxis of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null given\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/PropertiesTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Cannot call method getPlotArea\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#" + message: "#^Parameter \\#8 \\$majorGridlines of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null given\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Reader/Xlsx/SheetsXlsxChartTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Part \\$creationDate \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xml/XmlLoadTest.php + message: "#^Parameter \\#9 \\$minorGridlines of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\|null given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" + message: "#^Part \\$xAxis\\-\\>getShadowProperty\\('effect'\\) \\(array\\|int\\|string\\|null\\) of encapsed string cannot be cast to string\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xml/XmlTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Reader\\\\Xml\\\\XmlTest\\:\\:testInvalidSimpleXML\\(\\) has parameter \\$filename with no type specified\\.$#" + message: "#^Part \\$xAxis\\-\\>getShadowProperty\\(\\['color', 'type'\\]\\) \\(array\\|int\\|string\\|null\\) of encapsed string cannot be cast to string\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Reader/Xml/XmlTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$codePage of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\CodePage\\:\\:numberToName\\(\\) expects int, mixed given\\.$#" + message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:\\$calculateCellValues has no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/CodePageTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$dateValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:dateTimeToExcel\\(\\) expects DateTimeInterface, mixed given\\.$#" + message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea and null will always evaluate to false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/DateTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php - - message: "#^Parameter \\#1 \\$excelTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:excelToTimestamp\\(\\) expects float\\|int, mixed given\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/DateTest.php + message: "#^Parameter \\#1 \\$string of function substr expects string, int given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Comments.php - - message: "#^Parameter \\#1 \\$unixTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:timestampToExcel\\(\\) expects int, mixed given\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/DateTest.php + message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Comments.php - - message: "#^Parameter \\#2 \\$timeZone of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:excelToTimestamp\\(\\) expects DateTimeZone\\|string\\|null, mixed given\\.$#" + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/DateTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/DefinedNames.php - - message: "#^Parameter \\#1 \\$fontSizeInPoints of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:fontSizeToPixels\\(\\) expects int, mixed given\\.$#" + message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/FontTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php - - message: "#^Parameter \\#1 \\$sizeInCm of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:centimeterSizeToPixels\\(\\) expects int, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Shared/FontTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php - - message: "#^Parameter \\#1 \\$sizeInInch of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Font\\:\\:inchSizeToPixels\\(\\) expects int, mixed given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$relationship with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/FontTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php - - message: "#^Parameter \\#1 \\$currencyCode of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:setCurrencyCode\\(\\) expects string, null given\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$type with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/StringHelperTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/Trend/ExponentialBestFitTest.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: "#^Cannot access offset 1 on mixed\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/Trend/ExponentialBestFitTest.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: "#^Parameter \\#1 \\$yValues of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\ExponentialBestFit constructor expects array\\, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Shared/Trend/ExponentialBestFitTest.php + message: "#^Cannot call method getBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#2 \\$xValues of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\ExponentialBestFit constructor expects array\\, mixed given\\.$#" + message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/Trend/ExponentialBestFitTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/Trend/LinearBestFitTest.php + message: "#^Cannot call method getItalic\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Cannot access offset 1 on mixed\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Shared/Trend/LinearBestFitTest.php + message: "#^Cannot call method getName\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$yValues of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\LinearBestFit constructor expects array\\, mixed given\\.$#" + message: "#^Cannot call method getSize\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Shared/Trend/LinearBestFitTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#2 \\$xValues of class PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\LinearBestFit constructor expects array\\, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Shared/Trend/LinearBestFitTest.php + message: "#^Cannot call method getStrikethrough\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\SpreadsheetTest\\:\\:testGetSheetByName\\(\\) has parameter \\$index with no type specified\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/SpreadsheetTest.php + message: "#^Cannot call method getSubscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\SpreadsheetTest\\:\\:testGetSheetByName\\(\\) has parameter \\$sheetName with no type specified\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/SpreadsheetTest.php + message: "#^Cannot call method getSuperscript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$rgbValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:getBlue\\(\\) expects string, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Style/ColorTest.php + message: "#^Cannot call method getUnderline\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$rgbValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:getGreen\\(\\) expects string, mixed given\\.$#" + message: "#^Instanceof between \\*NEVER\\* and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Style/ColorTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$rgbValue of static method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Color\\:\\:getRed\\(\\) expects string, mixed given\\.$#" + message: "#^Instanceof between string and PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText will always evaluate to false\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Style/ColorTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$condition of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\:\\:addCondition\\(\\) expects string, float given\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Style/ConditionalTest.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 \\#1 \\$conditions of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\:\\:setConditions\\(\\) expects array\\\\|bool\\|float\\|int\\|string, array\\ given\\.$#" + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Style/ConditionalTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#2 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\\\Column\\:\\:setAttribute\\(\\) expects string, int given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.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 PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter\\\\Column\\\\Rule\\:\\:setRule\\(\\) expects array\\\\|int\\|string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/AutoFilter/DateGroupTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" + count: 5 + path: src/PhpSpreadsheet/Writer/Xlsx/StringTable.php - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" + message: "#^Cannot call method getStyle\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Conditional\\|null\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php + message: "#^Comparison operation \"\\<\" between int\\ and 0 is always true\\.$#" + count: 2 + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" + 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: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Parameter \\#2 \\$rowIndex of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowCellIterator constructor expects int, string given\\.$#" + 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: tests/PhpSpreadsheetTests/Worksheet/RowCellIterator2Test.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Cannot access offset 0 on mixed\\.$#" + 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: tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Cannot access offset 1 on mixed\\.$#" + 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: tests/PhpSpreadsheetTests/Worksheet/WorksheetTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheetTests\\\\Writer\\\\Html\\\\CallbackTest\\:\\:yellowBody\\(\\) should return string but returns string\\|null\\.$#" + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Html/CallbackTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Writer/Html/CallbackTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" + count: 22 + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.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: "#^Cannot call method setSubScript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.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: "#^Cannot call method setSuperScript\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Html/GridlinesTest.php + 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: "#^Cannot call method getPlainText\\(\\) on mixed\\.$#" + message: "#^Result of \\|\\| is always true\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Style.php - - message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#" - count: 3 - path: tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" + count: 7 + path: src/PhpSpreadsheet/Writer/Xlsx/Workbook.php - - message: "#^Parameter \\#1 \\$text of method PhpOffice\\\\PhpSpreadsheet\\\\Comment\\:\\:setText\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\RichText, mixed given\\.$#" + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#1 \\$formatCode of method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\NumberFormat\\:\\:setFormatCode\\(\\) expects string, mixed given\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Writer/Html/HtmlNumberFormatTest.php + message: "#^If condition is always true\\.$#" + count: 6 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset 10 on mixed\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeAttributeIf\\(\\) has parameter \\$condition with no type specified\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset 12 on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeDataBarElements\\(\\) has parameter \\$dataBar with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset 25 on mixed\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeElementIf\\(\\) has parameter \\$condition with no type specified\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset 8 on mixed\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + message: "#^Negated boolean expression is always false\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset 9 on mixed\\.$#" + message: "#^Offset int\\<1, max\\> on array\\\\> in isset\\(\\) does not exist\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access offset int\\|string\\|false on mixed\\.$#" + message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int\\|string given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#" + count: 15 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#1 \\$palette of method PhpOffice\\\\PhpSpreadsheetTests\\\\Writer\\\\Xls\\\\WorkbookTest\\:\\:paletteToColor\\(\\) expects array, mixed given\\.$#" - count: 6 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#" + count: 3 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<1, max\\> given\\.$#" + count: 9 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php - - - - message: "#^Cannot call method getCell\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 4 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot call method getDrawingCollection\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" - count: 4 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php + message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access property \\$pageSetup on SimpleXMLElement\\|false\\.$#" + message: "#^Parameter \\#3 \\$stringTable of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeSheetData\\(\\) expects array\\, array\\\\|null given\\.$#" count: 1 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot access property \\$sheetProtection on SimpleXMLElement\\|false\\.$#" - count: 5 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php + message: "#^Parameter \\#4 \\$val of static method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Worksheet\\:\\:writeAttributeIf\\(\\) expects string, int given\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Parameter \\#1 \\$data of function simplexml_load_string expects string, string\\|false given\\.$#" + message: "#^Strict comparison using \\=\\=\\= between false and true will always evaluate to false\\.$#" count: 2 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php + path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php - - message: "#^Cannot call method getExtension\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\|null\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Writer/Xlsx/WmfTest.php + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Xlfn\\:\\:addXlfn\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/PhpSpreadsheet/Writer/Xlsx/Xlfn.php diff --git a/vendor/phpoffice/phpspreadsheet/phpstan-conditional.php b/vendor/phpoffice/phpspreadsheet/phpstan-conditional.php new file mode 100644 index 0000000..c5d28dd --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/phpstan-conditional.php @@ -0,0 +1,51 @@ + '~^Method .* has invalid return type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/Drawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Property .* has unknown class GdImage as its type\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Method .* has invalid return type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Class GdImage not found\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'count' => 1, + ]; + // Erroneous analysis by Phpstan before PHP8 - 3rd parameter is nullable + $config['parameters']['ignoreErrors'][] = [ + 'message' => '#^Parameter \\#3 \\$namespace of method XMLWriter\\:\\:startElementNs\\(\\) expects string, null given\\.$#', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php', + 'count' => 8, + ]; + // Erroneous analysis by Phpstan before PHP8 - mb_strlen does not return false + $config['parameters']['ignoreErrors'][] = [ + 'message' => '#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:countCharacters\\(\\) should return int but returns int(<0, max>)?\\|false\\.$#', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/StringHelper.php', + 'count' => 1, + ]; +} + +return $config; diff --git a/vendor/phpoffice/phpspreadsheet/phpstan.neon.dist b/vendor/phpoffice/phpspreadsheet/phpstan.neon.dist index e2f78e3..e97e1ce 100644 --- a/vendor/phpoffice/phpspreadsheet/phpstan.neon.dist +++ b/vendor/phpoffice/phpspreadsheet/phpstan.neon.dist @@ -1,10 +1,11 @@ includes: - phpstan-baseline.neon + - phpstan-conditional.php - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon parameters: - level: max + level: 8 paths: - src/ - tests/ @@ -12,12 +13,8 @@ parameters: processTimeout: 300.0 checkMissingIterableValueType: false ignoreErrors: - - '~^Class GdImage not found\.$~' - - '~^Method .* has invalid return type GdImage\.$~' - - '~^Property .* has unknown class GdImage as its type\.$~' - - '~^Parameter .* of method .* has invalid type GdImage\.$~' - - '~^Parameter \#1 \$im of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy) expects resource, GdImage\|resource given\.$~' - - '~^Parameter \#2 \$src_im of function imagecopy expects resource, GdImage\|resource given\.$~' + - '~^Parameter \#1 \$im(age)? of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy) expects (GdImage|resource), GdImage\|resource given\.$~' + - '~^Parameter \#2 \$src_im(age)? of function imagecopy expects (GdImage|resource), GdImage\|resource given\.$~' # Accept a bit anything for assert methods - '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~' - '~^Method PhpOffice\\PhpSpreadsheetTests\\.*\:\:test.*\(\) has parameter \$args with no type specified\.$~' diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ArrayEnabled.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ArrayEnabled.php new file mode 100644 index 0000000..0ad429e --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ArrayEnabled.php @@ -0,0 +1,133 @@ +initialise($arguments ?: []); + } + + /** + * Handles array argument processing when the function accepts a single argument that can be an array argument. + * Example use for: + * DAYOFMONTH() or FACT(). + */ + protected static function evaluateSingleArgumentArray(callable $method, array $values): array + { + $result = []; + foreach ($values as $value) { + $result[] = $method($value); + } + + return $result; + } + + /** + * Handles array argument processing when the function accepts multiple arguments, + * and any of them can be an array argument. + * Example use for: + * ROUND() or DATE(). + * + * @param mixed ...$arguments + */ + protected static function evaluateArrayArguments(callable $method, ...$arguments): array + { + self::initialiseHelper($arguments); + $arguments = self::$arrayArgumentHelper->arguments(); + + return ArrayArgumentProcessor::processArguments(self::$arrayArgumentHelper, $method, ...$arguments); + } + + /** + * Handles array argument processing when the function accepts multiple arguments, + * but only the first few (up to limit) can be an array arguments. + * Example use for: + * NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need + * to be treated as a such rather than as an array arguments. + * + * @param mixed ...$arguments + */ + protected static function evaluateArrayArgumentsSubset(callable $method, int $limit, ...$arguments): array + { + self::initialiseHelper(array_slice($arguments, 0, $limit)); + $trailingArguments = array_slice($arguments, $limit); + $arguments = self::$arrayArgumentHelper->arguments(); + $arguments = array_merge($arguments, $trailingArguments); + + return ArrayArgumentProcessor::processArguments(self::$arrayArgumentHelper, $method, ...$arguments); + } + + /** + * @param mixed $value + */ + private static function testFalse($value): bool + { + return $value === false; + } + + /** + * Handles array argument processing when the function accepts multiple arguments, + * but only the last few (from start) can be an array arguments. + * Example use for: + * Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset + * rather than as an array argument. + * + * @param mixed ...$arguments + */ + protected static function evaluateArrayArgumentsSubsetFrom(callable $method, int $start, ...$arguments): array + { + $arrayArgumentsSubset = array_combine( + range($start, count($arguments) - $start), + array_slice($arguments, $start) + ); + if (self::testFalse($arrayArgumentsSubset)) { + return ['#VALUE!']; + } + + self::initialiseHelper($arrayArgumentsSubset); + $leadingArguments = array_slice($arguments, 0, $start); + $arguments = self::$arrayArgumentHelper->arguments(); + $arguments = array_merge($leadingArguments, $arguments); + + return ArrayArgumentProcessor::processArguments(self::$arrayArgumentHelper, $method, ...$arguments); + } + + /** + * Handles array argument processing when the function accepts multiple arguments, + * and any of them can be an array argument except for the one specified by ignore. + * Example use for: + * HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database + * rather than as an array argument. + * + * @param mixed ...$arguments + */ + protected static function evaluateArrayArgumentsIgnore(callable $method, int $ignore, ...$arguments): array + { + $leadingArguments = array_slice($arguments, 0, $ignore); + $ignoreArgument = array_slice($arguments, $ignore, 1); + $trailingArguments = array_slice($arguments, $ignore + 1); + + self::initialiseHelper(array_merge($leadingArguments, [[null]], $trailingArguments)); + $arguments = self::$arrayArgumentHelper->arguments(); + + array_splice($arguments, $ignore, 1, $ignoreArgument); + + return ArrayArgumentProcessor::processArguments(self::$arrayArgumentHelper, $method, ...$arguments); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/BinaryComparison.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/BinaryComparison.php new file mode 100644 index 0000000..5d4f261 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/BinaryComparison.php @@ -0,0 +1,181 @@ + '' && $operand1[0] == Calculation::FORMULA_STRING_QUOTE) { + $operand1 = Calculation::unwrapResult($operand1); + } + if (is_string($operand2) && $operand2 > '' && $operand2[0] == Calculation::FORMULA_STRING_QUOTE) { + $operand2 = Calculation::unwrapResult($operand2); + } + + // Use case insensitive comparaison if not OpenOffice mode + if (Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) { + if (is_string($operand1)) { + $operand1 = StringHelper::strToUpper($operand1); + } + if (is_string($operand2)) { + $operand2 = StringHelper::strToUpper($operand2); + } + } + + $useLowercaseFirstComparison = is_string($operand1) && + is_string($operand2) && + Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE; + + return self::evaluateComparison($operand1, $operand2, $operator, $useLowercaseFirstComparison); + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function evaluateComparison($operand1, $operand2, string $operator, bool $useLowercaseFirstComparison): bool + { + switch ($operator) { + // Equality + case '=': + return self::equal($operand1, $operand2); + // Greater than + case '>': + return self::greaterThan($operand1, $operand2, $useLowercaseFirstComparison); + // Less than + case '<': + return self::lessThan($operand1, $operand2, $useLowercaseFirstComparison); + // Greater than or equal + case '>=': + return self::greaterThanOrEqual($operand1, $operand2, $useLowercaseFirstComparison); + // Less than or equal + case '<=': + return self::lessThanOrEqual($operand1, $operand2, $useLowercaseFirstComparison); + // Inequality + case '<>': + return self::notEqual($operand1, $operand2); + default: + throw new Exception('Unsupported binary comparison operator'); + } + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function equal($operand1, $operand2): bool + { + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = (abs($operand1 - $operand2) < self::DELTA); + } elseif (($operand1 === null && is_numeric($operand2)) || ($operand2 === null && is_numeric($operand1))) { + $result = $operand1 == $operand2; + } else { + $result = self::strcmpAllowNull($operand1, $operand2) == 0; + } + + return $result; + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function greaterThanOrEqual($operand1, $operand2, bool $useLowercaseFirstComparison): bool + { + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = ((abs($operand1 - $operand2) < self::DELTA) || ($operand1 > $operand2)); + } elseif (($operand1 === null && is_numeric($operand2)) || ($operand2 === null && is_numeric($operand1))) { + $result = $operand1 >= $operand2; + } elseif ($useLowercaseFirstComparison) { + $result = self::strcmpLowercaseFirst($operand1, $operand2) >= 0; + } else { + $result = self::strcmpAllowNull($operand1, $operand2) >= 0; + } + + return $result; + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function lessThanOrEqual($operand1, $operand2, bool $useLowercaseFirstComparison): bool + { + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = ((abs($operand1 - $operand2) < self::DELTA) || ($operand1 < $operand2)); + } elseif (($operand1 === null && is_numeric($operand2)) || ($operand2 === null && is_numeric($operand1))) { + $result = $operand1 <= $operand2; + } elseif ($useLowercaseFirstComparison) { + $result = self::strcmpLowercaseFirst($operand1, $operand2) <= 0; + } else { + $result = self::strcmpAllowNull($operand1, $operand2) <= 0; + } + + return $result; + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function greaterThan($operand1, $operand2, bool $useLowercaseFirstComparison): bool + { + return self::lessThanOrEqual($operand1, $operand2, $useLowercaseFirstComparison) !== true; + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function lessThan($operand1, $operand2, bool $useLowercaseFirstComparison): bool + { + return self::greaterThanOrEqual($operand1, $operand2, $useLowercaseFirstComparison) !== true; + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + */ + private static function notEqual($operand1, $operand2): bool + { + return self::equal($operand1, $operand2) !== true; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php index b473b27..26ef794 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2,8 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Engine\BranchPruner; use PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack; use PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; +use PhpOffice\PhpSpreadsheet\Calculation\Information\Value; use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; @@ -29,17 +33,17 @@ class Calculation // Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it) const CALCULATION_REGEXP_FUNCTION = '@?(?:_xlfn\.)?([\p{L}][\p{L}\p{N}\.]*)[\s]*\('; // Cell reference (cell or range of cells, with or without a sheet reference) - const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?\b([a-z]{1,3})\$?(\d{1,7})(?![\w.])'; + const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=:`-]*)|(\'.*?\')|(\".*?\"))!)?\$?\b([a-z]{1,3})\$?(\d{1,7})(?![\w.])'; // Cell reference (with or without a sheet reference) ensuring absolute/relative - const CALCULATION_REGEXP_CELLREF_RELATIVE = '((([^\s\(,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?(\$?\b[a-z]{1,3})(\$?\d{1,7})(?![\w.])'; - const CALCULATION_REGEXP_COLUMN_RANGE = '(((([^\s\(,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?(\$?[a-z]{1,3})):(?![.*])'; - const CALCULATION_REGEXP_ROW_RANGE = '(((([^\s\(,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?(\$?[1-9][0-9]{0,6})):(?![.*])'; + const CALCULATION_REGEXP_CELLREF_RELATIVE = '((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'.*?\')|(\".*?\"))!)?(\$?\b[a-z]{1,3})(\$?\d{1,7})(?![\w.])'; + const CALCULATION_REGEXP_COLUMN_RANGE = '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'.*?\')|(\".*?\"))!)?(\$?[a-z]{1,3})):(?![.*])'; + const CALCULATION_REGEXP_ROW_RANGE = '(((([^\s\(,!&%^\/\*\+<>=:`-]*)|(\'.*?\')|(\".*?\"))!)?(\$?[1-9][0-9]{0,6})):(?![.*])'; // Cell reference (with or without a sheet reference) ensuring absolute/relative // Cell ranges ensuring absolute/relative const CALCULATION_REGEXP_COLUMNRANGE_RELATIVE = '(\$?[a-z]{1,3}):(\$?[a-z]{1,3})'; const CALCULATION_REGEXP_ROWRANGE_RELATIVE = '(\$?\d{1,7}):(\$?\d{1,7})'; // Defined Names: Named Range of cells, or Named Formulae - const CALCULATION_REGEXP_DEFINEDNAME = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_\p{L}][_\p{L}\p{N}\.]*)'; + const CALCULATION_REGEXP_DEFINEDNAME = '((([^\s,!&%^\/\*\+<>=-]*)|(\'.*?\')|(\".*?\"))!)?([_\p{L}][_\p{L}\p{N}\.]*)'; // Error const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; @@ -48,8 +52,10 @@ class Calculation const RETURN_ARRAY_AS_VALUE = 'value'; const RETURN_ARRAY_AS_ARRAY = 'array'; - const FORMULA_OPEN_FUNCTION_BRACE = '{'; - const FORMULA_CLOSE_FUNCTION_BRACE = '}'; + const FORMULA_OPEN_FUNCTION_BRACE = '('; + const FORMULA_CLOSE_FUNCTION_BRACE = ')'; + const FORMULA_OPEN_MATRIX_BRACE = '{'; + const FORMULA_CLOSE_MATRIX_BRACE = '}'; const FORMULA_STRING_QUOTE = '"'; private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE; @@ -83,12 +89,13 @@ class Calculation private $calculationCacheEnabled = true; /** - * Used to generate unique store keys. - * - * @var int + * @var BranchPruner */ - private $branchStoreKeyCounter = 0; + private $branchPruner; + /** + * @var bool + */ private $branchPruningEnabled = true; /** @@ -101,7 +108,8 @@ class Calculation '+' => true, '-' => true, '*' => true, '/' => true, '^' => true, '&' => true, '%' => false, '~' => false, '>' => true, '<' => true, '=' => true, '>=' => true, - '<=' => true, '<>' => true, '|' => true, ':' => true, + '<=' => true, '<>' => true, '∩' => true, '∪' => true, + ':' => true, ]; /** @@ -113,7 +121,7 @@ class Calculation '+' => true, '-' => true, '*' => true, '/' => true, '^' => true, '&' => true, '>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true, - '|' => true, ':' => true, + '∩' => true, '∪' => true, ':' => true, ]; /** @@ -173,13 +181,6 @@ class Calculation */ public $cyclicFormulaCount = 1; - /** - * Epsilon Precision used for comparisons in calculations. - * - * @var float - */ - private $delta = 0.1e-12; - /** * The current locale setting. * @@ -223,7 +224,7 @@ class Calculation * * @var array */ - private static $excelConstants = [ + public static $excelConstants = [ 'TRUE' => true, 'FALSE' => false, 'NULL' => null, @@ -980,7 +981,7 @@ class Calculation ], 'ERROR.TYPE' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'errorType'], + 'functionCall' => [Information\ExcelError::class, 'type'], 'argumentCount' => '1', ], 'EVEN' => [ @@ -1040,8 +1041,8 @@ class Calculation ], 'FILTER' => [ 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => [Functions::class, 'DUMMY'], - 'argumentCount' => '3+', + 'functionCall' => [LookupRef\Filter::class, 'filter'], + 'argumentCount' => '2-3', ], 'FILTERXML' => [ 'category' => Category::CATEGORY_WEB, @@ -1464,49 +1465,49 @@ class Calculation ], 'ISBLANK' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isBlank'], + 'functionCall' => [Information\Value::class, 'isBlank'], 'argumentCount' => '1', ], 'ISERR' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isErr'], + 'functionCall' => [Information\ErrorValue::class, 'isErr'], 'argumentCount' => '1', ], 'ISERROR' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isError'], + 'functionCall' => [Information\ErrorValue::class, 'isError'], 'argumentCount' => '1', ], 'ISEVEN' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isEven'], + 'functionCall' => [Information\Value::class, 'isEven'], 'argumentCount' => '1', ], 'ISFORMULA' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isFormula'], + 'functionCall' => [Information\Value::class, 'isFormula'], 'argumentCount' => '1', 'passCellReference' => true, 'passByReference' => [true], ], 'ISLOGICAL' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isLogical'], + 'functionCall' => [Information\Value::class, 'isLogical'], 'argumentCount' => '1', ], 'ISNA' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isNa'], + 'functionCall' => [Information\ErrorValue::class, 'isNa'], 'argumentCount' => '1', ], 'ISNONTEXT' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isNonText'], + 'functionCall' => [Information\Value::class, 'isNonText'], 'argumentCount' => '1', ], 'ISNUMBER' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isNumber'], + 'functionCall' => [Information\Value::class, 'isNumber'], 'argumentCount' => '1', ], 'ISO.CEILING' => [ @@ -1516,7 +1517,7 @@ class Calculation ], 'ISODD' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isOdd'], + 'functionCall' => [Information\Value::class, 'isOdd'], 'argumentCount' => '1', ], 'ISOWEEKNUM' => [ @@ -1531,12 +1532,14 @@ class Calculation ], 'ISREF' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'DUMMY'], + 'functionCall' => [Information\Value::class, 'isRef'], 'argumentCount' => '1', + 'passCellReference' => true, + 'passByReference' => [true], ], 'ISTEXT' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'isText'], + 'functionCall' => [Information\Value::class, 'isText'], 'argumentCount' => '1', ], 'ISTHAIDIGIT' => [ @@ -1766,12 +1769,12 @@ class Calculation ], 'N' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'n'], + 'functionCall' => [Information\Value::class, 'asNumber'], 'argumentCount' => '1', ], 'NA' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'NA'], + 'functionCall' => [Information\ExcelError::class, 'NA'], 'argumentCount' => '0', ], 'NEGBINOMDIST' => [ @@ -2078,7 +2081,7 @@ class Calculation ], 'RANDARRAY' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [Functions::class, 'DUMMY'], + 'functionCall' => [MathTrig\Random::class, 'randArray'], 'argumentCount' => '0-5', ], 'RANDBETWEEN' => [ @@ -2220,8 +2223,8 @@ class Calculation ], 'SEQUENCE' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [Functions::class, 'DUMMY'], - 'argumentCount' => '2', + 'functionCall' => [MathTrig\MatrixFunctions::class, 'sequence'], + 'argumentCount' => '1-4', ], 'SERIESSUM' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, @@ -2280,12 +2283,12 @@ class Calculation ], 'SORT' => [ 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => [Functions::class, 'DUMMY'], - 'argumentCount' => '1+', + 'functionCall' => [LookupRef\Sort::class, 'sort'], + 'argumentCount' => '1-4', ], 'SORTBY' => [ 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => [Functions::class, 'DUMMY'], + 'functionCall' => [LookupRef\Sort::class, 'sortBy'], 'argumentCount' => '2+', ], 'SQRT' => [ @@ -2566,7 +2569,7 @@ class Calculation ], 'TYPE' => [ 'category' => Category::CATEGORY_INFORMATION, - 'functionCall' => [Functions::class, 'TYPE'], + 'functionCall' => [Information\Value::class, 'type'], 'argumentCount' => '1', ], 'UNICHAR' => [ @@ -2581,7 +2584,7 @@ class Calculation ], 'UNIQUE' => [ 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => [Functions::class, 'DUMMY'], + 'functionCall' => [LookupRef\Unique::class, 'unique'], 'argumentCount' => '1+', ], 'UPPER' => [ @@ -2759,11 +2762,10 @@ class Calculation public function __construct(?Spreadsheet $spreadsheet = null) { - $this->delta = 1 * 10 ** (0 - ini_get('precision')); - $this->spreadsheet = $spreadsheet; $this->cyclicReferenceStack = new CyclicReferenceStack(); $this->debugLog = new Logger($this->cyclicReferenceStack); + $this->branchPruner = new BranchPruner($this->branchPruningEnabled); self::$referenceHelper = ReferenceHelper::getInstance(); } @@ -2807,7 +2809,7 @@ public static function getInstance(?Spreadsheet $spreadsheet = null): self public function flushInstance(): void { $this->clearCalculationCache(); - $this->clearBranchStore(); + $this->branchPruner->clearBranchStore(); } /** @@ -2959,6 +2961,7 @@ public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksh public function setBranchPruningEnabled($enabled): void { $this->branchPruningEnabled = $enabled; + $this->branchPruner = new BranchPruner($this->branchPruningEnabled); } public function enableBranchPruning(): void @@ -2971,11 +2974,6 @@ public function disableBranchPruning(): void $this->setBranchPruningEnabled(false); } - public function clearBranchStore(): void - { - $this->branchStoreKeyCounter = 0; - } - /** * Get the currently defined locale code. * @@ -3089,30 +3087,28 @@ public function setLocale(string $locale) return false; } - /** - * @param string $fromSeparator - * @param string $toSeparator - * @param string $formula - * @param bool $inBraces - * - * @return string - */ - public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) - { + public static function translateSeparator( + string $fromSeparator, + string $toSeparator, + string $formula, + int &$inBracesLevel, + string $openBrace = self::FORMULA_OPEN_FUNCTION_BRACE, + string $closeBrace = self::FORMULA_CLOSE_FUNCTION_BRACE + ): string { $strlen = mb_strlen($formula); for ($i = 0; $i < $strlen; ++$i) { $chr = mb_substr($formula, $i, 1); switch ($chr) { - case self::FORMULA_OPEN_FUNCTION_BRACE: - $inBraces = true; + case $openBrace: + ++$inBracesLevel; break; - case self::FORMULA_CLOSE_FUNCTION_BRACE: - $inBraces = false; + case $closeBrace: + --$inBracesLevel; break; case $fromSeparator: - if (!$inBraces) { + if ($inBracesLevel > 0) { $formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1); } } @@ -3121,31 +3117,47 @@ public static function translateSeparator($fromSeparator, $toSeparator, $formula return $formula; } - /** - * @param string[] $from - * @param string[] $to - * @param string $formula - * @param string $fromSeparator - * @param string $toSeparator - * - * @return string - */ - private static function translateFormula(array $from, array $to, $formula, $fromSeparator, $toSeparator) + private static function translateFormulaBlock( + array $from, + array $to, + string $formula, + int &$inFunctionBracesLevel, + int &$inMatrixBracesLevel, + string $fromSeparator, + string $toSeparator + ): string { + // Function Names + $formula = preg_replace($from, $to, $formula); + + // Temporarily adjust matrix separators so that they won't be confused with function arguments + $formula = self::translateSeparator(';', '|', $formula, $inMatrixBracesLevel, self::FORMULA_OPEN_MATRIX_BRACE, self::FORMULA_CLOSE_MATRIX_BRACE); + $formula = self::translateSeparator(',', '!', $formula, $inMatrixBracesLevel, self::FORMULA_OPEN_MATRIX_BRACE, self::FORMULA_CLOSE_MATRIX_BRACE); + // Function Argument Separators + $formula = self::translateSeparator($fromSeparator, $toSeparator, $formula, $inFunctionBracesLevel); + // Restore matrix separators + $formula = self::translateSeparator('|', ';', $formula, $inMatrixBracesLevel, self::FORMULA_OPEN_MATRIX_BRACE, self::FORMULA_CLOSE_MATRIX_BRACE); + $formula = self::translateSeparator('!', ',', $formula, $inMatrixBracesLevel, self::FORMULA_OPEN_MATRIX_BRACE, self::FORMULA_CLOSE_MATRIX_BRACE); + + return $formula; + } + + private static function translateFormula(array $from, array $to, string $formula, string $fromSeparator, string $toSeparator): string { - // Convert any Excel function names to the required language + // Convert any Excel function names and constant names to the required language; + // and adjust function argument separators if (self::$localeLanguage !== 'en_us') { - $inBraces = false; - // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators + $inFunctionBracesLevel = 0; + $inMatrixBracesLevel = 0; + // If there is the possibility of separators within a quoted string, then we treat them as literals if (strpos($formula, self::FORMULA_STRING_QUOTE) !== false) { - // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded - // the formula + // So instead we skip replacing in any quoted strings by only replacing in every other array element + // after we've exploded the formula $temp = explode(self::FORMULA_STRING_QUOTE, $formula); $i = false; foreach ($temp as &$value) { - // Only count/replace in alternating array entries + // Only adjust in alternating array entries if ($i = !$i) { - $value = preg_replace($from, $to, $value); - $value = self::translateSeparator($fromSeparator, $toSeparator, $value, $inBraces); + $value = self::translateFormulaBlock($from, $to, $value, $inFunctionBracesLevel, $inMatrixBracesLevel, $fromSeparator, $toSeparator); } } unset($value); @@ -3153,8 +3165,7 @@ private static function translateFormula(array $from, array $to, $formula, $from $formula = implode(self::FORMULA_STRING_QUOTE, $temp); } else { // If there's no quoted strings, then we do a simple count/replace - $formula = preg_replace($from, $to, $formula); - $formula = self::translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces); + $formula = self::translateFormulaBlock($from, $to, $formula, $inFunctionBracesLevel, $inMatrixBracesLevel, $fromSeparator, $toSeparator); } } @@ -3167,13 +3178,14 @@ private static function translateFormula(array $from, array $to, $formula, $from public function _translateFormulaToLocale($formula) { + // Build list of function names and constants for translation if (self::$functionReplaceFromExcel === null) { self::$functionReplaceFromExcel = []; foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName, '/') . '([\s]*\()/Ui'; + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName, '/') . '([\s]*\()/ui'; } foreach (array_keys(self::$localeBoolean) as $excelBoolean) { - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui'; + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/ui'; } } @@ -3187,7 +3199,13 @@ public function _translateFormulaToLocale($formula) } } - return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator); + return self::translateFormula( + self::$functionReplaceFromExcel, + self::$functionReplaceToLocale, + $formula, + ',', + self::$localeArgumentSeparator + ); } private static $functionReplaceFromLocale; @@ -3199,16 +3217,17 @@ public function _translateFormulaToEnglish($formula) if (self::$functionReplaceFromLocale === null) { self::$functionReplaceFromLocale = []; foreach (self::$localeFunctions as $localeFunctionName) { - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/Ui'; + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/ui'; } foreach (self::$localeBoolean as $excelBoolean) { - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui'; + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/ui'; } } if (self::$functionReplaceToExcel === null) { self::$functionReplaceToExcel = []; foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { + // @phpstan-ignore-next-line self::$functionReplaceToExcel[] = '$1' . trim($excelFunctionName) . '$2'; } foreach (array_keys(self::$localeBoolean) as $excelBoolean) { @@ -3255,7 +3274,7 @@ public static function wrapResult($value) return self::FORMULA_STRING_QUOTE . $value . self::FORMULA_STRING_QUOTE; } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { // Convert numeric errors to NaN error - return Functions::NAN(); + return Information\ExcelError::NAN(); } return $value; @@ -3276,7 +3295,7 @@ public static function unwrapResult($value) } // Convert numeric errors to NAN error } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { - return Functions::NAN(); + return Information\ExcelError::NAN(); } return $value; @@ -3345,7 +3364,7 @@ public function calculateCellValue(?Cell $cell = null, $resetLog = true) self::$returnArrayAsType = $returnArrayAsType; $testResult = Functions::flattenArray($result); if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { - return Functions::VALUE(); + return Information\ExcelError::VALUE(); } // If there's only a single cell in the array, then we allow it if (count($testResult) != 1) { @@ -3353,13 +3372,13 @@ public function calculateCellValue(?Cell $cell = null, $resetLog = true) $r = array_keys($result); $r = array_shift($r); if (!is_numeric($r)) { - return Functions::VALUE(); + return Information\ExcelError::VALUE(); } if (is_array($result[$r])) { $c = array_keys($result[$r]); $c = array_shift($c); if (!is_numeric($c)) { - return Functions::VALUE(); + return Information\ExcelError::VALUE(); } } } @@ -3370,7 +3389,7 @@ public function calculateCellValue(?Cell $cell = null, $resetLog = true) if ($result === null && $cell->getWorksheet()->getSheetView()->getShowZeros()) { return 0; } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) { - return Functions::NAN(); + return Information\ExcelError::NAN(); } return $result; @@ -3446,11 +3465,11 @@ public function calculateFormula($formula, $cellID = null, ?Cell $cell = null) */ public function getValueFromCache(string $cellReference, &$cellValue): bool { - $this->debugLog->writeDebugLog("Testing cache value for cell {$cellReference}"); + $this->debugLog->writeDebugLog('Testing cache value for cell %s', $cellReference); // Is calculation cacheing enabled? // If so, is the required value present in calculation cache? if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) { - $this->debugLog->writeDebugLog("Retrieving value for cell {$cellReference} from cache"); + $this->debugLog->writeDebugLog('Retrieving value for cell %s from cache', $cellReference); // Return the cached result $cellValue = $this->calculationCache[$cellReference]; @@ -3512,7 +3531,7 @@ public function _calculateFormulaValue($formula, $cellID = null, ?Cell $cell = n if (($cellID !== null) && ($this->getValueFromCache($wsCellReference, $cellValue))) { return $cellValue; } - $this->debugLog->writeDebugLog("Evaluating formula for cell {$wsCellReference}"); + $this->debugLog->writeDebugLog('Evaluating formula for cell %s', $wsCellReference); if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { if ($this->cyclicFormulaCount <= 0) { @@ -3534,7 +3553,7 @@ public function _calculateFormulaValue($formula, $cellID = null, ?Cell $cell = n } } - $this->debugLog->writeDebugLog("Formula for cell {$wsCellReference} is {$formula}"); + $this->debugLog->writeDebugLog('Formula for cell %s is %s', $wsCellReference, $formula); // Parse the formula onto the token stack and calculate the value $this->cyclicReferenceStack->push($wsCellReference); @@ -3742,6 +3761,8 @@ private function showValue($value) return self::FORMULA_STRING_QUOTE . $value . self::FORMULA_STRING_QUOTE; } elseif (is_bool($value)) { return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; + } elseif ($value === null) { + return self::$localeBoolean['NULL']; } } @@ -3795,11 +3816,11 @@ private function showTypeDetails($value) */ private function convertMatrixReferences($formula) { - static $matrixReplaceFrom = [self::FORMULA_OPEN_FUNCTION_BRACE, ';', self::FORMULA_CLOSE_FUNCTION_BRACE]; + static $matrixReplaceFrom = [self::FORMULA_OPEN_MATRIX_BRACE, ';', self::FORMULA_CLOSE_MATRIX_BRACE]; static $matrixReplaceTo = ['MKMATRIX(MKMATRIX(', '),MKMATRIX(', '))']; // Convert any Excel matrix references to the MKMATRIX() function - if (strpos($formula, self::FORMULA_OPEN_FUNCTION_BRACE) !== false) { + if (strpos($formula, self::FORMULA_OPEN_MATRIX_BRACE) !== false) { // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators if (strpos($formula, self::FORMULA_STRING_QUOTE) !== false) { // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded @@ -3811,8 +3832,8 @@ private function convertMatrixReferences($formula) foreach ($temp as &$value) { // Only count/replace in alternating array entries if ($i = !$i) { - $openCount += substr_count($value, self::FORMULA_OPEN_FUNCTION_BRACE); - $closeCount += substr_count($value, self::FORMULA_CLOSE_FUNCTION_BRACE); + $openCount += substr_count($value, self::FORMULA_OPEN_MATRIX_BRACE); + $closeCount += substr_count($value, self::FORMULA_CLOSE_MATRIX_BRACE); $value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value); } } @@ -3821,8 +3842,8 @@ private function convertMatrixReferences($formula) $formula = implode(self::FORMULA_STRING_QUOTE, $temp); } else { // If there's no quoted strings, then we do a simple count/replace - $openCount = substr_count($formula, self::FORMULA_OPEN_FUNCTION_BRACE); - $closeCount = substr_count($formula, self::FORMULA_CLOSE_FUNCTION_BRACE); + $openCount = substr_count($formula, self::FORMULA_OPEN_MATRIX_BRACE); + $closeCount = substr_count($formula, self::FORMULA_CLOSE_MATRIX_BRACE); $formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula); } // Trap for mismatched braces and trigger an appropriate error @@ -3852,7 +3873,7 @@ private function convertMatrixReferences($formula) '*' => 0, '/' => 0, // Multiplication and Division '+' => 0, '-' => 0, // Addition and Subtraction '&' => 0, // Concatenation - '|' => 0, ':' => 0, // Intersect and Range + '∪' => 0, '∩' => 0, ':' => 0, // Union, Intersect and Range '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison ]; @@ -3864,8 +3885,9 @@ private function convertMatrixReferences($formula) // This list includes all valid operators, whether binary (including boolean) or unary (such as %) // Array key is the operator, the value is its precedence private static $operatorPrecedence = [ - ':' => 8, // Range - '|' => 7, // Intersect + ':' => 9, // Range + '∩' => 8, // Intersect + '∪' => 7, // Union '~' => 6, // Negation '%' => 5, // Percentage '^' => 4, // Exponentiation @@ -3892,12 +3914,12 @@ private function internalParseFormula($formula, ?Cell $cell = null) // so we store the parent worksheet so that we can re-attach it when necessary $pCellParent = ($cell !== null) ? $cell->getWorksheet() : null; - $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . + $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_STRING . + '|' . self::CALCULATION_REGEXP_FUNCTION . '|' . self::CALCULATION_REGEXP_CELLREF . - '|' . self::CALCULATION_REGEXP_COLUMN_RANGE . - '|' . self::CALCULATION_REGEXP_ROW_RANGE . + '|' . self::CALCULATION_REGEXP_COLUMN_RANGE . + '|' . self::CALCULATION_REGEXP_ROW_RANGE . '|' . self::CALCULATION_REGEXP_NUMBER . - '|' . self::CALCULATION_REGEXP_STRING . '|' . self::CALCULATION_REGEXP_OPENBRACE . '|' . self::CALCULATION_REGEXP_DEFINEDNAME . '|' . self::CALCULATION_REGEXP_ERROR . @@ -3905,58 +3927,19 @@ private function internalParseFormula($formula, ?Cell $cell = null) // Start with initialisation $index = 0; - $stack = new Stack(); + $stack = new Stack($this->branchPruner); $output = []; $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a // - is a negation or + is a positive operator rather than an operation $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand // should be null in a function call - // IF branch pruning - // currently pending storeKey (last item of the storeKeysStack - $pendingStoreKey = null; - // stores a list of storeKeys (string[]) - $pendingStoreKeysStack = []; - $expectingConditionMap = []; // ['storeKey' => true, ...] - $expectingThenMap = []; // ['storeKey' => true, ...] - $expectingElseMap = []; // ['storeKey' => true, ...] - $parenthesisDepthMap = []; // ['storeKey' => 4, ...] - // The guts of the lexical parser // Loop through the formula extracting each operator and operand in turn while (true) { // Branch pruning: we adapt the output item to the context (it will // be used to limit its computation) - $currentCondition = null; - $currentOnlyIf = null; - $currentOnlyIfNot = null; - $previousStoreKey = null; - $pendingStoreKey = end($pendingStoreKeysStack); - - if ($this->branchPruningEnabled) { - // this is a condition ? - if (isset($expectingConditionMap[$pendingStoreKey]) && $expectingConditionMap[$pendingStoreKey]) { - $currentCondition = $pendingStoreKey; - $stackDepth = count($pendingStoreKeysStack); - if ($stackDepth > 1) { // nested if - $previousStoreKey = $pendingStoreKeysStack[$stackDepth - 2]; - } - } - if (isset($expectingThenMap[$pendingStoreKey]) && $expectingThenMap[$pendingStoreKey]) { - $currentOnlyIf = $pendingStoreKey; - } elseif (isset($previousStoreKey)) { - if (isset($expectingThenMap[$previousStoreKey]) && $expectingThenMap[$previousStoreKey]) { - $currentOnlyIf = $previousStoreKey; - } - } - if (isset($expectingElseMap[$pendingStoreKey]) && $expectingElseMap[$pendingStoreKey]) { - $currentOnlyIfNot = $pendingStoreKey; - } elseif (isset($previousStoreKey)) { - if (isset($expectingElseMap[$previousStoreKey]) && $expectingElseMap[$previousStoreKey]) { - $currentOnlyIfNot = $previousStoreKey; - } - } - } + $this->branchPruner->initialiseForLoop(); $opCharacter = $formula[$index]; // Get the first character of the value at the current index position @@ -3968,15 +3951,15 @@ private function internalParseFormula($formula, ?Cell $cell = null) if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? // Put a negation on the stack - $stack->push('Unary Operator', '~', null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $stack->push('Unary Operator', '~'); ++$index; // and drop the negation symbol } elseif ($opCharacter == '%' && $expectingOperator) { // Put a percentage on the stack - $stack->push('Unary Operator', '%', null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $stack->push('Unary Operator', '%'); ++$index; } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded? ++$index; // Drop the redundant plus symbol - } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal + } elseif ((($opCharacter == '~') || ($opCharacter == '∩') || ($opCharacter == '∪')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde, union or intersect because they are legal return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression } elseif ((isset(self::$operators[$opCharacter]) || $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? while ( @@ -3989,13 +3972,13 @@ private function internalParseFormula($formula, ?Cell $cell = null) } // Finally put our current operator onto the stack - $stack->push('Binary Operator', $opCharacter, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $stack->push('Binary Operator', $opCharacter); ++$index; $expectingOperator = false; - } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? + } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? $expectingOperand = false; - while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( + while (($o2 = $stack->pop()) && $o2['value'] !== '(') { // Pop off the stack back to the last ( if ($o2 === null) { return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); } @@ -4005,29 +3988,19 @@ private function internalParseFormula($formula, ?Cell $cell = null) // Branch pruning we decrease the depth whether is it a function // call or a parenthesis - if (!empty($pendingStoreKey)) { - --$parenthesisDepthMap[$pendingStoreKey]; - } + $this->branchPruner->decrementDepth(); - if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $d['value'], $matches)) { // Did this parenthesis just close a function? - if (!empty($pendingStoreKey) && $parenthesisDepthMap[$pendingStoreKey] == -1) { - // we are closing an IF( - if ($d['value'] != 'IF(') { - return $this->raiseFormulaError('Parser bug we should be in an "IF("'); - } - if ($expectingConditionMap[$pendingStoreKey]) { - return $this->raiseFormulaError('We should not be expecting a condition'); - } - $expectingThenMap[$pendingStoreKey] = false; - $expectingElseMap[$pendingStoreKey] = false; - --$parenthesisDepthMap[$pendingStoreKey]; - array_pop($pendingStoreKeysStack); - unset($pendingStoreKey); + if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $d['value'], $matches)) { + // Did this parenthesis just close a function? + try { + $this->branchPruner->closingBrace($d['value']); + } catch (Exception $e) { + return $this->raiseFormulaError($e->getMessage()); } $functionName = $matches[1]; // Get the function name $d = $stack->pop(); - $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) + $argumentCount = $d['value'] ?? 0; // See how many arguments there were (argument count is the next value stored on the stack) $output[] = $d; // Dump the argument count on the output $output[] = $stack->pop(); // Pop the function and push onto the output if (isset(self::$controlFunctions[$functionName])) { @@ -4085,23 +4058,14 @@ private function internalParseFormula($formula, ?Cell $cell = null) } } ++$index; - } elseif ($opCharacter == ',') { // Is this the separator for function arguments? - if ( - !empty($pendingStoreKey) && - $parenthesisDepthMap[$pendingStoreKey] == 0 - ) { - // We must go to the IF next argument - if ($expectingConditionMap[$pendingStoreKey]) { - $expectingConditionMap[$pendingStoreKey] = false; - $expectingThenMap[$pendingStoreKey] = true; - } elseif ($expectingThenMap[$pendingStoreKey]) { - $expectingThenMap[$pendingStoreKey] = false; - $expectingElseMap[$pendingStoreKey] = true; - } elseif ($expectingElseMap[$pendingStoreKey]) { - return $this->raiseFormulaError('Reaching fourth argument of an IF'); - } + } elseif ($opCharacter == ',') { // Is this the separator for function arguments? + try { + $this->branchPruner->argumentSeparator(); + } catch (Exception $e) { + return $this->raiseFormulaError($e->getMessage()); } - while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( + + while (($o2 = $stack->pop()) && $o2['value'] !== '(') { // Pop off the stack back to the last ( if ($o2 === null) { return $this->raiseFormulaError('Formula Error: Unexpected ,'); } @@ -4110,27 +4074,32 @@ private function internalParseFormula($formula, ?Cell $cell = null) // If we've a comma when we're expecting an operand, then what we actually have is a null operand; // so push a null onto the stack if (($expectingOperand) || (!$expectingOperator)) { - $output[] = ['type' => 'Empty Argument', 'value' => self::$excelConstants['NULL'], 'reference' => null]; + $output[] = ['type' => 'Empty Argument', 'value' => self::$excelConstants['NULL'], 'reference' => 'NULL']; } // make sure there was a function $d = $stack->last(2); - if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $d['value'], $matches)) { + if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $d['value'] ?? '', $matches)) { + // Can we inject a dummy function at this point so that the braces at least have some context + // because at least the braces are paired up (at this stage in the formula) + // MS Excel allows this if the content is cell references; but doesn't allow actual values, + // but at this point, we can't differentiate (so allow both) return $this->raiseFormulaError('Formula Error: Unexpected ,'); } + + /** @var array $d */ $d = $stack->pop(); - $itemStoreKey = $d['storeKey'] ?? null; - $itemOnlyIf = $d['onlyIf'] ?? null; - $itemOnlyIfNot = $d['onlyIfNot'] ?? null; - $stack->push($d['type'], ++$d['value'], $d['reference'], $itemStoreKey, $itemOnlyIf, $itemOnlyIfNot); // increment the argument count - $stack->push('Brace', '(', null, $itemStoreKey, $itemOnlyIf, $itemOnlyIfNot); // put the ( back on, we'll need to pop back to it again + ++$d['value']; // increment the argument count + + $stack->pushStackItem($d); + $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again + $expectingOperator = false; $expectingOperand = true; ++$index; } elseif ($opCharacter == '(' && !$expectingOperator) { - if (!empty($pendingStoreKey)) { // Branch pruning: we go deeper - ++$parenthesisDepthMap[$pendingStoreKey]; - } - $stack->push('Brace', '(', null, $currentCondition, $currentOnlyIf, $currentOnlyIf); + // Branch pruning: we go deeper + $this->branchPruner->incrementDepth(); + $stack->push('Brace', '(', null); ++$index; } elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number? $expectingOperator = true; @@ -4147,25 +4116,17 @@ private function internalParseFormula($formula, ?Cell $cell = null) } // here $matches[1] will contain values like "IF" // and $val "IF(" - if ($this->branchPruningEnabled && ($valToUpper == 'IF(')) { // we handle a new if - $pendingStoreKey = $this->getUnusedBranchStoreKey(); - $pendingStoreKeysStack[] = $pendingStoreKey; - $expectingConditionMap[$pendingStoreKey] = true; - $parenthesisDepthMap[$pendingStoreKey] = 0; - } else { // this is not an if but we go deeper - if (!empty($pendingStoreKey) && array_key_exists($pendingStoreKey, $parenthesisDepthMap)) { - ++$parenthesisDepthMap[$pendingStoreKey]; - } - } - $stack->push('Function', $valToUpper, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $this->branchPruner->functionCall($valToUpper); + + $stack->push('Function', $valToUpper); // tests if the function is closed right after opening $ax = preg_match('/^\s*\)/u', substr($formula, $index + $length)); if ($ax) { - $stack->push('Operand Count for Function ' . $valToUpper . ')', 0, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $stack->push('Operand Count for Function ' . $valToUpper . ')', 0); $expectingOperator = true; } else { - $stack->push('Operand Count for Function ' . $valToUpper . ')', 1, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $stack->push('Operand Count for Function ' . $valToUpper . ')', 1); $expectingOperator = false; } $stack->push('Brace', '('); @@ -4176,17 +4137,25 @@ private function internalParseFormula($formula, ?Cell $cell = null) $testPrevOp = $stack->last(1); if ($testPrevOp !== null && $testPrevOp['value'] === ':') { // If we have a worksheet reference, then we're playing with a 3D reference - if ($matches[2] == '') { + if ($matches[2] === '') { // Otherwise, we 'inherit' the worksheet reference from the start cell reference // The start of the cell range reference should be the last entry in $output $rangeStartCellRef = $output[count($output) - 1]['value']; - preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $rangeStartCellRef, $rangeStartMatches); + if ($rangeStartCellRef === ':') { + // Do we have chained range operators? + $rangeStartCellRef = $output[count($output) - 2]['value']; + } + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/miu', $rangeStartCellRef, $rangeStartMatches); if ($rangeStartMatches[2] > '') { $val = $rangeStartMatches[2] . '!' . $val; } } else { $rangeStartCellRef = $output[count($output) - 1]['value']; - preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $rangeStartCellRef, $rangeStartMatches); + if ($rangeStartCellRef === ':') { + // Do we have chained range operators? + $rangeStartCellRef = $output[count($output) - 2]['value']; + } + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/miu', $rangeStartCellRef, $rangeStartMatches); if ($rangeStartMatches[2] !== $matches[2]) { return $this->raiseFormulaError('3D Range references are not yet supported'); } @@ -4195,11 +4164,12 @@ private function internalParseFormula($formula, ?Cell $cell = null) $worksheet = $pCellParent->getTitle(); $val = "'{$worksheet}'!{$val}"; } - - $outputItem = $stack->getStackItem('Cell Reference', $val, $val, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + // unescape any apostrophes or double quotes in worksheet name + $val = str_replace(["''", '""'], ["'", '"'], $val); + $outputItem = $stack->getStackItem('Cell Reference', $val, $val); $output[] = $outputItem; - } else { // it's a variable, constant, string, number or boolean + } else { // it's a variable, constant, string, number or boolean $localeConstant = false; $stackItemType = 'Value'; $stackItemReference = null; @@ -4208,39 +4178,65 @@ private function internalParseFormula($formula, ?Cell $cell = null) $testPrevOp = $stack->last(1); if ($testPrevOp !== null && $testPrevOp['value'] === ':') { $stackItemType = 'Cell Reference'; - $startRowColRef = $output[count($output) - 1]['value']; - [$rangeWS1, $startRowColRef] = Worksheet::extractSheetTitle($startRowColRef, true); - $rangeSheetRef = $rangeWS1; - if ($rangeWS1 !== '') { - $rangeWS1 .= '!'; - } - $rangeSheetRef = trim($rangeSheetRef, "'"); - [$rangeWS2, $val] = Worksheet::extractSheetTitle($val, true); - if ($rangeWS2 !== '') { - $rangeWS2 .= '!'; + + if ( + !is_numeric($val) && + ((ctype_alpha($val) === false || strlen($val) > 3)) && + (preg_match('/^' . self::CALCULATION_REGEXP_DEFINEDNAME . '$/mui', $val) !== false) && + ($this->spreadsheet->getNamedRange($val) !== null) + ) { + $namedRange = $this->spreadsheet->getNamedRange($val); + if ($namedRange !== null) { + $stackItemType = 'Defined Name'; + $address = str_replace('$', '', $namedRange->getValue()); + $stackItemReference = $val; + if (strpos($address, ':') !== false) { + // We'll need to manipulate the stack for an actual named range rather than a named cell + $fromTo = explode(':', $address); + $to = array_pop($fromTo); + foreach ($fromTo as $from) { + $output[] = $stack->getStackItem($stackItemType, $from, $stackItemReference); + $output[] = $stack->getStackItem('Binary Operator', ':'); + } + $address = $to; + } + $val = $address; + } } else { - $rangeWS2 = $rangeWS1; - } + $startRowColRef = $output[count($output) - 1]['value']; + [$rangeWS1, $startRowColRef] = Worksheet::extractSheetTitle($startRowColRef, true); + $rangeSheetRef = $rangeWS1; + if ($rangeWS1 !== '') { + $rangeWS1 .= '!'; + } + $rangeSheetRef = trim($rangeSheetRef, "'"); + [$rangeWS2, $val] = Worksheet::extractSheetTitle($val, true); + if ($rangeWS2 !== '') { + $rangeWS2 .= '!'; + } else { + $rangeWS2 = $rangeWS1; + } - $refSheet = $pCellParent; - if ($pCellParent !== null && $rangeSheetRef !== '' && $rangeSheetRef !== $pCellParent->getTitle()) { - $refSheet = $pCellParent->getParent()->getSheetByName($rangeSheetRef); - } + $refSheet = $pCellParent; + if ($pCellParent !== null && $rangeSheetRef !== '' && $rangeSheetRef !== $pCellParent->getTitle()) { + $refSheet = $pCellParent->getParent()->getSheetByName($rangeSheetRef); + } - if (ctype_digit($val) && $val <= 1048576) { - // Row range - $stackItemType = 'Row Reference'; - /** @var int $valx */ - $valx = $val; - $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestDataColumn($valx) : 'XFD'; // Max 16,384 columns for Excel2007 - $val = "{$rangeWS2}{$endRowColRef}{$val}"; - } elseif (ctype_alpha($val) && strlen($val) <= 3) { - // Column range - $stackItemType = 'Column Reference'; - $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestDataRow($val) : 1048576; // Max 1,048,576 rows for Excel2007 - $val = "{$rangeWS2}{$val}{$endRowColRef}"; + if (ctype_digit($val) && $val <= 1048576) { + // Row range + $stackItemType = 'Row Reference'; + /** @var int $valx */ + $valx = $val; + $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestDataColumn($valx) : 'XFD'; // Max 16,384 columns for Excel2007 + $val = "{$rangeWS2}{$endRowColRef}{$val}"; + } elseif (ctype_alpha($val) && strlen($val) <= 3) { + // Column range + $stackItemType = 'Column Reference'; + $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestDataRow($val) : 1048576; // Max 1,048,576 rows for Excel2007 + $val = "{$rangeWS2}{$val}{$endRowColRef}"; + } + $stackItemReference = $val; } - $stackItemReference = $val; } elseif ($opCharacter == self::FORMULA_STRING_QUOTE) { // UnEscape any quotes within the string $val = self::wrapResult(str_replace('""', self::FORMULA_STRING_QUOTE, self::unwrapResult($val))); @@ -4286,18 +4282,18 @@ private function internalParseFormula($formula, ?Cell $cell = null) } } - $details = $stack->getStackItem($stackItemType, $val, $stackItemReference, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $details = $stack->getStackItem($stackItemType, $val, $stackItemReference); if ($localeConstant) { $details['localeValue'] = $localeConstant; } $output[] = $details; } $index += $length; - } elseif ($opCharacter == '$') { // absolute row or column range + } elseif ($opCharacter == '$') { // absolute row or column range ++$index; - } elseif ($opCharacter == ')') { // miscellaneous error checking + } elseif ($opCharacter == ')') { // miscellaneous error checking if ($expectingOperand) { - $output[] = ['type' => 'Empty Argument', 'value' => self::$excelConstants['NULL'], 'reference' => null]; + $output[] = ['type' => 'Empty Argument', 'value' => self::$excelConstants['NULL'], 'reference' => 'NULL']; $expectingOperand = false; $expectingOperator = true; } else { @@ -4324,7 +4320,7 @@ private function internalParseFormula($formula, ?Cell $cell = null) } if ($formula[$index] == ' ') { - while ($formula[$index] == ' ') { + while ($formula[$index] === ' ') { ++$index; } @@ -4334,9 +4330,9 @@ private function internalParseFormula($formula, ?Cell $cell = null) ($expectingOperator) && ( (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) && - ($output[count($output) - 1]['type'] == 'Cell Reference') || + ($output[count($output) - 1]['type'] === 'Cell Reference') || (preg_match('/^' . self::CALCULATION_REGEXP_DEFINEDNAME . '.*/miu', substr($formula, $index), $match)) && - ($output[count($output) - 1]['type'] == 'Defined Name' || $output[count($output) - 1]['type'] == 'Value') + ($output[count($output) - 1]['type'] === 'Defined Name' || $output[count($output) - 1]['type'] === 'Value') ) ) { while ( @@ -4347,13 +4343,14 @@ private function internalParseFormula($formula, ?Cell $cell = null) ) { $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output } - $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack + $stack->push('Binary Operator', '∩'); // Put an Intersect Operator on the stack $expectingOperator = false; } } } - while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output + while (($op = $stack->pop()) !== null) { + // pop everything off the stack and push onto output if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced } @@ -4369,6 +4366,12 @@ private static function dataTestReference(&$operandData) if (($operandData['reference'] === null) && (is_array($operand))) { $rKeys = array_keys($operand); $rowKey = array_shift($rKeys); + if (is_array($operand[$rowKey]) === false) { + $operandData['value'] = $operand[$rowKey]; + + return $operand[$rowKey]; + } + $cKeys = array_keys(array_keys($operand[$rowKey])); $colKey = array_shift($cKeys); if (ctype_upper("$colKey")) { @@ -4389,7 +4392,7 @@ private static function dataTestReference(&$operandData) */ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) { - if ($tokens == false) { + if ($tokens === false) { return false; } @@ -4397,7 +4400,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) // so we store the parent cell collection so that we can re-attach it when necessary $pCellWorksheet = ($cell !== null) ? $cell->getWorksheet() : null; $pCellParent = ($cell !== null) ? $cell->getParent() : null; - $stack = new Stack(); + $stack = new Stack($this->branchPruner); // Stores branches that have been pruned $fakedForBranchPruning = []; @@ -4406,7 +4409,6 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) // Loop through each token in turn foreach ($tokens as $tokenData) { $token = $tokenData['value']; - // Branch pruning: skip useless resolutions $storeKey = $tokenData['storeKey'] ?? null; if ($this->branchPruningEnabled && isset($tokenData['onlyIf'])) { @@ -4416,16 +4418,12 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) true : (bool) Functions::flattenSingleValue($storeValue); if (is_array($storeValue)) { $wrappedItem = end($storeValue); - $storeValue = end($wrappedItem); + $storeValue = is_array($wrappedItem) ? end($wrappedItem) : $wrappedItem; } if ( - isset($storeValue) - && ( - !$storeValueAsBool - || Functions::isError($storeValue) - || ($storeValue === 'Pruned branch') - ) + (isset($storeValue) || $tokenData['reference'] === 'NULL') + && (!$storeValueAsBool || ErrorValue::isError($storeValue) || ($storeValue === 'Pruned branch')) ) { // If branching value is not true, we don't need to compute if (!isset($fakedForBranchPruning['onlyIf-' . $onlyIfStoreKey])) { @@ -4452,15 +4450,12 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) true : (bool) Functions::flattenSingleValue($storeValue); if (is_array($storeValue)) { $wrappedItem = end($storeValue); - $storeValue = end($wrappedItem); + $storeValue = is_array($wrappedItem) ? end($wrappedItem) : $wrappedItem; } + if ( - isset($storeValue) - && ( - $storeValueAsBool - || Functions::isError($storeValue) - || ($storeValue === 'Pruned branch') - ) + (isset($storeValue) || $tokenData['reference'] === 'NULL') + && ($storeValueAsBool || ErrorValue::isError($storeValue) || ($storeValue === 'Pruned branch')) ) { // If branching value is true, we don't need to compute if (!isset($fakedForBranchPruning['onlyIfNot-' . $onlyIfNotStoreKey])) { @@ -4495,28 +4490,36 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) // Log what we're doing if ($token == ':') { - $this->debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference'])); + $this->debugLog->writeDebugLog('Evaluating Range %s %s %s', $this->showValue($operand1Data['reference']), $token, $this->showValue($operand2Data['reference'])); } else { - $this->debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2)); + $this->debugLog->writeDebugLog('Evaluating %s %s %s', $this->showValue($operand1), $token, $this->showValue($operand2)); } // Process the operation in the appropriate manner switch ($token) { - // Comparison (Boolean) Operators - case '>': // Greater than - case '<': // Less than - case '>=': // Greater than or Equal to - case '<=': // Less than or Equal to - case '=': // Equality - case '<>': // Inequality - $result = $this->executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack); + // Comparison (Boolean) Operators + case '>': // Greater than + case '<': // Less than + case '>=': // Greater than or Equal to + case '<=': // Less than or Equal to + case '=': // Equality + case '<>': // Inequality + $result = $this->executeBinaryComparisonOperation($operand1, $operand2, (string) $token, $stack); if (isset($storeKey)) { $branchStore[$storeKey] = $result; } break; - // Binary Operators - case ':': // Range + // Binary Operators + case ':': // Range + if ($operand1Data['type'] === 'Defined Name') { + if (preg_match('/$' . self::CALCULATION_REGEXP_DEFINEDNAME . '^/mui', $operand1Data['reference']) !== false) { + $definedName = $this->spreadsheet->getNamedRange($operand1Data['reference']); + if ($definedName !== null) { + $operand1Data['reference'] = $operand1Data['value'] = str_replace('$', '', $definedName->getValue()); + } + } + } if (strpos($operand1Data['reference'], '!') !== false) { [$sheet1, $operand1Data['reference']] = Worksheet::extractSheetTitle($operand1Data['reference'], true); } else { @@ -4532,6 +4535,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) if ($operand1Data['reference'] === null) { if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) { $operand1Data['reference'] = $cell->getColumn() . $operand1Data['value']; + // @phpstan-ignore-next-line } elseif (trim($operand1Data['reference']) == '') { $operand1Data['reference'] = $cell->getCoordinate(); } else { @@ -4541,6 +4545,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) if ($operand2Data['reference'] === null) { if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) { $operand2Data['reference'] = $cell->getColumn() . $operand2Data['value']; + // @phpstan-ignore-next-line } elseif (trim($operand2Data['reference']) == '') { $operand2Data['reference'] = $cell->getCoordinate(); } else { @@ -4564,7 +4569,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) $stack->push('Cell Reference', $cellValue, $cellRef); } else { - $stack->push('Error', Functions::REF(), null); + $stack->push('Error', Information\ExcelError::REF(), null); } break; @@ -4624,13 +4629,13 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) $matrixResult = $matrix->concat($operand2); $result = $matrixResult->getArray(); } catch (\Exception $ex) { - $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $this->debugLog->writeDebugLog('JAMA Matrix Exception: %s', $ex->getMessage()); $result = '#VALUE!'; } } else { $result = self::FORMULA_STRING_QUOTE . str_replace('""', self::FORMULA_STRING_QUOTE, self::unwrapResult($operand1) . self::unwrapResult($operand2)) . self::FORMULA_STRING_QUOTE; } - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($result)); $stack->push('Value', $result); if (isset($storeKey)) { @@ -4638,7 +4643,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) } break; - case '|': // Intersect + case '∩': // Intersect $rowIntersect = array_intersect_key($operand1, $operand2); $cellIntersect = $oCol = $oRow = []; foreach (array_keys($rowIntersect) as $row) { @@ -4649,12 +4654,12 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) } } if (count(Functions::flattenArray($cellIntersect)) === 0) { - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($cellIntersect)); $stack->push('Error', Functions::null(), null); } else { $cellRef = Coordinate::stringFromColumnIndex(min($oCol) + 1) . min($oRow) . ':' . Coordinate::stringFromColumnIndex(max($oCol) + 1) . max($oRow); - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($cellIntersect)); $stack->push('Value', $cellIntersect, $cellRef); } @@ -4668,10 +4673,10 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) } $arg = $arg['value']; if ($token === '~') { - $this->debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg)); + $this->debugLog->writeDebugLog('Evaluating Negation of %s', $this->showValue($arg)); $multiplier = -1; } else { - $this->debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg)); + $this->debugLog->writeDebugLog('Evaluating Percentile of %s', $this->showValue($arg)); $multiplier = 0.01; } if (is_array($arg)) { @@ -4682,10 +4687,10 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) $matrixResult = $matrix1->arrayTimesEquals($multiplier); $result = $matrixResult->getArray(); } catch (\Exception $ex) { - $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $this->debugLog->writeDebugLog('JAMA Matrix Exception: %s', $ex->getMessage()); $result = '#VALUE!'; } - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($result)); $stack->push('Value', $result); if (isset($storeKey)) { $branchStore[$storeKey] = $result; @@ -4699,7 +4704,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) if (isset($matches[8])) { if ($cell === null) { // We can't access the range, so return a REF error - $cellValue = Functions::REF(); + $cellValue = Information\ExcelError::REF(); } else { $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; if ($matches[2] > '') { @@ -4709,27 +4714,27 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) return $this->raiseFormulaError('Unable to access External Workbook'); } $matches[2] = trim($matches[2], "\"'"); - $this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]); + $this->debugLog->writeDebugLog('Evaluating Cell Range %s in worksheet %s', $cellRef, $matches[2]); if ($pCellParent !== null) { $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false); } else { return $this->raiseFormulaError('Unable to access Cell Reference'); } - $this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue)); + $this->debugLog->writeDebugLog('Evaluation Result for cells %s in worksheet %s is %s', $cellRef, $matches[2], $this->showTypeDetails($cellValue)); } else { - $this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet'); + $this->debugLog->writeDebugLog('Evaluating Cell Range %s in current worksheet', $cellRef); if ($pCellParent !== null) { $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false); } else { return $this->raiseFormulaError('Unable to access Cell Reference'); } - $this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue)); + $this->debugLog->writeDebugLog('Evaluation Result for cells %s is %s', $cellRef, $this->showTypeDetails($cellValue)); } } } else { if ($cell === null) { // We can't access the cell, so return a REF error - $cellValue = Functions::REF(); + $cellValue = Information\ExcelError::REF(); } else { $cellRef = $matches[6] . $matches[7]; if ($matches[2] > '') { @@ -4738,7 +4743,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) // It's a Reference to an external spreadsheet (not currently supported) return $this->raiseFormulaError('Unable to access External Workbook'); } - $this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]); + $this->debugLog->writeDebugLog('Evaluating Cell %s in worksheet %s', $cellRef, $matches[2]); if ($pCellParent !== null) { $cellSheet = $this->spreadsheet->getSheetByName($matches[2]); if ($cellSheet && $cellSheet->cellExists($cellRef)) { @@ -4751,16 +4756,16 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) } else { return $this->raiseFormulaError('Unable to access Cell Reference'); } - $this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue)); + $this->debugLog->writeDebugLog('Evaluation Result for cell %s in worksheet %s is %s', $cellRef, $matches[2], $this->showTypeDetails($cellValue)); } else { - $this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet'); + $this->debugLog->writeDebugLog('Evaluating Cell %s in current worksheet', $cellRef); if ($pCellParent->has($cellRef)) { $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false); $cell->attach($pCellParent); } else { $cellValue = null; } - $this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue)); + $this->debugLog->writeDebugLog('Evaluation Result for cell %s is %s', $cellRef, $this->showTypeDetails($cellValue)); } } } @@ -4780,7 +4785,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) $argCount = $stack->pop(); $argCount = $argCount['value']; if ($functionName !== 'MKMATRIX') { - $this->debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's')); + $this->debugLog->writeDebugLog('Evaluating Function %s() with %s argument%s', self::localeFunc($functionName), (($argCount == 0) ? 'no' : $argCount), (($argCount == 1) ? '' : 's')); } if ((isset(self::$phpSpreadsheetFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function $passByReference = false; @@ -4843,7 +4848,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) if ($functionName !== 'MKMATRIX') { if ($this->debugLog->getWriteDebugLog()) { krsort($argArrayVals); - $this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Functions::flattenArray($argArrayVals)), ' )'); + $this->debugLog->writeDebugLog('Evaluating %s ( %s )', self::localeFunc($functionName), implode(self::$localeArgumentSeparator . ' ', Functions::flattenArray($argArrayVals))); } } @@ -4860,7 +4865,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) $result = call_user_func_array($functionCall, $args); if ($functionName !== 'MKMATRIX') { - $this->debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Evaluation Result for %s() function call is %s', self::localeFunc($functionName), $this->showTypeDetails($result)); } $stack->push('Value', self::wrapResult($result)); if (isset($storeKey)) { @@ -4875,7 +4880,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) if (isset($storeKey)) { $branchStore[$storeKey] = self::$excelConstants[$excelConstant]; } - $this->debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant])); + $this->debugLog->writeDebugLog('Evaluating Constant %s as %s', $excelConstant, $this->showTypeDetails(self::$excelConstants[$excelConstant])); } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == self::FORMULA_STRING_QUOTE) || ($token[0] == '#')) { $stack->push($tokenData['type'], $token, $tokenData['reference']); if (isset($storeKey)) { @@ -4888,7 +4893,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null) return $this->raiseFormulaError("undefined name '$token'"); } - $this->debugLog->writeDebugLog('Evaluating Defined Name ', $definedName); + $this->debugLog->writeDebugLog('Evaluating Defined Name %s', $definedName); $namedRange = DefinedName::resolveName($definedName, $pCellWorksheet); if ($namedRange === null) { return $this->raiseFormulaError("undefined name '$definedName'"); @@ -4934,13 +4939,13 @@ private function validateBinaryOperand(&$operand, &$stack) // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations if ($operand > '' && $operand[0] == '#') { $stack->push('Value', $operand); - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($operand)); return false; } elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) { // If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations $stack->push('Error', '#VALUE!'); - $this->debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!')); + $this->debugLog->writeDebugLog('Evaluation Result is a %s', $this->showTypeDetails('#VALUE!')); return false; } @@ -4952,29 +4957,28 @@ private function validateBinaryOperand(&$operand, &$stack) } /** - * @param null|string $cellID * @param mixed $operand1 * @param mixed $operand2 * @param string $operation * * @return array */ - private function executeArrayComparison($cellID, $operand1, $operand2, $operation, Stack &$stack, bool $recursingArrays) + private function executeArrayComparison($operand1, $operand2, $operation, Stack &$stack, bool $recursingArrays) { $result = []; if (!is_array($operand2)) { // Operand 1 is an array, Operand 2 is a scalar foreach ($operand1 as $x => $operandData) { - $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2)); - $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack); + $this->debugLog->writeDebugLog('Evaluating Comparison %s %s %s', $this->showValue($operandData), $operation, $this->showValue($operand2)); + $this->executeBinaryComparisonOperation($operandData, $operand2, $operation, $stack); $r = $stack->pop(); $result[$x] = $r['value']; } } elseif (!is_array($operand1)) { // Operand 1 is a scalar, Operand 2 is an array foreach ($operand2 as $x => $operandData) { - $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData)); - $this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack); + $this->debugLog->writeDebugLog('Evaluating Comparison %s %s %s', $this->showValue($operand1), $operation, $this->showValue($operandData)); + $this->executeBinaryComparisonOperation($operand1, $operandData, $operation, $stack); $r = $stack->pop(); $result[$x] = $r['value']; } @@ -4984,14 +4988,14 @@ private function executeArrayComparison($cellID, $operand1, $operand2, $operatio self::checkMatrixOperands($operand1, $operand2, 2); } foreach ($operand1 as $x => $operandData) { - $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x])); - $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true); + $this->debugLog->writeDebugLog('Evaluating Comparison %s %s %s', $this->showValue($operandData), $operation, $this->showValue($operand2[$x])); + $this->executeBinaryComparisonOperation($operandData, $operand2[$x], $operation, $stack, true); $r = $stack->pop(); $result[$x] = $r['value']; } } // Log the result details - $this->debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Comparison Evaluation Result is %s', $this->showTypeDetails($result)); // And push the result onto the stack $stack->push('Array', $result); @@ -4999,7 +5003,6 @@ private function executeArrayComparison($cellID, $operand1, $operand2, $operatio } /** - * @param null|string $cellID * @param mixed $operand1 * @param mixed $operand2 * @param string $operation @@ -5007,135 +5010,23 @@ private function executeArrayComparison($cellID, $operand1, $operand2, $operatio * * @return mixed */ - private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, Stack &$stack, $recursingArrays = false) + private function executeBinaryComparisonOperation($operand1, $operand2, $operation, Stack &$stack, $recursingArrays = false) { // If we're dealing with matrix operations, we want a matrix result if ((is_array($operand1)) || (is_array($operand2))) { - return $this->executeArrayComparison($cellID, $operand1, $operand2, $operation, $stack, $recursingArrays); - } - - // Simple validate the two operands if they are string values - if (is_string($operand1) && $operand1 > '' && $operand1[0] == self::FORMULA_STRING_QUOTE) { - $operand1 = self::unwrapResult($operand1); - } - if (is_string($operand2) && $operand2 > '' && $operand2[0] == self::FORMULA_STRING_QUOTE) { - $operand2 = self::unwrapResult($operand2); + return $this->executeArrayComparison($operand1, $operand2, $operation, $stack, $recursingArrays); } - // Use case insensitive comparaison if not OpenOffice mode - if (Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) { - if (is_string($operand1)) { - $operand1 = Shared\StringHelper::strToUpper($operand1); - } - if (is_string($operand2)) { - $operand2 = Shared\StringHelper::strToUpper($operand2); - } - } - - $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE; - - // execute the necessary operation - switch ($operation) { - // Greater than - case '>': - if ($useLowercaseFirstComparison) { - $result = $this->strcmpLowercaseFirst($operand1, $operand2) > 0; - } else { - $result = ($operand1 > $operand2); - } - - break; - // Less than - case '<': - if ($useLowercaseFirstComparison) { - $result = $this->strcmpLowercaseFirst($operand1, $operand2) < 0; - } else { - $result = ($operand1 < $operand2); - } - - break; - // Equality - case '=': - if (is_numeric($operand1) && is_numeric($operand2)) { - $result = (abs($operand1 - $operand2) < $this->delta); - } else { - $result = $this->strcmpAllowNull($operand1, $operand2) == 0; - } - - break; - // Greater than or equal - case '>=': - if (is_numeric($operand1) && is_numeric($operand2)) { - $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 > $operand2)); - } elseif ($useLowercaseFirstComparison) { - $result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0; - } else { - $result = $this->strcmpAllowNull($operand1, $operand2) >= 0; - } - - break; - // Less than or equal - case '<=': - if (is_numeric($operand1) && is_numeric($operand2)) { - $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 < $operand2)); - } elseif ($useLowercaseFirstComparison) { - $result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0; - } else { - $result = $this->strcmpAllowNull($operand1, $operand2) <= 0; - } - - break; - // Inequality - case '<>': - if (is_numeric($operand1) && is_numeric($operand2)) { - $result = (abs($operand1 - $operand2) > 1E-14); - } else { - $result = $this->strcmpAllowNull($operand1, $operand2) != 0; - } - - break; - - default: - throw new Exception('Unsupported binary comparison operation'); - } + $result = BinaryComparison::compare($operand1, $operand2, $operation); // Log the result details - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($result)); // And push the result onto the stack $stack->push('Value', $result); return $result; } - /** - * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters. - * - * @param null|string $str1 First string value for the comparison - * @param null|string $str2 Second string value for the comparison - * - * @return int - */ - private function strcmpLowercaseFirst($str1, $str2) - { - $inversedStr1 = Shared\StringHelper::strCaseReverse($str1); - $inversedStr2 = Shared\StringHelper::strCaseReverse($str2); - - return strcmp($inversedStr1 ?? '', $inversedStr2 ?? ''); - } - - /** - * PHP8.1 deprecates passing null to strcmp. - * - * @param null|string $str1 First string value for the comparison - * @param null|string $str2 Second string value for the comparison - * - * @return int - */ - private function strcmpAllowNull($str1, $str2) - { - return strcmp($str1 ?? '', $str2 ?? ''); - } - /** * @param mixed $operand1 * @param mixed $operand2 @@ -5169,7 +5060,7 @@ private function executeNumericBinaryOperation($operand1, $operand2, $operation, $matrixResult = $matrix->$matrixFunction($operand2); $result = $matrixResult->getArray(); } catch (\Exception $ex) { - $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $this->debugLog->writeDebugLog('JAMA Matrix Exception: %s', $ex->getMessage()); $result = '#VALUE!'; } } else { @@ -5178,7 +5069,7 @@ private function executeNumericBinaryOperation($operand1, $operand2, $operation, ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0)) ) { - $result = Functions::VALUE(); + $result = Information\ExcelError::VALUE(); } else { // If we're dealing with non-matrix operations, execute the necessary operation switch ($operation) { @@ -5201,8 +5092,8 @@ private function executeNumericBinaryOperation($operand1, $operand2, $operation, case '/': if ($operand2 == 0) { // Trap for Divide by Zero error - $stack->push('Error', '#DIV/0!'); - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!')); + $stack->push('Error', ExcelError::DIV0()); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails(ExcelError::DIV0())); return false; } @@ -5222,22 +5113,29 @@ private function executeNumericBinaryOperation($operand1, $operand2, $operation, } // Log the result details - $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($result)); // And push the result onto the stack $stack->push('Value', $result); return $result; } - // trigger an error, but nicely, if need be - protected function raiseFormulaError($errorMessage) + /** + * Trigger an error, but nicely, if need be. + * + * @return false + */ + protected function raiseFormulaError(string $errorMessage) { $this->formulaError = $errorMessage; $this->cyclicReferenceStack->clear(); if (!$this->suppressFormulaErrors) { throw new Exception($errorMessage); } - trigger_error($errorMessage, E_USER_ERROR); + + if (strlen($errorMessage) > 0) { + trigger_error($errorMessage, E_USER_ERROR); + } return false; } @@ -5319,7 +5217,7 @@ public function extractNamedRange(string &$range = 'A1', ?Worksheet $worksheet = // Named range? $namedRange = DefinedName::resolveName($range, $worksheet); if ($namedRange === null) { - return Functions::REF(); + return Information\ExcelError::REF(); } $worksheet = $namedRange->getWorksheet(); @@ -5478,14 +5376,6 @@ private function addCellReference(array $args, $passCellReference, $functionCall return $args; } - private function getUnusedBranchStoreKey() - { - $storeKeyValue = 'storeKey-' . $this->branchStoreKeyCounter; - ++$this->branchStoreKeyCounter; - - return $storeKeyValue; - } - private function getTokensAsString($tokens) { $tokensStr = array_map(function ($token) { @@ -5508,7 +5398,7 @@ private function evaluateDefinedName(Cell $cell, DefinedName $namedRange, Worksh $definedNameScope = $namedRange->getScope(); if ($definedNameScope !== null && $definedNameScope !== $cellWorksheet) { // The defined name isn't in our current scope, so #REF - $result = Functions::REF(); + $result = Information\ExcelError::REF(); $stack->push('Error', $result, $namedRange->getName()); return $result; @@ -5522,7 +5412,7 @@ private function evaluateDefinedName(Cell $cell, DefinedName $namedRange, Worksh $definedNameValue = '=' . $definedNameValue; } - $this->debugLog->writeDebugLog("Defined Name is a {$definedNameType} with a value of {$definedNameValue}"); + $this->debugLog->writeDebugLog('Defined Name is a %s with a value of %s', $definedNameType, $definedNameValue); $recursiveCalculationCell = ($definedNameWorksheet !== null && $definedNameWorksheet !== $cellWorksheet) ? $definedNameWorksheet->getCell('A1') @@ -5536,7 +5426,7 @@ private function evaluateDefinedName(Cell $cell, DefinedName $namedRange, Worksh $cell->getRow() - 1 ); - $this->debugLog->writeDebugLog("Value adjusted for relative references is {$definedNameValue}"); + $this->debugLog->writeDebugLog('Value adjusted for relative references is %s', $definedNameValue); $recursiveCalculator = new self($this->spreadsheet); $recursiveCalculator->getDebugLog()->setWriteDebugLog($this->getDebugLog()->getWriteDebugLog()); @@ -5545,7 +5435,7 @@ private function evaluateDefinedName(Cell $cell, DefinedName $namedRange, Worksh if ($this->getDebugLog()->getWriteDebugLog()) { $this->debugLog->mergeDebugLog(array_slice($recursiveCalculator->getDebugLog()->getLog(), 3)); - $this->debugLog->writeDebugLog("Evaluation Result for Named {$definedNameType} {$namedRange->getName()} is {$this->showTypeDetails($result)}"); + $this->debugLog->writeDebugLog('Evaluation Result for Named %s %s is %s', $definedNameType, $namedRange->getName(), $this->showTypeDetails($result)); } $stack->push('Defined Name', $result, $namedRange->getName()); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database/DGet.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database/DGet.php index c2ffe30..abe06e6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database/DGet.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database/DGet.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Database; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class DGet extends DatabaseAbstract { @@ -41,7 +41,7 @@ public static function evaluate($database, $field, $criteria) $columnData = self::getFilteredColumn($database, $field, $criteria); if (count($columnData) > 1) { - return Functions::NAN(); + return ExcelError::NAN(); } $row = array_pop($columnData); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php index 44a38c1..79fa8dc 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php @@ -278,9 +278,9 @@ public static function TIMEVALUE($timeValue) * or a standard date string * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string - * @param string $unit + * @param array|string $unit * - * @return int|string Interval between the dates + * @return array|int|string Interval between the dates */ public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') { @@ -300,12 +300,12 @@ public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') * @See DateTimeExcel\Days::between() * Use the between method in the DateTimeExcel\Days class instead * - * @param DateTimeInterface|float|int|string $endDate Excel date serial value (float), + * @param array|DateTimeInterface|float|int|string $endDate Excel date serial value (float), * PHP date timestamp (integer), PHP DateTime object, or a standard date string - * @param DateTimeInterface|float|int|string $startDate Excel date serial value (float), + * @param array|DateTimeInterface|float|int|string $startDate Excel date serial value (float), * PHP date timestamp (integer), PHP DateTime object, or a standard date string * - * @return int|string Number of days between start date and end date or an error + * @return array|int|string Number of days between start date and end date or an error */ public static function DAYS($endDate = 0, $startDate = 0) { @@ -331,7 +331,7 @@ public static function DAYS($endDate = 0, $startDate = 0) * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param bool $method US or European Method + * @param array|bool $method US or European Method * FALSE or omitted: U.S. (NASD) method. If the starting date is * the last day of a month, it becomes equal to the 30th of the * same month. If the ending date is the last day of a month and @@ -343,7 +343,7 @@ public static function DAYS($endDate = 0, $startDate = 0) * occur on the 31st of a month become equal to the 30th of the * same month. * - * @return int|string Number of days between start date and end date + * @return array|int|string Number of days between start date and end date */ public static function DAYS360($startDate = 0, $endDate = 0, $method = false) { @@ -373,14 +373,14 @@ public static function DAYS360($startDate = 0, $endDate = 0, $method = false) * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $method Method used for the calculation + * @param array|int $method Method used for the calculation * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 * - * @return float|string fraction of the year, or a string containing an error + * @return array|float|string fraction of the year, or a string containing an error */ public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) { @@ -409,7 +409,7 @@ public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) * PHP DateTime object, or a standard date string * @param mixed $dateArgs * - * @return int|string Interval between the dates + * @return array|int|string Interval between the dates */ public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs) { @@ -464,7 +464,7 @@ public static function WORKDAY($startDate, $endDays, ...$dateArgs) * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * - * @return int|string Day of the month + * @return array|int|string Day of the month */ public static function DAYOFMONTH($dateValue = 1) { @@ -492,7 +492,7 @@ public static function DAYOFMONTH($dateValue = 1) * 2 Numbers 1 (Monday) through 7 (Sunday). * 3 Numbers 0 (Monday) through 6 (Sunday). * - * @return int|string Day of the week value + * @return array|int|string Day of the week value */ public static function WEEKDAY($dateValue = 1, $style = 1) { @@ -704,7 +704,7 @@ public static function WEEKDAY($dateValue = 1, $style = 1) * 17 Week begins on Sunday. * 21 ISO (Jan. 4 is week 1, begins on Monday). * - * @return int|string Week Number + * @return array|int|string Week Number */ public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY) { @@ -727,7 +727,7 @@ public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY) * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * - * @return int|string Week Number + * @return array|int|string Week Number */ public static function ISOWEEKNUM($dateValue = 1) { @@ -751,7 +751,7 @@ public static function ISOWEEKNUM($dateValue = 1) * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * - * @return int|string Month of the year + * @return array|int|string Month of the year */ public static function MONTHOFYEAR($dateValue = 1) { @@ -775,7 +775,7 @@ public static function MONTHOFYEAR($dateValue = 1) * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * - * @return int|string Year + * @return array|int|string Year */ public static function YEAR($dateValue = 1) { @@ -799,7 +799,7 @@ public static function YEAR($dateValue = 1) * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string * - * @return int|string Hour + * @return array|int|string Hour */ public static function HOUROFDAY($timeValue = 0) { @@ -823,7 +823,7 @@ public static function HOUROFDAY($timeValue = 0) * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string * - * @return int|string Minute + * @return array|int|string Minute */ public static function MINUTE($timeValue = 0) { @@ -847,7 +847,7 @@ public static function MINUTE($timeValue = 0) * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string * - * @return int|string Second + * @return array|int|string Second */ public static function SECOND($timeValue = 0) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Current.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Current.php index 7a70978..5de671d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Current.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Current.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use DateTimeImmutable; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Current { @@ -27,9 +27,9 @@ class Current public static function today() { $dti = new DateTimeImmutable(); - $dateArray = date_parse($dti->format('c')); + $dateArray = Helpers::dateParse($dti->format('c')); - return is_array($dateArray) ? Helpers::returnIn3FormatsArray($dateArray, true) : Functions::VALUE(); + return Helpers::dateParseSucceeded($dateArray) ? Helpers::returnIn3FormatsArray($dateArray, true) : ExcelError::VALUE(); } /** @@ -52,8 +52,8 @@ public static function today() public static function now() { $dti = new DateTimeImmutable(); - $dateArray = date_parse($dti->format('c')); + $dateArray = Helpers::dateParse($dti->format('c')); - return is_array($dateArray) ? Helpers::returnIn3FormatsArray($dateArray) : Functions::VALUE(); + return Helpers::dateParseSucceeded($dateArray) ? Helpers::returnIn3FormatsArray($dateArray) : ExcelError::VALUE(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php index d18e237..56982c5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php @@ -2,13 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class Date { + use ArrayEnabled; + /** * DATE. * @@ -24,7 +27,7 @@ class Date * A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted, * as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language. * - * @param int $year The value of the year argument can include one to four digits. + * @param array|int $year The value of the year argument can include one to four digits. * Excel interprets the year argument according to the configured * date system: 1900 or 1904. * If year is between 0 (zero) and 1899 (inclusive), Excel adds that @@ -35,7 +38,7 @@ class Date * 2008. * If year is less than 0 or is 10000 or greater, Excel returns the * #NUM! error value. - * @param int $month A positive or negative integer representing the month of the year + * @param array|int $month A positive or negative integer representing the month of the year * from 1 to 12 (January to December). * If month is greater than 12, month adds that number of months to * the first month in the year specified. For example, DATE(2008,14,2) @@ -44,7 +47,7 @@ class Date * number of months, plus 1, from the first month in the year * specified. For example, DATE(2008,-3,2) returns the serial number * representing September 2, 2007. - * @param int $day A positive or negative integer representing the day of the month + * @param array|int $day A positive or negative integer representing the day of the month * from 1 to 31. * If day is greater than the number of days in the month specified, * day adds that number of days to the first day in the month. For @@ -57,9 +60,15 @@ class Date * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function fromYMD($year, $month, $day) { + if (is_array($year) || is_array($month) || is_array($day)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $year, $month, $day); + } + $baseYear = SharedDateHelper::getExcelCalendar(); try { @@ -84,18 +93,17 @@ public static function fromYMD($year, $month, $day) */ private static function getYear($year, int $baseYear): int { - $year = Functions::flattenSingleValue($year); $year = ($year !== null) ? StringHelper::testStringAsNumeric((string) $year) : 0; if (!is_numeric($year)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $year = (int) $year; if ($year < ($baseYear - 1900)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } if ((($baseYear - 1900) !== 0) && ($year < $baseYear) && ($year >= 1900)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } if (($year < $baseYear) && ($year >= ($baseYear - 1900))) { @@ -112,15 +120,13 @@ private static function getYear($year, int $baseYear): int */ private static function getMonth($month): int { - $month = Functions::flattenSingleValue($month); - if (($month !== null) && (!is_numeric($month))) { $month = SharedDateHelper::monthStringToNumber($month); } $month = ($month !== null) ? StringHelper::testStringAsNumeric((string) $month) : 0; if (!is_numeric($month)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) $month; @@ -133,15 +139,13 @@ private static function getMonth($month): int */ private static function getDay($day): int { - $day = Functions::flattenSingleValue($day); - if (($day !== null) && (!is_numeric($day))) { $day = SharedDateHelper::dayStringToNumber($day); } $day = ($day !== null) ? StringHelper::testStringAsNumeric((string) $day) : 0; if (!is_numeric($day)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) $day; @@ -162,7 +166,7 @@ private static function adjustYearMonth(int &$year, int &$month, int $baseYear): // Re-validate the year parameter after adjustments if (($year < $baseYear) || ($year >= 10000)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateParts.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateParts.php index 37ea031..b669eb0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateParts.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateParts.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class DateParts { + use ArrayEnabled; + /** * DAYOFMONTH. * @@ -19,11 +22,18 @@ class DateParts * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * - * @return int|string Day of the month + * @return array|int|string Day of the month + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function day($dateValue) { + if (is_array($dateValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $dateValue); + } + $weirdResult = self::weirdCondition($dateValue); if ($weirdResult >= 0) { return $weirdResult; @@ -52,11 +62,18 @@ public static function day($dateValue) * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * - * @return int|string Month of the year + * @return array|int|string Month of the year + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function month($dateValue) { + if (is_array($dateValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $dateValue); + } + try { $dateValue = Helpers::getDateValue($dateValue); } catch (Exception $e) { @@ -83,11 +100,18 @@ public static function month($dateValue) * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * - * @return int|string Year + * @return array|int|string Year + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function year($dateValue) { + if (is_array($dateValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $dateValue); + } + try { $dateValue = Helpers::getDateValue($dateValue); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php index d8e88a2..466fe4a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php @@ -3,11 +3,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use DateTimeImmutable; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class DateValue { + use ArrayEnabled; + /** * DATEVALUE. * @@ -21,7 +24,7 @@ class DateValue * Excel Function: * DATEVALUE(dateValue) * - * @param string $dateValue Text that represents a date in a Microsoft Excel date format. + * @param array|string $dateValue Text that represents a date in a Microsoft Excel date format. * For example, "1/30/2008" or "30-Jan-2008" are text strings within * quotation marks that represent dates. Using the default date * system in Excel for Windows, date_text must represent a date from @@ -29,15 +32,22 @@ class DateValue * system in Excel for the Macintosh, date_text must represent a date * from January 1, 1904, to December 31, 9999. DATEVALUE returns the * #VALUE! error value if date_text is out of this range. + * Or can be an array of date values * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function fromString($dateValue) { + if (is_array($dateValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $dateValue); + } + $dti = new DateTimeImmutable(); $baseYear = SharedDateHelper::getExcelCalendar(); - $dateValue = trim(Functions::flattenSingleValue($dateValue ?? ''), '"'); + $dateValue = trim($dateValue ?? '', '"'); // Strip any ordinals because they're allowed in Excel (English only) $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue) ?? ''; // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) @@ -49,7 +59,7 @@ public static function fromString($dateValue) foreach ($t1 as &$t) { if ((is_numeric($t)) && ($t > 31)) { if ($yearFound) { - return Functions::VALUE(); + return ExcelError::VALUE(); } if ($t < 100) { $t += 1900; @@ -59,7 +69,7 @@ public static function fromString($dateValue) } if (count($t1) === 1) { // We've been fed a time value without any date - return ((strpos((string) $t, ':') === false)) ? Functions::Value() : 0.0; + return ((strpos((string) $t, ':') === false)) ? ExcelError::Value() : 0.0; } unset($t); @@ -92,13 +102,11 @@ private static function t1ToString(array $t1, DateTimeImmutable $dti, bool $year /** * Parse date. - * - * @return array|bool */ - private static function setUpArray(string $dateValue, DateTimeImmutable $dti) + private static function setUpArray(string $dateValue, DateTimeImmutable $dti): array { - $PHPDateArray = date_parse($dateValue); - if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { + $PHPDateArray = Helpers::dateParse($dateValue); + if (!Helpers::dateParseSucceeded($PHPDateArray)) { // If original count was 1, we've already returned. // If it was 2, we added another. // Therefore, neither of the first 2 stroks below can fail. @@ -106,9 +114,9 @@ private static function setUpArray(string $dateValue, DateTimeImmutable $dti) $testVal2 = strtok('- '); $testVal3 = strtok('- ') ?: $dti->format('Y'); Helpers::adjustYear((string) $testVal1, (string) $testVal2, $testVal3); - $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); - if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { - $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); + $PHPDateArray = Helpers::dateParse($testVal1 . '-' . $testVal2 . '-' . $testVal3); + if (!Helpers::dateParseSucceeded($PHPDateArray)) { + $PHPDateArray = Helpers::dateParse($testVal2 . '-' . $testVal1 . '-' . $testVal3); } } @@ -118,19 +126,17 @@ private static function setUpArray(string $dateValue, DateTimeImmutable $dti) /** * Final results. * - * @param array|bool $PHPDateArray - * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag */ - private static function finalResults($PHPDateArray, DateTimeImmutable $dti, int $baseYear) + private static function finalResults(array $PHPDateArray, DateTimeImmutable $dti, int $baseYear) { - $retValue = Functions::Value(); - if (is_array($PHPDateArray) && $PHPDateArray['error_count'] == 0) { + $retValue = ExcelError::Value(); + if (Helpers::dateParseSucceeded($PHPDateArray)) { // Execute function Helpers::replaceIfEmpty($PHPDateArray['year'], $dti->format('Y')); if ($PHPDateArray['year'] < $baseYear) { - return Functions::VALUE(); + return ExcelError::VALUE(); } Helpers::replaceIfEmpty($PHPDateArray['month'], $dti->format('m')); Helpers::replaceIfEmpty($PHPDateArray['day'], $dti->format('d')); @@ -141,7 +147,7 @@ private static function finalResults($PHPDateArray, DateTimeImmutable $dti, int $day = (int) $PHPDateArray['day']; $year = (int) $PHPDateArray['year']; if (!checkdate($month, $day, $year)) { - return ($year === 1900 && $month === 2 && $day === 29) ? Helpers::returnIn3FormatsFloat(60.0) : Functions::VALUE(); + return ($year === 1900 && $month === 2 && $day === 29) ? Helpers::returnIn3FormatsFloat(60.0) : ExcelError::VALUE(); } $retValue = Helpers::returnIn3FormatsArray($PHPDateArray, true); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days.php index 5a97d8d..a3b9745 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days.php @@ -3,12 +3,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use DateTimeInterface; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Days { + use ArrayEnabled; + /** * DAYS. * @@ -17,15 +20,23 @@ class Days * Excel Function: * DAYS(endDate, startDate) * - * @param DateTimeInterface|float|int|string $endDate Excel date serial value (float), - * PHP date timestamp (integer), PHP DateTime object, or a standard date string - * @param DateTimeInterface|float|int|string $startDate Excel date serial value (float), - * PHP date timestamp (integer), PHP DateTime object, or a standard date string + * @param array|DateTimeInterface|float|int|string $endDate Excel date serial value (float), + * PHP date timestamp (integer), PHP DateTime object, or a standard date string + * Or can be an array of date values + * @param array|DateTimeInterface|float|int|string $startDate Excel date serial value (float), + * PHP date timestamp (integer), PHP DateTime object, or a standard date string + * Or can be an array of date values * - * @return int|string Number of days between start date and end date or an error + * @return array|int|string Number of days between start date and end date or an error + * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result + * will also be an array with matching dimensions */ public static function between($endDate, $startDate) { + if (is_array($endDate) || is_array($startDate)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $endDate, $startDate); + } + try { $startDate = Helpers::getDateValue($startDate); $endDate = Helpers::getDateValue($endDate); @@ -37,7 +48,7 @@ public static function between($endDate, $startDate) $PHPStartDateObject = SharedDateHelper::excelToDateTimeObject($startDate); $PHPEndDateObject = SharedDateHelper::excelToDateTimeObject($endDate); - $days = Functions::VALUE(); + $days = ExcelError::VALUE(); $diff = $PHPStartDateObject->diff($PHPEndDateObject); if ($diff !== false && !is_bool($diff->days)) { $days = $diff->days; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days360.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days360.php index bbc5d16..6f71621 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days360.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Days360.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Days360 { + use ArrayEnabled; + /** * DAYS360. * @@ -18,11 +21,13 @@ class Days360 * Excel Function: * DAYS360(startDate,endDate[,method]) * - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * @param array|mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), + * Or can be an array of date values + * @param array|mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param mixed $method US or European Method as a bool + * Or can be an array of date values + * @param array|mixed $method US or European Method as a bool * FALSE or omitted: U.S. (NASD) method. If the starting date is * the last day of a month, it becomes equal to the 30th of the * same month. If the ending date is the last day of a month and @@ -33,11 +38,18 @@ class Days360 * TRUE: European method. Starting dates and ending dates that * occur on the 31st of a month become equal to the 30th of the * same month. + * Or can be an array of methods * - * @return int|string Number of days between start date and end date + * @return array|int|string Number of days between start date and end date + * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result + * will also be an array with matching dimensions */ public static function between($startDate = 0, $endDate = 0, $method = false) { + if (is_array($startDate) || is_array($endDate) || is_array($method)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $startDate, $endDate, $method); + } + try { $startDate = Helpers::getDateValue($startDate); $endDate = Helpers::getDateValue($endDate); @@ -46,7 +58,7 @@ public static function between($startDate = 0, $endDate = 0, $method = false) } if (!is_bool($method)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } // Execute function diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php index 6adeca1..ecb1cf0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php @@ -4,30 +4,42 @@ use DateInterval; use DateTime; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Difference { + use ArrayEnabled; + /** * DATEDIF. * * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string + * Or can be an array of date values * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string - * @param string $unit + * Or can be an array of date values + * @param array|string $unit + * Or can be an array of unit values * - * @return int|string Interval between the dates + * @return array|int|string Interval between the dates + * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result + * will also be an array with matching dimensions */ public static function interval($startDate, $endDate, $unit = 'D') { + if (is_array($startDate) || is_array($endDate) || is_array($unit)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $startDate, $endDate, $unit); + } + try { $startDate = Helpers::getDateValue($startDate); $endDate = Helpers::getDateValue($endDate); $difference = self::initialDiff($startDate, $endDate); - $unit = strtoupper(Functions::flattenSingleValue($unit)); + $unit = strtoupper($unit); } catch (Exception $e) { return $e->getMessage(); } @@ -53,14 +65,14 @@ public static function interval($startDate, $endDate, $unit = 'D') $retVal = self::replaceRetValue($retVal, $unit, 'YD') ?? self::datedifYD($difference, $startYears, $endYears, $PHPStartDateObject, $PHPEndDateObject); $retVal = self::replaceRetValue($retVal, $unit, 'YM') ?? self::datedifYM($PHPDiffDateObject); - return is_bool($retVal) ? Functions::VALUE() : $retVal; + return is_bool($retVal) ? ExcelError::VALUE() : $retVal; } private static function initialDiff(float $startDate, float $endDate): float { // Validate parameters if ($startDate > $endDate) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $endDate - $startDate; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php index 9503401..2384515 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php @@ -5,6 +5,7 @@ use DateTime; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Helpers @@ -33,7 +34,7 @@ public static function getDateValue($dateValue, bool $allowBool = true): float if (is_object($dateValue)) { $retval = SharedDateHelper::PHPToExcel($dateValue); if (is_bool($retval)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return $retval; @@ -46,11 +47,11 @@ public static function getDateValue($dateValue, bool $allowBool = true): float $dateValue = DateValue::fromString($dateValue); Functions::setReturnDateType($saveReturnDateType); if (!is_numeric($dateValue)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } } if ($dateValue < 0 && Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return (float) $dateValue; @@ -253,7 +254,7 @@ public static function validateNumericNull($number) return (float) $number; } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** @@ -266,13 +267,13 @@ public static function validateNumericNull($number) public static function validateNotNegative($number) { if (!is_numeric($number)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } if ($number >= 0) { return (float) $number; } - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } public static function silly1900(DateTime $PHPDateObject, string $mod = '-1 day'): void @@ -282,4 +283,25 @@ public static function silly1900(DateTime $PHPDateObject, string $mod = '-1 day' $PHPDateObject->modify($mod); } } + + public static function dateParse(string $string): array + { + return self::forceArray(date_parse($string)); + } + + public static function dateParseSucceeded(array $dateArray): bool + { + return $dateArray['error_count'] === 0; + } + + /** + * Despite documentation, date_parse probably never returns false. + * Just in case, this routine helps guarantee it. + * + * @param array|false $dateArray + */ + private static function forceArray($dateArray): array + { + return is_array($dateArray) ? $dateArray : ['error_count' => 1]; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Month.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Month.php index 560b7a8..c72d006 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Month.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Month.php @@ -2,10 +2,13 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Month { + use ArrayEnabled; + /** * EDATE. * @@ -19,15 +22,23 @@ class Month * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $adjustmentMonths The number of months before or after start_date. + * Or can be an array of date values + * @param array|int $adjustmentMonths The number of months before or after start_date. * A positive value for months yields a future date; * a negative value yields a past date. + * Or can be an array of adjustment values * - * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * @return array|mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function adjust($dateValue, $adjustmentMonths) { + if (is_array($dateValue) || is_array($adjustmentMonths)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $dateValue, $adjustmentMonths); + } + try { $dateValue = Helpers::getDateValue($dateValue, false); $adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths); @@ -54,15 +65,23 @@ public static function adjust($dateValue, $adjustmentMonths) * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $adjustmentMonths The number of months before or after start_date. + * Or can be an array of date values + * @param array|int $adjustmentMonths The number of months before or after start_date. * A positive value for months yields a future date; * a negative value yields a past date. + * Or can be an array of adjustment values * - * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * @return array|mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function lastDay($dateValue, $adjustmentMonths) { + if (is_array($dateValue) || is_array($adjustmentMonths)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $dateValue, $adjustmentMonths); + } + try { $dateValue = Helpers::getDateValue($dateValue, false); $adjustmentMonths = Helpers::validateNumericNull($adjustmentMonths); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php index d0f53cf..3b8942b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; class NetworkDays { + use ArrayEnabled; + /** * NETWORKDAYS. * @@ -20,14 +23,28 @@ class NetworkDays * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param mixed $dateArgs + * Or can be an array of date values + * @param mixed $dateArgs An array of dates (such as holidays) to exclude from the calculation * - * @return int|string Interval between the dates + * @return array|int|string Interval between the dates + * If an array of values is passed for the $startDate or $endDate arguments, then the returned result + * will also be an array with matching dimensions */ public static function count($startDate, $endDate, ...$dateArgs) { + if (is_array($startDate) || is_array($endDate)) { + return self::evaluateArrayArgumentsSubset( + [self::class, __FUNCTION__], + 2, + $startDate, + $endDate, + ...$dateArgs + ); + } + try { // Retrieve the mandatory start and end date that are referenced in the function definition $sDate = Helpers::getDateValue($startDate); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php index fb5e496..4ff7198 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php @@ -3,12 +3,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use DateTime; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Time { + use ArrayEnabled; + /** * TIME. * @@ -20,23 +24,31 @@ class Time * Excel Function: * TIME(hour,minute,second) * - * @param mixed $hour A number from 0 (zero) to 32767 representing the hour. + * @param array|int $hour A number from 0 (zero) to 32767 representing the hour. * Any value greater than 23 will be divided by 24 and the remainder * will be treated as the hour value. For example, TIME(27,0,0) = * TIME(3,0,0) = .125 or 3:00 AM. - * @param mixed $minute A number from 0 to 32767 representing the minute. + * @param array|int $minute A number from 0 to 32767 representing the minute. * Any value greater than 59 will be converted to hours and minutes. * For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM. - * @param mixed $second A number from 0 to 32767 representing the second. + * @param array|int $second A number from 0 to 32767 representing the second. * Any value greater than 59 will be converted to hours, minutes, * and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 * or 12:33:20 AM + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions * - * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * @return array|mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function fromHMS($hour, $minute, $second) { + if (is_array($hour) || is_array($minute) || is_array($second)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $hour, $minute, $second); + } + try { $hour = self::toIntWithNullBool($hour); $minute = self::toIntWithNullBool($minute); @@ -51,7 +63,7 @@ public static function fromHMS($hour, $minute, $second) if ($hour > 23) { $hour = $hour % 24; } elseif ($hour < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } // Execute function @@ -105,13 +117,12 @@ private static function adjustMinute(int &$minute, int &$hour): void */ private static function toIntWithNullBool($value): int { - $value = Functions::flattenSingleValue($value); $value = $value ?? 0; if (is_bool($value)) { $value = (int) $value; } if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php index 49cd983..d9b99f3 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php @@ -2,12 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class TimeParts { + use ArrayEnabled; + /** * HOUROFDAY. * @@ -19,13 +21,19 @@ class TimeParts * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * Or can be an array of date/time values * - * @return int|string Hour + * @return array|int|string Hour + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function hour($timeValue) { + if (is_array($timeValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $timeValue); + } + try { - $timeValue = Functions::flattenSingleValue($timeValue); Helpers::nullFalseTrueToNumber($timeValue); if (!is_numeric($timeValue)) { $timeValue = Helpers::getTimeValue($timeValue); @@ -53,13 +61,19 @@ public static function hour($timeValue) * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * Or can be an array of date/time values * - * @return int|string Minute + * @return array|int|string Minute + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function minute($timeValue) { + if (is_array($timeValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $timeValue); + } + try { - $timeValue = Functions::flattenSingleValue($timeValue); Helpers::nullFalseTrueToNumber($timeValue); if (!is_numeric($timeValue)) { $timeValue = Helpers::getTimeValue($timeValue); @@ -87,13 +101,19 @@ public static function minute($timeValue) * * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard time string + * Or can be an array of date/time values * - * @return int|string Second + * @return array|int|string Second + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function second($timeValue) { + if (is_array($timeValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $timeValue); + } + try { - $timeValue = Functions::flattenSingleValue($timeValue); Helpers::nullFalseTrueToNumber($timeValue); if (!is_numeric($timeValue)) { $timeValue = Helpers::getTimeValue($timeValue); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php index 2a29434..aa27206 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php @@ -3,11 +3,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use Datetime; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class TimeValue { + use ArrayEnabled; + /** * TIMEVALUE. * @@ -21,17 +25,24 @@ class TimeValue * Excel Function: * TIMEVALUE(timeValue) * - * @param string $timeValue A text string that represents a time in any one of the Microsoft + * @param array|string $timeValue A text string that represents a time in any one of the Microsoft * Excel time formats; for example, "6:45 PM" and "18:45" text strings * within quotation marks that represent time. * Date information in time_text is ignored. + * Or can be an array of date/time values * * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function fromString($timeValue) { - $timeValue = trim(Functions::flattenSingleValue($timeValue ?? ''), '"'); + if (is_array($timeValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $timeValue); + } + + $timeValue = trim($timeValue ?? '', '"'); $timeValue = str_replace(['/', '.'], '-', $timeValue); $arraySplit = preg_split('/[\/:\-\s]/', $timeValue) ?: []; @@ -40,11 +51,17 @@ public static function fromString($timeValue) $timeValue = implode(':', $arraySplit); } - $PHPDateArray = date_parse($timeValue); - $retValue = Functions::VALUE(); - if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) { + $PHPDateArray = Helpers::dateParse($timeValue); + $retValue = ExcelError::VALUE(); + if (Helpers::dateParseSucceeded($PHPDateArray)) { + /** @var int */ + $hour = $PHPDateArray['hour']; + /** @var int */ + $minute = $PHPDateArray['minute']; + /** @var int */ + $second = $PHPDateArray['second']; // OpenOffice-specific code removed - it works just like Excel - $excelDateValue = SharedDateHelper::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1; + $excelDateValue = SharedDateHelper::formattedPHPToExcel(1900, 1, 1, $hour, $minute, $second) - 1; $retType = Functions::getReturnDateType(); if ($retType === Functions::RETURNDATE_EXCEL) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Week.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Week.php index 6636222..2f69007 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Week.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/Week.php @@ -3,12 +3,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use DateTime; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class Week { + use ArrayEnabled; + /** * WEEKNUM. * @@ -24,7 +27,8 @@ class Week * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $method Week begins on Sunday or Monday + * Or can be an array of date values + * @param array|int $method Week begins on Sunday or Monday * 1 or omitted Week begins on Sunday. * 2 Week begins on Monday. * 11 Week begins on Monday. @@ -35,11 +39,18 @@ class Week * 16 Week begins on Saturday. * 17 Week begins on Sunday. * 21 ISO (Jan. 4 is week 1, begins on Monday). + * Or can be an array of methods * - * @return int|string Week Number + * @return array|int|string Week Number + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function number($dateValue, $method = Constants::STARTWEEK_SUNDAY) { + if (is_array($dateValue) || is_array($method)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $dateValue, $method); + } + $origDateValueNull = empty($dateValue); try { @@ -88,11 +99,18 @@ public static function number($dateValue, $method = Constants::STARTWEEK_SUNDAY) * * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * - * @return int|string Week Number + * @return array|int|string Week Number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function isoWeekNumber($dateValue) { + if (is_array($dateValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $dateValue); + } + if (self::apparentBug($dateValue)) { return 52; } @@ -119,17 +137,25 @@ public static function isoWeekNumber($dateValue) * Excel Function: * WEEKDAY(dateValue[,style]) * - * @param null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer), + * @param null|array|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of date values * @param mixed $style A number that determines the type of return value * 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). * 2 Numbers 1 (Monday) through 7 (Sunday). * 3 Numbers 0 (Monday) through 6 (Sunday). + * Or can be an array of styles * - * @return int|string Day of the week value + * @return array|int|string Day of the week value + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function day($dateValue, $style = 1) { + if (is_array($dateValue) || is_array($style)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $dateValue, $style); + } + try { $dateValue = Helpers::getDateValue($dateValue); $style = self::validateStyle($style); @@ -165,14 +191,12 @@ public static function day($dateValue, $style = 1) */ private static function validateStyle($style): int { - $style = Functions::flattenSingleValue($style); - if (!is_numeric($style)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $style = (int) $style; if (($style < 1) || ($style > 3)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $style; @@ -209,7 +233,7 @@ private static function apparentBug($dateValue): bool private static function validateDateValue($dateValue): float { if (is_bool($dateValue)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return Helpers::getDateValue($dateValue); @@ -225,14 +249,14 @@ private static function validateMethod($method): int if ($method === null) { $method = Constants::STARTWEEK_SUNDAY; } - $method = Functions::flattenSingleValue($method); + if (!is_numeric($method)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $method = (int) $method; if (!array_key_exists($method, Constants::METHODARR)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } $method = Constants::METHODARR[$method]; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php index 89e47b9..1f5735e 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; class WorkDay { + use ArrayEnabled; + /** * WORKDAY. * @@ -18,27 +21,37 @@ class WorkDay * Excel Function: * WORKDAY(startDate,endDays[,holidays[,holiday[,...]]]) * - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * @param array|mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $endDays The number of nonweekend and nonholiday days before or after + * Or can be an array of date values + * @param array|int $endDays The number of nonweekend and nonholiday days before or after * startDate. A positive value for days yields a future date; a * negative value yields a past date. - * @param mixed $dateArgs + * Or can be an array of int values + * @param null|mixed $dateArgs An array of dates (such as holidays) to exclude from the calculation * - * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * @return array|mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag + * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result + * will also be an array with matching dimensions */ public static function date($startDate, $endDays, ...$dateArgs) { + if (is_array($startDate) || is_array($endDays)) { + return self::evaluateArrayArgumentsSubset( + [self::class, __FUNCTION__], + 2, + $startDate, + $endDays, + ...$dateArgs + ); + } + // Retrieve the mandatory start date and days that are referenced in the function definition try { $startDate = Helpers::getDateValue($startDate); $endDays = Helpers::validateNumericNull($endDays); - $dateArgs = Functions::flattenArray($dateArgs); - $holidayArray = []; - foreach ($dateArgs as $holidayDate) { - $holidayArray[] = Helpers::getDateValue($holidayDate); - } + $holidayArray = array_map([Helpers::class, 'getDateValue'], Functions::flattenArray($dateArgs)); } catch (Exception $e) { return $e->getMessage(); } @@ -64,9 +77,8 @@ public static function date($startDate, $endDays, ...$dateArgs) private static function incrementing(float $startDate, int $endDays, array $holidayArray) { // Adjust the start date if it falls over a weekend - $startDoW = self::getWeekDay($startDate, 3); - if (self::getWeekDay($startDate, 3) >= 5) { + if ($startDoW >= 5) { $startDate += 7 - $startDoW; --$endDays; } @@ -126,9 +138,8 @@ private static function incrementingArray(float $startDate, float $endDate, arra private static function decrementing(float $startDate, int $endDays, array $holidayArray) { // Adjust the start date if it falls over a weekend - $startDoW = self::getWeekDay($startDate, 3); - if (self::getWeekDay($startDate, 3) >= 5) { + if ($startDoW >= 5) { $startDate += -$startDoW + 4; ++$endDays; } @@ -172,6 +183,7 @@ private static function decrementingArray(float $startDate, float $endDate, arra } // Adjust the calculated end date if it falls over a weekend $endDoW = self::getWeekDay($endDate, 3); + /** int $endDoW */ if ($endDoW >= 5) { $endDate += -$endDoW + 4; } @@ -182,8 +194,8 @@ private static function decrementingArray(float $startDate, float $endDate, arra private static function getWeekDay(float $date, int $wd): int { - $result = Week::day($date, $wd); + $result = Functions::scalar(Week::day($date, $wd)); - return is_string($result) ? -1 : $result; + return is_int($result) ? $result : -1; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php index da2ac12..394c6b7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php @@ -2,12 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDateHelper; class YearFrac { + use ArrayEnabled; + /** * YEARFRAC. * @@ -23,19 +27,28 @@ class YearFrac * * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string + * Or can be an array of values * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string - * @param int $method Method used for the calculation + * Or can be an array of methods + * @param array|int $method Method used for the calculation * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 * 3 Actual/365 * 4 European 30/360 + * Or can be an array of methods * - * @return float|string fraction of the year, or a string containing an error + * @return array|float|string fraction of the year, or a string containing an error + * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result + * will also be an array with matching dimensions */ public static function fraction($startDate, $endDate, $method = 0) { + if (is_array($startDate) || is_array($endDate) || is_array($method)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $startDate, $endDate, $method); + } + try { $method = (int) Helpers::validateNumericNull($method); $sDate = Helpers::getDateValue($startDate); @@ -50,18 +63,18 @@ public static function fraction($startDate, $endDate, $method = 0) switch ($method) { case 0: - return Days360::between($startDate, $endDate) / 360; + return Functions::scalar(Days360::between($startDate, $endDate)) / 360; case 1: return self::method1($startDate, $endDate); case 2: - return Difference::interval($startDate, $endDate) / 360; + return Functions::scalar(Difference::interval($startDate, $endDate)) / 360; case 3: - return Difference::interval($startDate, $endDate) / 365; + return Functions::scalar(Difference::interval($startDate, $endDate)) / 365; case 4: - return Days360::between($startDate, $endDate, true) / 360; + return Functions::scalar(Days360::between($startDate, $endDate, true)) / 360; } - return Functions::NAN(); + return ExcelError::NAN(); } /** @@ -87,7 +100,7 @@ private static function excelBug(float $sDate, $startDate, $endDate, int $method private static function method1(float $startDate, float $endDate): float { - $days = Difference::interval($startDate, $endDate); + $days = Functions::scalar(Difference::interval($startDate, $endDate)); $startYear = (int) DateParts::year($startDate); $endYear = (int) DateParts::year($endDate); $years = $endYear - $startYear + 1; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentHelper.php new file mode 100644 index 0000000..fae9d90 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentHelper.php @@ -0,0 +1,209 @@ +indexStart = (int) array_shift($keys); + $this->rows = $this->rows($arguments); + $this->columns = $this->columns($arguments); + + $this->argumentCount = count($arguments); + $this->arguments = $this->flattenSingleCellArrays($arguments, $this->rows, $this->columns); + + $this->rows = $this->rows($arguments); + $this->columns = $this->columns($arguments); + + if ($this->arrayArguments() > 2) { + throw new Exception('Formulae with more than two array arguments are not supported'); + } + } + + public function arguments(): array + { + return $this->arguments; + } + + public function hasArrayArgument(): bool + { + return $this->arrayArguments() > 0; + } + + public function getFirstArrayArgumentNumber(): int + { + $rowArrays = $this->filterArray($this->rows); + $columnArrays = $this->filterArray($this->columns); + + for ($index = $this->indexStart; $index < $this->argumentCount; ++$index) { + if (isset($rowArrays[$index]) || isset($columnArrays[$index])) { + return ++$index; + } + } + + return 0; + } + + public function getSingleRowVector(): ?int + { + $rowVectors = $this->getRowVectors(); + + return count($rowVectors) === 1 ? array_pop($rowVectors) : null; + } + + private function getRowVectors(): array + { + $rowVectors = []; + for ($index = $this->indexStart; $index < ($this->indexStart + $this->argumentCount); ++$index) { + if ($this->rows[$index] === 1 && $this->columns[$index] > 1) { + $rowVectors[] = $index; + } + } + + return $rowVectors; + } + + public function getSingleColumnVector(): ?int + { + $columnVectors = $this->getColumnVectors(); + + return count($columnVectors) === 1 ? array_pop($columnVectors) : null; + } + + private function getColumnVectors(): array + { + $columnVectors = []; + for ($index = $this->indexStart; $index < ($this->indexStart + $this->argumentCount); ++$index) { + if ($this->rows[$index] > 1 && $this->columns[$index] === 1) { + $columnVectors[] = $index; + } + } + + return $columnVectors; + } + + public function getMatrixPair(): array + { + for ($i = $this->indexStart; $i < ($this->indexStart + $this->argumentCount - 1); ++$i) { + for ($j = $i + 1; $j < $this->argumentCount; ++$j) { + if (isset($this->rows[$i], $this->rows[$j])) { + return [$i, $j]; + } + } + } + + return []; + } + + public function isVector(int $argument): bool + { + return $this->rows[$argument] === 1 || $this->columns[$argument] === 1; + } + + public function isRowVector(int $argument): bool + { + return $this->rows[$argument] === 1; + } + + public function isColumnVector(int $argument): bool + { + return $this->columns[$argument] === 1; + } + + public function rowCount(int $argument): int + { + return $this->rows[$argument]; + } + + public function columnCount(int $argument): int + { + return $this->columns[$argument]; + } + + private function rows(array $arguments): array + { + return array_map( + function ($argument) { + return is_countable($argument) ? count($argument) : 1; + }, + $arguments + ); + } + + private function columns(array $arguments): array + { + return array_map( + function ($argument) { + return is_array($argument) && is_array($argument[array_keys($argument)[0]]) + ? count($argument[array_keys($argument)[0]]) + : 1; + }, + $arguments + ); + } + + public function arrayArguments(): int + { + $count = 0; + foreach (array_keys($this->arguments) as $argument) { + if ($this->rows[$argument] > 1 || $this->columns[$argument] > 1) { + ++$count; + } + } + + return $count; + } + + private function flattenSingleCellArrays(array $arguments, array $rows, array $columns): array + { + foreach ($arguments as $index => $argument) { + if ($rows[$index] === 1 && $columns[$index] === 1) { + while (is_array($argument)) { + $argument = array_pop($argument); + } + $arguments[$index] = $argument; + } + } + + return $arguments; + } + + private function filterArray(array $array): array + { + return array_filter( + $array, + function ($value) { + return $value > 1; + } + ); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentProcessor.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentProcessor.php new file mode 100644 index 0000000..3e69d77 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentProcessor.php @@ -0,0 +1,175 @@ +hasArrayArgument() === false) { + return [$method(...$arguments)]; + } + + if (self::$arrayArgumentHelper->arrayArguments() === 1) { + $nthArgument = self::$arrayArgumentHelper->getFirstArrayArgumentNumber(); + + return self::evaluateNthArgumentAsArray($method, $nthArgument, ...$arguments); + } + + $singleRowVectorIndex = self::$arrayArgumentHelper->getSingleRowVector(); + $singleColumnVectorIndex = self::$arrayArgumentHelper->getSingleColumnVector(); + + if ($singleRowVectorIndex !== null && $singleColumnVectorIndex !== null) { + // Basic logic for a single row vector and a single column vector + return self::evaluateVectorPair($method, $singleRowVectorIndex, $singleColumnVectorIndex, ...$arguments); + } + + $matrixPair = self::$arrayArgumentHelper->getMatrixPair(); + if ($matrixPair !== []) { + if ( + (self::$arrayArgumentHelper->isVector($matrixPair[0]) === true && + self::$arrayArgumentHelper->isVector($matrixPair[1]) === false) || + (self::$arrayArgumentHelper->isVector($matrixPair[0]) === false && + self::$arrayArgumentHelper->isVector($matrixPair[1]) === true) + ) { + // Logic for a matrix and a vector (row or column) + return self::evaluateVectorMatrixPair($method, $matrixPair, ...$arguments); + } + // Logic for matrix/matrix, column vector/column vector or row vector/row vector + return self::evaluateMatrixPair($method, $matrixPair, ...$arguments); + } + + // Still need to work out the logic for more than two array arguments, + // For the moment, we're throwing an Exception when we initialise the ArrayArgumentHelper + return ['#VALUE!']; + } + + /** + * @param mixed ...$arguments + */ + private static function evaluateVectorMatrixPair(callable $method, array $matrixIndexes, ...$arguments): array + { + $matrix2 = array_pop($matrixIndexes); + /** @var array $matrixValues2 */ + $matrixValues2 = $arguments[$matrix2]; + $matrix1 = array_pop($matrixIndexes); + /** @var array $matrixValues1 */ + $matrixValues1 = $arguments[$matrix1]; + + $rows = min(array_map([self::$arrayArgumentHelper, 'rowCount'], [$matrix1, $matrix2])); + $columns = min(array_map([self::$arrayArgumentHelper, 'columnCount'], [$matrix1, $matrix2])); + + if ($rows === 1) { + $rows = max(array_map([self::$arrayArgumentHelper, 'rowCount'], [$matrix1, $matrix2])); + } + if ($columns === 1) { + $columns = max(array_map([self::$arrayArgumentHelper, 'columnCount'], [$matrix1, $matrix2])); + } + + $result = []; + for ($rowIndex = 0; $rowIndex < $rows; ++$rowIndex) { + for ($columnIndex = 0; $columnIndex < $columns; ++$columnIndex) { + $rowIndex1 = self::$arrayArgumentHelper->isRowVector($matrix1) ? 0 : $rowIndex; + $columnIndex1 = self::$arrayArgumentHelper->isColumnVector($matrix1) ? 0 : $columnIndex; + $value1 = $matrixValues1[$rowIndex1][$columnIndex1]; + $rowIndex2 = self::$arrayArgumentHelper->isRowVector($matrix2) ? 0 : $rowIndex; + $columnIndex2 = self::$arrayArgumentHelper->isColumnVector($matrix2) ? 0 : $columnIndex; + $value2 = $matrixValues2[$rowIndex2][$columnIndex2]; + $arguments[$matrix1] = $value1; + $arguments[$matrix2] = $value2; + + $result[$rowIndex][$columnIndex] = $method(...$arguments); + } + } + + return $result; + } + + /** + * @param mixed ...$arguments + */ + private static function evaluateMatrixPair(callable $method, array $matrixIndexes, ...$arguments): array + { + $matrix2 = array_pop($matrixIndexes); + /** @var array $matrixValues2 */ + $matrixValues2 = $arguments[$matrix2]; + $matrix1 = array_pop($matrixIndexes); + /** @var array $matrixValues1 */ + $matrixValues1 = $arguments[$matrix1]; + + $result = []; + foreach ($matrixValues1 as $rowIndex => $row) { + foreach ($row as $columnIndex => $value1) { + if (isset($matrixValues2[$rowIndex][$columnIndex]) === false) { + continue; + } + + $value2 = $matrixValues2[$rowIndex][$columnIndex]; + $arguments[$matrix1] = $value1; + $arguments[$matrix2] = $value2; + + $result[$rowIndex][$columnIndex] = $method(...$arguments); + } + } + + return $result; + } + + /** + * @param mixed ...$arguments + */ + private static function evaluateVectorPair(callable $method, int $rowIndex, int $columnIndex, ...$arguments): array + { + $rowVector = Functions::flattenArray($arguments[$rowIndex]); + $columnVector = Functions::flattenArray($arguments[$columnIndex]); + + $result = []; + foreach ($columnVector as $column) { + $rowResults = []; + foreach ($rowVector as $row) { + $arguments[$rowIndex] = $row; + $arguments[$columnIndex] = $column; + + $rowResults[] = $method(...$arguments); + } + $result[] = $rowResults; + } + + return $result; + } + + /** + * Note, offset is from 1 (for the first argument) rather than from 0. + * + * @param mixed ...$arguments + */ + private static function evaluateNthArgumentAsArray(callable $method, int $nthArgument, ...$arguments): array + { + $values = array_slice($arguments, $nthArgument - 1, 1); + /** @var array $values */ + $values = array_pop($values); + + $result = []; + foreach ($values as $value) { + $arguments[$nthArgument - 1] = $value; + $result[] = $method(...$arguments); + } + + return $result; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php new file mode 100644 index 0000000..9cd767e --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/BranchPruner.php @@ -0,0 +1,223 @@ +branchPruningEnabled = $branchPruningEnabled; + } + + public function clearBranchStore(): void + { + $this->branchStoreKeyCounter = 0; + } + + public function initialiseForLoop(): void + { + $this->currentCondition = null; + $this->currentOnlyIf = null; + $this->currentOnlyIfNot = null; + $this->previousStoreKey = null; + $this->pendingStoreKey = empty($this->storeKeysStack) ? null : end($this->storeKeysStack); + + if ($this->branchPruningEnabled) { + $this->initialiseCondition(); + $this->initialiseThen(); + $this->initialiseElse(); + } + } + + private function initialiseCondition(): void + { + if (isset($this->conditionMap[$this->pendingStoreKey]) && $this->conditionMap[$this->pendingStoreKey]) { + $this->currentCondition = $this->pendingStoreKey; + $stackDepth = count($this->storeKeysStack); + if ($stackDepth > 1) { + // nested if + $this->previousStoreKey = $this->storeKeysStack[$stackDepth - 2]; + } + } + } + + private function initialiseThen(): void + { + if (isset($this->thenMap[$this->pendingStoreKey]) && $this->thenMap[$this->pendingStoreKey]) { + $this->currentOnlyIf = $this->pendingStoreKey; + } elseif ( + isset($this->previousStoreKey, $this->thenMap[$this->previousStoreKey]) + && $this->thenMap[$this->previousStoreKey] + ) { + $this->currentOnlyIf = $this->previousStoreKey; + } + } + + private function initialiseElse(): void + { + if (isset($this->elseMap[$this->pendingStoreKey]) && $this->elseMap[$this->pendingStoreKey]) { + $this->currentOnlyIfNot = $this->pendingStoreKey; + } elseif ( + isset($this->previousStoreKey, $this->elseMap[$this->previousStoreKey]) + && $this->elseMap[$this->previousStoreKey] + ) { + $this->currentOnlyIfNot = $this->previousStoreKey; + } + } + + public function decrementDepth(): void + { + if (!empty($this->pendingStoreKey)) { + --$this->braceDepthMap[$this->pendingStoreKey]; + } + } + + public function incrementDepth(): void + { + if (!empty($this->pendingStoreKey)) { + ++$this->braceDepthMap[$this->pendingStoreKey]; + } + } + + public function functionCall(string $functionName): void + { + if ($this->branchPruningEnabled && ($functionName === 'IF(')) { + // we handle a new if + $this->pendingStoreKey = $this->getUnusedBranchStoreKey(); + $this->storeKeysStack[] = $this->pendingStoreKey; + $this->conditionMap[$this->pendingStoreKey] = true; + $this->braceDepthMap[$this->pendingStoreKey] = 0; + } elseif (!empty($this->pendingStoreKey) && array_key_exists($this->pendingStoreKey, $this->braceDepthMap)) { + // this is not an if but we go deeper + ++$this->braceDepthMap[$this->pendingStoreKey]; + } + } + + public function argumentSeparator(): void + { + if (!empty($this->pendingStoreKey) && $this->braceDepthMap[$this->pendingStoreKey] === 0) { + // We must go to the IF next argument + if ($this->conditionMap[$this->pendingStoreKey]) { + $this->conditionMap[$this->pendingStoreKey] = false; + $this->thenMap[$this->pendingStoreKey] = true; + } elseif ($this->thenMap[$this->pendingStoreKey]) { + $this->thenMap[$this->pendingStoreKey] = false; + $this->elseMap[$this->pendingStoreKey] = true; + } elseif ($this->elseMap[$this->pendingStoreKey]) { + throw new Exception('Reaching fourth argument of an IF'); + } + } + } + + /** + * @param mixed $value + */ + public function closingBrace($value): void + { + if (!empty($this->pendingStoreKey) && $this->braceDepthMap[$this->pendingStoreKey] === -1) { + // we are closing an IF( + if ($value !== 'IF(') { + throw new Exception('Parser bug we should be in an "IF("'); + } + + if ($this->conditionMap[$this->pendingStoreKey]) { + throw new Exception('We should not be expecting a condition'); + } + + $this->thenMap[$this->pendingStoreKey] = false; + $this->elseMap[$this->pendingStoreKey] = false; + --$this->braceDepthMap[$this->pendingStoreKey]; + array_pop($this->storeKeysStack); + $this->pendingStoreKey = null; + } + } + + public function currentCondition(): ?string + { + return $this->currentCondition; + } + + public function currentOnlyIf(): ?string + { + return $this->currentOnlyIf; + } + + public function currentOnlyIfNot(): ?string + { + return $this->currentOnlyIfNot; + } + + private function getUnusedBranchStoreKey(): string + { + $storeKeyValue = 'storeKey-' . $this->branchStoreKeyCounter; + ++$this->branchStoreKeyCounter; + + return $storeKeyValue; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php index 7f4657c..c6ee596 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php @@ -87,12 +87,14 @@ public function getEchoDebugLog() /** * Write an entry to the calculation engine debug log. + * + * @param mixed $args */ - public function writeDebugLog(...$args): void + public function writeDebugLog(string $message, ...$args): void { // Only write the debug log if logging is enabled if ($this->writeDebugLog) { - $message = implode('', $args); + $message = sprintf($message, ...$args); $cellReference = implode(' -> ', $this->cellStack->showStack()); if ($this->echoDebugLog) { echo $cellReference, diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php index a70ddac..d70b32d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php @@ -61,7 +61,7 @@ public static function parseComplex($complexNumber) * If $ord is nonnumeric, BESSELI returns the #VALUE! error value. * If $ord < 0, BESSELI returns the #NUM! error value. * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error */ public static function BESSELI($x, $ord) { @@ -86,7 +86,7 @@ public static function BESSELI($x, $ord) * If $ord is nonnumeric, BESSELJ returns the #VALUE! error value. * If $ord < 0, BESSELJ returns the #NUM! error value. * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error */ public static function BESSELJ($x, $ord) { @@ -112,7 +112,7 @@ public static function BESSELJ($x, $ord) * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. * If $ord < 0, BESSELK returns the #NUM! error value. * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error */ public static function BESSELK($x, $ord) { @@ -137,7 +137,7 @@ public static function BESSELK($x, $ord) * If $ord is nonnumeric, BESSELY returns the #VALUE! error value. * If $ord < 0, BESSELY returns the #NUM! error value. * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error */ public static function BESSELY($x, $ord) { @@ -163,7 +163,7 @@ public static function BESSELY($x, $ord) * If number is not a valid binary number, or if number contains more than * 10 characters (10 bits), BIN2DEC returns the #NUM! error value. * - * @return string + * @return array|string */ public static function BINTODEC($x) { @@ -195,7 +195,7 @@ public static function BINTODEC($x) * If places is nonnumeric, BIN2HEX returns the #VALUE! error value. * If places is negative, BIN2HEX returns the #NUM! error value. * - * @return string + * @return array|string */ public static function BINTOHEX($x, $places = null) { @@ -227,7 +227,7 @@ public static function BINTOHEX($x, $places = null) * If places is nonnumeric, BIN2OCT returns the #VALUE! error value. * If places is negative, BIN2OCT returns the #NUM! error value. * - * @return string + * @return array|string */ public static function BINTOOCT($x, $places = null) { @@ -263,7 +263,7 @@ public static function BINTOOCT($x, $places = null) * If places is nonnumeric, DEC2BIN returns the #VALUE! error value. * If places is zero or negative, DEC2BIN returns the #NUM! error value. * - * @return string + * @return array|string */ public static function DECTOBIN($x, $places = null) { @@ -299,7 +299,7 @@ public static function DECTOBIN($x, $places = null) * If places is nonnumeric, DEC2HEX returns the #VALUE! error value. * If places is zero or negative, DEC2HEX returns the #NUM! error value. * - * @return string + * @return array|string */ public static function DECTOHEX($x, $places = null) { @@ -335,7 +335,7 @@ public static function DECTOHEX($x, $places = null) * If places is nonnumeric, DEC2OCT returns the #VALUE! error value. * If places is zero or negative, DEC2OCT returns the #NUM! error value. * - * @return string + * @return array|string */ public static function DECTOOCT($x, $places = null) { @@ -371,7 +371,7 @@ public static function DECTOOCT($x, $places = null) * If places is nonnumeric, HEX2BIN returns the #VALUE! error value. * If places is negative, HEX2BIN returns the #NUM! error value. * - * @return string + * @return array|string */ public static function HEXTOBIN($x, $places = null) { @@ -398,7 +398,7 @@ public static function HEXTOBIN($x, $places = null) * If number is not a valid hexadecimal number, HEX2DEC returns the * #NUM! error value. * - * @return string + * @return array|string */ public static function HEXTODEC($x) { @@ -438,7 +438,7 @@ public static function HEXTODEC($x) * value. * If places is negative, HEX2OCT returns the #NUM! error value. * - * @return string + * @return array|string */ public static function HEXTOOCT($x, $places = null) { @@ -480,7 +480,7 @@ public static function HEXTOOCT($x, $places = null) * If places is negative, OCT2BIN returns the #NUM! error * value. * - * @return string + * @return array|string */ public static function OCTTOBIN($x, $places = null) { @@ -507,7 +507,7 @@ public static function OCTTOBIN($x, $places = null) * If number is not a valid octal number, OCT2DEC returns the * #NUM! error value. * - * @return string + * @return array|string */ public static function OCTTODEC($x) { @@ -544,7 +544,7 @@ public static function OCTTODEC($x) * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. * If places is negative, OCT2HEX returns the #NUM! error value. * - * @return string + * @return array|string */ public static function OCTTOHEX($x, $places = null) { @@ -563,12 +563,12 @@ public static function OCTTOHEX($x, $places = null) * * @see Use the COMPLEX() method in the Engineering\Complex class instead * - * @param float $realNumber the real coefficient of the complex number - * @param float $imaginary the imaginary coefficient of the complex number - * @param string $suffix The suffix for the imaginary component of the complex number. + * @param array|float $realNumber the real coefficient of the complex number + * @param array|float $imaginary the imaginary coefficient of the complex number + * @param array|string $suffix The suffix for the imaginary component of the complex number. * If omitted, the suffix is assumed to be "i". * - * @return string + * @return array|string */ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') { @@ -590,7 +590,7 @@ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i * @param string $complexNumber the complex number for which you want the imaginary * coefficient * - * @return float|string + * @return array|float|string */ public static function IMAGINARY($complexNumber) { @@ -611,7 +611,7 @@ public static function IMAGINARY($complexNumber) * * @param string $complexNumber the complex number for which you want the real coefficient * - * @return float|string + * @return array|float|string */ public static function IMREAL($complexNumber) { @@ -632,7 +632,7 @@ public static function IMREAL($complexNumber) * * @param string $complexNumber the complex number for which you want the absolute value * - * @return float|string + * @return array|float|string */ public static function IMABS($complexNumber) { @@ -652,9 +652,9 @@ public static function IMABS($complexNumber) * * @see Use the IMARGUMENT() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the argument theta + * @param array|string $complexNumber the complex number for which you want the argument theta * - * @return float|string + * @return array|float|string */ public static function IMARGUMENT($complexNumber) { @@ -673,9 +673,9 @@ public static function IMARGUMENT($complexNumber) * * @see Use the IMARGUMENT() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the conjugate + * @param array|string $complexNumber the complex number for which you want the conjugate * - * @return string + * @return array|string */ public static function IMCONJUGATE($complexNumber) { @@ -694,9 +694,9 @@ public static function IMCONJUGATE($complexNumber) * * @see Use the IMCOS() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the cosine + * @param array|string $complexNumber the complex number for which you want the cosine * - * @return float|string + * @return array|float|string */ public static function IMCOS($complexNumber) { @@ -715,9 +715,9 @@ public static function IMCOS($complexNumber) * * @see Use the IMCOSH() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the hyperbolic cosine + * @param array|string $complexNumber the complex number for which you want the hyperbolic cosine * - * @return float|string + * @return array|float|string */ public static function IMCOSH($complexNumber) { @@ -736,9 +736,9 @@ public static function IMCOSH($complexNumber) * * @see Use the IMCOT() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the cotangent + * @param array|string $complexNumber the complex number for which you want the cotangent * - * @return float|string + * @return array|float|string */ public static function IMCOT($complexNumber) { @@ -757,9 +757,9 @@ public static function IMCOT($complexNumber) * * @see Use the IMCSC() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the cosecant + * @param array|string $complexNumber the complex number for which you want the cosecant * - * @return float|string + * @return array|float|string */ public static function IMCSC($complexNumber) { @@ -778,9 +778,9 @@ public static function IMCSC($complexNumber) * * @see Use the IMCSCH() method in the Engineering\ComplexFunctions class instead * - * @param string $complexNumber the complex number for which you want the hyperbolic cosecant + * @param array|string $complexNumber the complex number for which you want the hyperbolic cosecant * - * @return float|string + * @return array|float|string */ public static function IMCSCH($complexNumber) { @@ -801,7 +801,7 @@ public static function IMCSCH($complexNumber) * * @param string $complexNumber the complex number for which you want the sine * - * @return float|string + * @return array|float|string */ public static function IMSIN($complexNumber) { @@ -822,7 +822,7 @@ public static function IMSIN($complexNumber) * * @param string $complexNumber the complex number for which you want the hyperbolic sine * - * @return float|string + * @return array|float|string */ public static function IMSINH($complexNumber) { @@ -843,7 +843,7 @@ public static function IMSINH($complexNumber) * * @param string $complexNumber the complex number for which you want the secant * - * @return float|string + * @return array|float|string */ public static function IMSEC($complexNumber) { @@ -864,7 +864,7 @@ public static function IMSEC($complexNumber) * * @param string $complexNumber the complex number for which you want the hyperbolic secant * - * @return float|string + * @return array|float|string */ public static function IMSECH($complexNumber) { @@ -885,7 +885,7 @@ public static function IMSECH($complexNumber) * * @param string $complexNumber the complex number for which you want the tangent * - * @return float|string + * @return array|float|string */ public static function IMTAN($complexNumber) { @@ -906,7 +906,7 @@ public static function IMTAN($complexNumber) * * @param string $complexNumber the complex number for which you want the square root * - * @return string + * @return array|string */ public static function IMSQRT($complexNumber) { @@ -927,7 +927,7 @@ public static function IMSQRT($complexNumber) * * @param string $complexNumber the complex number for which you want the natural logarithm * - * @return string + * @return array|string */ public static function IMLN($complexNumber) { @@ -948,7 +948,7 @@ public static function IMLN($complexNumber) * * @param string $complexNumber the complex number for which you want the common logarithm * - * @return string + * @return array|string */ public static function IMLOG10($complexNumber) { @@ -969,7 +969,7 @@ public static function IMLOG10($complexNumber) * * @param string $complexNumber the complex number for which you want the base-2 logarithm * - * @return string + * @return array|string */ public static function IMLOG2($complexNumber) { @@ -990,7 +990,7 @@ public static function IMLOG2($complexNumber) * * @param string $complexNumber the complex number for which you want the exponential * - * @return string + * @return array|string */ public static function IMEXP($complexNumber) { @@ -1012,7 +1012,7 @@ public static function IMEXP($complexNumber) * @param string $complexNumber the complex number you want to raise to a power * @param float $realNumber the power to which you want to raise the complex number * - * @return string + * @return array|string */ public static function IMPOWER($complexNumber, $realNumber) { @@ -1034,7 +1034,7 @@ public static function IMPOWER($complexNumber, $realNumber) * @param string $complexDividend the complex numerator or dividend * @param string $complexDivisor the complex denominator or divisor * - * @return string + * @return array|string */ public static function IMDIV($complexDividend, $complexDivisor) { @@ -1056,7 +1056,7 @@ public static function IMDIV($complexDividend, $complexDivisor) * @param string $complexNumber1 the complex number from which to subtract complexNumber2 * @param string $complexNumber2 the complex number to subtract from complexNumber1 * - * @return string + * @return array|string */ public static function IMSUB($complexNumber1, $complexNumber2) { @@ -1123,7 +1123,7 @@ public static function IMPRODUCT(...$complexNumbers) * @param float $a the first number * @param float $b The second number. If omitted, b is assumed to be zero. * - * @return int|string (string in the event of an error) + * @return array|int|string (string in the event of an error) */ public static function DELTA($a, $b = 0) { @@ -1147,7 +1147,7 @@ public static function DELTA($a, $b = 0) * @param float $number the value to test against step * @param float $step The threshold value. If you omit a value for step, GESTEP uses zero. * - * @return int|string (string in the event of an error) + * @return array|int|string (string in the event of an error) */ public static function GESTEP($number, $step = 0) { @@ -1169,7 +1169,7 @@ public static function GESTEP($number, $step = 0) * @param int $number1 * @param int $number2 * - * @return int|string + * @return array|int|string */ public static function BITAND($number1, $number2) { @@ -1191,7 +1191,7 @@ public static function BITAND($number1, $number2) * @param int $number1 * @param int $number2 * - * @return int|string + * @return array|int|string */ public static function BITOR($number1, $number2) { @@ -1213,7 +1213,7 @@ public static function BITOR($number1, $number2) * @param int $number1 * @param int $number2 * - * @return int|string + * @return array|int|string */ public static function BITXOR($number1, $number2) { @@ -1235,7 +1235,7 @@ public static function BITXOR($number1, $number2) * @param int $number * @param int $shiftAmount * - * @return int|string + * @return array|float|int|string */ public static function BITLSHIFT($number, $shiftAmount) { @@ -1257,7 +1257,7 @@ public static function BITLSHIFT($number, $shiftAmount) * @param int $number * @param int $shiftAmount * - * @return int|string + * @return array|float|int|string */ public static function BITRSHIFT($number, $shiftAmount) { @@ -1285,7 +1285,7 @@ public static function BITRSHIFT($number, $shiftAmount) * @param float $upper upper bound for integrating ERF. * If omitted, ERF integrates between zero and lower_limit * - * @return float|string + * @return array|float|string */ public static function ERF($lower, $upper = null) { @@ -1306,7 +1306,7 @@ public static function ERF($lower, $upper = null) * * @param float $limit bound for integrating ERF * - * @return float|string + * @return array|float|string */ public static function ERFPRECISE($limit) { @@ -1332,7 +1332,7 @@ public static function ERFPRECISE($limit) * * @param float $x The lower bound for integrating ERFC * - * @return float|string + * @return array|float|string */ public static function ERFC($x) { @@ -1437,7 +1437,7 @@ public static function getBinaryConversionMultipliers() * @param string $fromUOM the units for value * @param string $toUOM the units for the result * - * @return float|string + * @return array|float|string */ public static function CONVERTUOM($value, $fromUOM, $toUOM) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselI.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselI.php index ea2577c..2afb52b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselI.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselI.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class BesselI { + use ArrayEnabled; + /** * BESSELI. * @@ -21,17 +24,22 @@ class BesselI * * @param mixed $x A float value at which to evaluate the function. * If x is nonnumeric, BESSELI returns the #VALUE! error value. + * Or can be an array of values * @param mixed $ord The integer order of the Bessel function. * If ord is not an integer, it is truncated. * If $ord is nonnumeric, BESSELI returns the #VALUE! error value. * If $ord < 0, BESSELI returns the #NUM! error value. + * Or can be an array of values * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BESSELI($x, $ord) { - $x = Functions::flattenSingleValue($x); - $ord = Functions::flattenSingleValue($ord); + if (is_array($x) || is_array($ord)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord); + } try { $x = EngineeringValidations::validateFloat($x); @@ -41,12 +49,12 @@ public static function BESSELI($x, $ord) } if ($ord < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $fResult = self::calculate($x, $ord); - return (is_nan($fResult)) ? Functions::NAN() : $fResult; + return (is_nan($fResult)) ? ExcelError::NAN() : $fResult; } private static function calculate(float $x, int $ord): float diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php index 7ea45a7..e23b015 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselJ.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class BesselJ { + use ArrayEnabled; + /** * BESSELJ. * @@ -20,17 +23,22 @@ class BesselJ * * @param mixed $x A float value at which to evaluate the function. * If x is nonnumeric, BESSELJ returns the #VALUE! error value. + * Or can be an array of values * @param mixed $ord The integer order of the Bessel function. * If ord is not an integer, it is truncated. * If $ord is nonnumeric, BESSELJ returns the #VALUE! error value. * If $ord < 0, BESSELJ returns the #NUM! error value. + * Or can be an array of values * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BESSELJ($x, $ord) { - $x = Functions::flattenSingleValue($x); - $ord = Functions::flattenSingleValue($ord); + if (is_array($x) || is_array($ord)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord); + } try { $x = EngineeringValidations::validateFloat($x); @@ -40,12 +48,12 @@ public static function BESSELJ($x, $ord) } if ($ord < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $fResult = self::calculate($x, $ord); - return (is_nan($fResult)) ? Functions::NAN() : $fResult; + return (is_nan($fResult)) ? ExcelError::NAN() : $fResult; } private static function calculate(float $x, int $ord): float diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselK.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselK.php index 8facdff..2d21e75 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselK.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselK.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class BesselK { + use ArrayEnabled; + /** * BESSELK. * @@ -18,17 +22,22 @@ class BesselK * * @param mixed $x A float value at which to evaluate the function. * If x is nonnumeric, BESSELK returns the #VALUE! error value. + * Or can be an array of values * @param mixed $ord The integer order of the Bessel function. * If ord is not an integer, it is truncated. * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. * If $ord < 0, BESSELKI returns the #NUM! error value. + * Or can be an array of values * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BESSELK($x, $ord) { - $x = Functions::flattenSingleValue($x); - $ord = Functions::flattenSingleValue($ord); + if (is_array($x) || is_array($ord)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord); + } try { $x = EngineeringValidations::validateFloat($x); @@ -38,12 +47,12 @@ public static function BESSELK($x, $ord) } if (($ord < 0) || ($x <= 0.0)) { - return Functions::NAN(); + return ExcelError::NAN(); } $fBk = self::calculate($x, $ord); - return (is_nan($fBk)) ? Functions::NAN() : $fBk; + return (is_nan($fBk)) ? ExcelError::NAN() : $fBk; } private static function calculate(float $x, int $ord): float @@ -59,13 +68,28 @@ private static function calculate(float $x, int $ord): float return self::besselK2($x, $ord); } + /** + * Mollify Phpstan. + * + * @codeCoverageIgnore + */ + private static function callBesselI(float $x, int $ord): float + { + $rslt = BesselI::BESSELI($x, $ord); + if (!is_float($rslt)) { + throw new Exception('Unexpected array or string'); + } + + return $rslt; + } + private static function besselK0(float $x): float { if ($x <= 2) { $fNum2 = $x * 0.5; $y = ($fNum2 * $fNum2); - return -log($fNum2) * BesselI::BESSELI($x, 0) + + return -log($fNum2) * self::callBesselI($x, 0) + (-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y * (0.10750e-3 + $y * 0.74e-5)))))); } @@ -83,7 +107,7 @@ private static function besselK1(float $x): float $fNum2 = $x * 0.5; $y = ($fNum2 * $fNum2); - return log($fNum2) * BesselI::BESSELI($x, 1) + + return log($fNum2) * self::callBesselI($x, 1) + (1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y * (-0.110404e-2 + $y * (-0.4686e-4))))))) / $x; } @@ -95,7 +119,7 @@ private static function besselK1(float $x): float (0.325614e-2 + $y * (-0.68245e-3))))))); } - private static function besselK2(float $x, int $ord) + private static function besselK2(float $x, int $ord): float { $fTox = 2 / $x; $fBkm = self::besselK0($x); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselY.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselY.php index 7f38749..31d9694 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselY.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BesselY.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class BesselY { + use ArrayEnabled; + /** * BESSELY. * @@ -17,17 +20,22 @@ class BesselY * * @param mixed $x A float value at which to evaluate the function. * If x is nonnumeric, BESSELY returns the #VALUE! error value. + * Or can be an array of values * @param mixed $ord The integer order of the Bessel function. * If ord is not an integer, it is truncated. * If $ord is nonnumeric, BESSELY returns the #VALUE! error value. * If $ord < 0, BESSELY returns the #NUM! error value. + * Or can be an array of values * - * @return float|string Result, or a string containing an error + * @return array|float|string Result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BESSELY($x, $ord) { - $x = Functions::flattenSingleValue($x); - $ord = Functions::flattenSingleValue($ord); + if (is_array($x) || is_array($ord)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $ord); + } try { $x = EngineeringValidations::validateFloat($x); @@ -37,12 +45,12 @@ public static function BESSELY($x, $ord) } if (($ord < 0) || ($x <= 0.0)) { - return Functions::NAN(); + return ExcelError::NAN(); } $fBy = self::calculate($x, $ord); - return (is_nan($fBy)) ? Functions::NAN() : $fBy; + return (is_nan($fBy)) ? ExcelError::NAN() : $fBy; } private static function calculate(float $x, int $ord): float @@ -58,6 +66,21 @@ private static function calculate(float $x, int $ord): float return self::besselY2($x, $ord); } + /** + * Mollify Phpstan. + * + * @codeCoverageIgnore + */ + private static function callBesselJ(float $x, int $ord): float + { + $rslt = BesselJ::BESSELJ($x, $ord); + if (!is_float($rslt)) { + throw new Exception('Unexpected array or string'); + } + + return $rslt; + } + private static function besselY0(float $x): float { if ($x < 8.0) { @@ -67,7 +90,7 @@ private static function besselY0(float $x): float $ans2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y)))); - return $ans1 / $ans2 + 0.636619772 * BesselJ::BESSELJ($x, 0) * log($x); + return $ans1 / $ans2 + 0.636619772 * self::callBesselJ($x, 0) * log($x); } $z = 8.0 / $x; @@ -89,7 +112,7 @@ private static function besselY1(float $x): float $ans2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y * (0.1020426050e6 + $y * (0.3549632885e3 + $y))))); - return ($ans1 / $ans2) + 0.636619772 * (BesselJ::BESSELJ($x, 1) * log($x) - 1 / $x); + return ($ans1 / $ans2) + 0.636619772 * (self::callBesselJ($x, 1) * log($x) - 1 / $x); } $z = 8.0 / $x; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php index 9958f05..adeb1b5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class BitWise { + use ArrayEnabled; + const SPLIT_DIVISOR = 2 ** 24; /** @@ -27,13 +31,21 @@ private static function splitNumber($number): array * Excel Function: * BITAND(number1, number2) * - * @param int $number1 - * @param int $number2 + * @param array|int $number1 + * Or can be an array of values + * @param array|int $number2 + * Or can be an array of values * - * @return int|string + * @return array|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BITAND($number1, $number2) { + if (is_array($number1) || is_array($number2)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); + } + try { $number1 = self::validateBitwiseArgument($number1); $number2 = self::validateBitwiseArgument($number2); @@ -54,13 +66,21 @@ public static function BITAND($number1, $number2) * Excel Function: * BITOR(number1, number2) * - * @param int $number1 - * @param int $number2 + * @param array|int $number1 + * Or can be an array of values + * @param array|int $number2 + * Or can be an array of values * - * @return int|string + * @return array|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BITOR($number1, $number2) { + if (is_array($number1) || is_array($number2)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); + } + try { $number1 = self::validateBitwiseArgument($number1); $number2 = self::validateBitwiseArgument($number2); @@ -82,13 +102,21 @@ public static function BITOR($number1, $number2) * Excel Function: * BITXOR(number1, number2) * - * @param int $number1 - * @param int $number2 + * @param array|int $number1 + * Or can be an array of values + * @param array|int $number2 + * Or can be an array of values * - * @return int|string + * @return array|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BITXOR($number1, $number2) { + if (is_array($number1) || is_array($number2)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); + } + try { $number1 = self::validateBitwiseArgument($number1); $number2 = self::validateBitwiseArgument($number2); @@ -110,13 +138,21 @@ public static function BITXOR($number1, $number2) * Excel Function: * BITLSHIFT(number, shift_amount) * - * @param int $number - * @param int $shiftAmount + * @param array|int $number + * Or can be an array of values + * @param array|int $shiftAmount + * Or can be an array of values * - * @return float|int|string + * @return array|float|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BITLSHIFT($number, $shiftAmount) { + if (is_array($number) || is_array($shiftAmount)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $shiftAmount); + } + try { $number = self::validateBitwiseArgument($number); $shiftAmount = self::validateShiftAmount($shiftAmount); @@ -126,7 +162,7 @@ public static function BITLSHIFT($number, $shiftAmount) $result = floor($number * (2 ** $shiftAmount)); if ($result > 2 ** 48 - 1) { - return Functions::NAN(); + return ExcelError::NAN(); } return $result; @@ -140,13 +176,21 @@ public static function BITLSHIFT($number, $shiftAmount) * Excel Function: * BITRSHIFT(number, shift_amount) * - * @param int $number - * @param int $shiftAmount + * @param array|int $number + * Or can be an array of values + * @param array|int $shiftAmount + * Or can be an array of values * - * @return float|int|string + * @return array|float|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function BITRSHIFT($number, $shiftAmount) { + if (is_array($number) || is_array($shiftAmount)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $shiftAmount); + } + try { $number = self::validateBitwiseArgument($number); $shiftAmount = self::validateShiftAmount($shiftAmount); @@ -156,7 +200,7 @@ public static function BITRSHIFT($number, $shiftAmount) $result = floor($number / (2 ** $shiftAmount)); if ($result > 2 ** 48 - 1) { // possible because shiftAmount can be negative - return Functions::NAN(); + return ExcelError::NAN(); } return $result; @@ -167,25 +211,26 @@ public static function BITRSHIFT($number, $shiftAmount) * * @param mixed $value * - * @return float|int + * @return float */ private static function validateBitwiseArgument($value) { - self::nullFalseTrueToNumber($value); + $value = self::nullFalseTrueToNumber($value); if (is_numeric($value)) { + $value = (float) $value; if ($value == floor($value)) { if (($value > 2 ** 48 - 1) || ($value < 0)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return floor($value); } - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** @@ -197,31 +242,34 @@ private static function validateBitwiseArgument($value) */ private static function validateShiftAmount($value) { - self::nullFalseTrueToNumber($value); + $value = self::nullFalseTrueToNumber($value); if (is_numeric($value)) { if (abs($value) > 53) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return (int) $value; } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** * Many functions accept null/false/true argument treated as 0/0/1. * * @param mixed $number + * + * @return mixed */ - public static function nullFalseTrueToNumber(&$number): void + private static function nullFalseTrueToNumber(&$number) { - $number = Functions::flattenSingleValue($number); if ($number === null) { $number = 0; } elseif (is_bool($number)) { $number = (int) $number; } + + return $number; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Compare.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Compare.php index 0a63420..4d4bc07 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Compare.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Compare.php @@ -2,11 +2,13 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; class Compare { + use ArrayEnabled; + /** * DELTA. * @@ -18,15 +20,20 @@ class Compare * functions you calculate the count of equal pairs. This function is also known as the * Kronecker Delta function. * - * @param float $a the first number - * @param float $b The second number. If omitted, b is assumed to be zero. + * @param array|float $a the first number + * Or can be an array of values + * @param array|float $b The second number. If omitted, b is assumed to be zero. + * Or can be an array of values * - * @return int|string (string in the event of an error) + * @return array|int|string (string in the event of an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function DELTA($a, $b = 0) + public static function DELTA($a, $b = 0.0) { - $a = Functions::flattenSingleValue($a); - $b = Functions::flattenSingleValue($b); + if (is_array($a) || is_array($b)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $a, $b); + } try { $a = EngineeringValidations::validateFloat($a); @@ -35,7 +42,7 @@ public static function DELTA($a, $b = 0) return $e->getMessage(); } - return (int) ($a == $b); + return (int) (abs($a - $b) < 1.0e-15); } /** @@ -48,15 +55,20 @@ public static function DELTA($a, $b = 0) * Use this function to filter a set of values. For example, by summing several GESTEP * functions you calculate the count of values that exceed a threshold. * - * @param float $number the value to test against step - * @param float $step The threshold value. If you omit a value for step, GESTEP uses zero. + * @param array|float $number the value to test against step + * Or can be an array of values + * @param array|float $step The threshold value. If you omit a value for step, GESTEP uses zero. + * Or can be an array of values * - * @return int|string (string in the event of an error) + * @return array|int|string (string in the event of an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function GESTEP($number, $step = 0) + public static function GESTEP($number, $step = 0.0) { - $number = Functions::flattenSingleValue($number); - $step = Functions::flattenSingleValue($step); + if (is_array($number) || is_array($step)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $step); + } try { $number = EngineeringValidations::validateFloat($number); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Complex.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Complex.php index 1c2f5f7..691de8b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Complex.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Complex.php @@ -4,11 +4,14 @@ use Complex\Complex as ComplexObject; use Complex\Exception as ComplexException; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Complex { + use ArrayEnabled; + /** * COMPLEX. * @@ -18,17 +21,26 @@ class Complex * COMPLEX(realNumber,imaginary[,suffix]) * * @param mixed $realNumber the real float coefficient of the complex number + * Or can be an array of values * @param mixed $imaginary the imaginary float coefficient of the complex number + * Or can be an array of values * @param mixed $suffix The character suffix for the imaginary component of the complex number. * If omitted, the suffix is assumed to be "i". + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') { - $realNumber = ($realNumber === null) ? 0.0 : Functions::flattenSingleValue($realNumber); - $imaginary = ($imaginary === null) ? 0.0 : Functions::flattenSingleValue($imaginary); - $suffix = ($suffix === null) ? 'i' : Functions::flattenSingleValue($suffix); + if (is_array($realNumber) || is_array($imaginary) || is_array($suffix)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $realNumber, $imaginary, $suffix); + } + + $realNumber = $realNumber ?? 0.0; + $imaginary = $imaginary ?? 0.0; + $suffix = $suffix ?? 'i'; try { $realNumber = EngineeringValidations::validateFloat($realNumber); @@ -43,7 +55,7 @@ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i return (string) $complex; } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** @@ -54,19 +66,24 @@ public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i * Excel Function: * IMAGINARY(complexNumber) * - * @param string $complexNumber the complex number for which you want the imaginary + * @param array|string $complexNumber the complex number for which you want the imaginary * coefficient + * Or can be an array of values * - * @return float|string + * @return array|float|string (string if an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMAGINARY($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return $complex->getImaginary(); @@ -80,18 +97,23 @@ public static function IMAGINARY($complexNumber) * Excel Function: * IMREAL(complexNumber) * - * @param string $complexNumber the complex number for which you want the real coefficient + * @param array|string $complexNumber the complex number for which you want the real coefficient + * Or can be an array of values * - * @return float|string + * @return array|float|string (string if an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMREAL($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return $complex->getReal(); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php index 3f37f37..28a27a0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php @@ -4,10 +4,13 @@ use Complex\Complex as ComplexObject; use Complex\Exception as ComplexException; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ComplexFunctions { + use ArrayEnabled; + /** * IMABS. * @@ -16,18 +19,23 @@ class ComplexFunctions * Excel Function: * IMABS(complexNumber) * - * @param string $complexNumber the complex number for which you want the absolute value + * @param array|string $complexNumber the complex number for which you want the absolute value + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMABS($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return $complex->abs(); @@ -42,22 +50,27 @@ public static function IMABS($complexNumber) * Excel Function: * IMARGUMENT(complexNumber) * - * @param string $complexNumber the complex number for which you want the argument theta + * @param array|string $complexNumber the complex number for which you want the argument theta + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMARGUMENT($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } return $complex->argument(); @@ -71,18 +84,23 @@ public static function IMARGUMENT($complexNumber) * Excel Function: * IMCONJUGATE(complexNumber) * - * @param string $complexNumber the complex number for which you want the conjugate + * @param array|string $complexNumber the complex number for which you want the conjugate + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCONJUGATE($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->conjugate(); @@ -96,18 +114,23 @@ public static function IMCONJUGATE($complexNumber) * Excel Function: * IMCOS(complexNumber) * - * @param string $complexNumber the complex number for which you want the cosine + * @param array|string $complexNumber the complex number for which you want the cosine + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCOS($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->cos(); @@ -121,18 +144,23 @@ public static function IMCOS($complexNumber) * Excel Function: * IMCOSH(complexNumber) * - * @param string $complexNumber the complex number for which you want the hyperbolic cosine + * @param array|string $complexNumber the complex number for which you want the hyperbolic cosine + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCOSH($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->cosh(); @@ -146,18 +174,23 @@ public static function IMCOSH($complexNumber) * Excel Function: * IMCOT(complexNumber) * - * @param string $complexNumber the complex number for which you want the cotangent + * @param array|string $complexNumber the complex number for which you want the cotangent + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCOT($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->cot(); @@ -171,18 +204,23 @@ public static function IMCOT($complexNumber) * Excel Function: * IMCSC(complexNumber) * - * @param string $complexNumber the complex number for which you want the cosecant + * @param array|string $complexNumber the complex number for which you want the cosecant + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCSC($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->csc(); @@ -196,18 +234,23 @@ public static function IMCSC($complexNumber) * Excel Function: * IMCSCH(complexNumber) * - * @param string $complexNumber the complex number for which you want the hyperbolic cosecant + * @param array|string $complexNumber the complex number for which you want the hyperbolic cosecant + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMCSCH($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->csch(); @@ -221,18 +264,23 @@ public static function IMCSCH($complexNumber) * Excel Function: * IMSIN(complexNumber) * - * @param string $complexNumber the complex number for which you want the sine + * @param array|string $complexNumber the complex number for which you want the sine + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSIN($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->sin(); @@ -246,18 +294,23 @@ public static function IMSIN($complexNumber) * Excel Function: * IMSINH(complexNumber) * - * @param string $complexNumber the complex number for which you want the hyperbolic sine + * @param array|string $complexNumber the complex number for which you want the hyperbolic sine + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSINH($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->sinh(); @@ -271,18 +324,23 @@ public static function IMSINH($complexNumber) * Excel Function: * IMSEC(complexNumber) * - * @param string $complexNumber the complex number for which you want the secant + * @param array|string $complexNumber the complex number for which you want the secant + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSEC($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->sec(); @@ -296,18 +354,23 @@ public static function IMSEC($complexNumber) * Excel Function: * IMSECH(complexNumber) * - * @param string $complexNumber the complex number for which you want the hyperbolic secant + * @param array|string $complexNumber the complex number for which you want the hyperbolic secant + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSECH($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->sech(); @@ -321,18 +384,23 @@ public static function IMSECH($complexNumber) * Excel Function: * IMTAN(complexNumber) * - * @param string $complexNumber the complex number for which you want the tangent + * @param array|string $complexNumber the complex number for which you want the tangent + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMTAN($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->tan(); @@ -346,22 +414,27 @@ public static function IMTAN($complexNumber) * Excel Function: * IMSQRT(complexNumber) * - * @param string $complexNumber the complex number for which you want the square root + * @param array|string $complexNumber the complex number for which you want the square root + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSQRT($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } $theta = self::IMARGUMENT($complexNumber); - if ($theta === Functions::DIV0()) { + if ($theta === ExcelError::DIV0()) { return '0'; } @@ -376,22 +449,27 @@ public static function IMSQRT($complexNumber) * Excel Function: * IMLN(complexNumber) * - * @param string $complexNumber the complex number for which you want the natural logarithm + * @param array|string $complexNumber the complex number for which you want the natural logarithm + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMLN($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->ln(); @@ -405,22 +483,27 @@ public static function IMLN($complexNumber) * Excel Function: * IMLOG10(complexNumber) * - * @param string $complexNumber the complex number for which you want the common logarithm + * @param array|string $complexNumber the complex number for which you want the common logarithm + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMLOG10($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->log10(); @@ -434,22 +517,27 @@ public static function IMLOG10($complexNumber) * Excel Function: * IMLOG2(complexNumber) * - * @param string $complexNumber the complex number for which you want the base-2 logarithm + * @param array|string $complexNumber the complex number for which you want the base-2 logarithm + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMLOG2($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->log2(); @@ -463,18 +551,23 @@ public static function IMLOG2($complexNumber) * Excel Function: * IMEXP(complexNumber) * - * @param string $complexNumber the complex number for which you want the exponential + * @param array|string $complexNumber the complex number for which you want the exponential + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMEXP($complexNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); + if (is_array($complexNumber)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $complexNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $complex->exp(); @@ -488,26 +581,31 @@ public static function IMEXP($complexNumber) * Excel Function: * IMPOWER(complexNumber,realNumber) * - * @param string $complexNumber the complex number you want to raise to a power - * @param float $realNumber the power to which you want to raise the complex number + * @param array|string $complexNumber the complex number you want to raise to a power + * Or can be an array of values + * @param array|float|int|string $realNumber the power to which you want to raise the complex number + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMPOWER($complexNumber, $realNumber) { - $complexNumber = Functions::flattenSingleValue($complexNumber); - $realNumber = Functions::flattenSingleValue($realNumber); + if (is_array($complexNumber) || is_array($realNumber)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $complexNumber, $realNumber); + } try { $complex = new ComplexObject($complexNumber); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } if (!is_numeric($realNumber)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } - return (string) $complex->pow($realNumber); + return (string) $complex->pow((float) $realNumber); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexOperations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexOperations.php index 681aad8..e525b4b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexOperations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ComplexOperations.php @@ -4,10 +4,14 @@ use Complex\Complex as ComplexObject; use Complex\Exception as ComplexException; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ComplexOperations { + use ArrayEnabled; + /** * IMDIV. * @@ -16,20 +20,25 @@ class ComplexOperations * Excel Function: * IMDIV(complexDividend,complexDivisor) * - * @param string $complexDividend the complex numerator or dividend - * @param string $complexDivisor the complex denominator or divisor + * @param array|string $complexDividend the complex numerator or dividend + * Or can be an array of values + * @param array|string $complexDivisor the complex denominator or divisor + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMDIV($complexDividend, $complexDivisor) { - $complexDividend = Functions::flattenSingleValue($complexDividend); - $complexDivisor = Functions::flattenSingleValue($complexDivisor); + if (is_array($complexDividend) || is_array($complexDivisor)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $complexDividend, $complexDivisor); + } try { return (string) (new ComplexObject($complexDividend))->divideby(new ComplexObject($complexDivisor)); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } } @@ -41,20 +50,25 @@ public static function IMDIV($complexDividend, $complexDivisor) * Excel Function: * IMSUB(complexNumber1,complexNumber2) * - * @param string $complexNumber1 the complex number from which to subtract complexNumber2 - * @param string $complexNumber2 the complex number to subtract from complexNumber1 + * @param array|string $complexNumber1 the complex number from which to subtract complexNumber2 + * Or can be an array of values + * @param array|string $complexNumber2 the complex number to subtract from complexNumber1 + * Or can be an array of values * - * @return string + * @return array|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function IMSUB($complexNumber1, $complexNumber2) { - $complexNumber1 = Functions::flattenSingleValue($complexNumber1); - $complexNumber2 = Functions::flattenSingleValue($complexNumber2); + if (is_array($complexNumber1) || is_array($complexNumber2)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $complexNumber1, $complexNumber2); + } try { return (string) (new ComplexObject($complexNumber1))->subtract(new ComplexObject($complexNumber2)); } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } } @@ -82,7 +96,7 @@ public static function IMSUM(...$complexNumbers) $returnValue = $returnValue->add(new ComplexObject($complex)); } } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $returnValue; @@ -112,7 +126,7 @@ public static function IMPRODUCT(...$complexNumbers) $returnValue = $returnValue->multiply(new ComplexObject($complex)); } } catch (ComplexException $e) { - return Functions::NAN(); + return ExcelError::NAN(); } return (string) $returnValue; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php index a095690..e80490b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBase.php @@ -2,16 +2,20 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; -class ConvertBase +abstract class ConvertBase { + use ArrayEnabled; + protected static function validateValue($value): string { if (is_bool($value)) { if (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $value = (int) $value; } @@ -33,13 +37,13 @@ protected static function validatePlaces($places = null): ?int if (is_numeric($places)) { if ($places < 0 || $places > 10) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return (int) $places; } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** @@ -57,7 +61,7 @@ protected static function nbrConversionFormat(string $value, ?int $places): stri return substr(str_pad($value, $places, '0', STR_PAD_LEFT), -10); } - return Functions::NAN(); + return ExcelError::NAN(); } return substr($value, -10); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php index a662b78..4741f30 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertBinary.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ConvertBinary extends ConvertBase { @@ -15,17 +15,26 @@ class ConvertBinary extends ConvertBase * Excel Function: * BIN2DEC(x) * - * @param string $value The binary number (as a string) that you want to convert. The number + * @param array|string $value The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. * Negative numbers are represented using two's-complement notation. * If number is not a valid binary number, or if number contains more than * 10 characters (10 bits), BIN2DEC returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toDecimal($value): string + public static function toDecimal($value) { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateBinary($value); } catch (Exception $e) { return $e->getMessage(); @@ -49,25 +58,35 @@ public static function toDecimal($value): string * Excel Function: * BIN2HEX(x[,places]) * - * @param string $value The binary number (as a string) that you want to convert. The number + * @param array|string $value The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. * Negative numbers are represented using two's-complement notation. * If number is not a valid binary number, or if number contains more than * 10 characters (10 bits), BIN2HEX returns the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, BIN2HEX uses the + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, BIN2HEX uses the * minimum number of characters necessary. Places is useful for padding the * return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, BIN2HEX returns the #VALUE! error value. * If places is negative, BIN2HEX returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toHex($value, $places = null): string + public static function toHex($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateBinary($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } @@ -92,25 +111,35 @@ public static function toHex($value, $places = null): string * Excel Function: * BIN2OCT(x[,places]) * - * @param string $value The binary number (as a string) that you want to convert. The number + * @param array|string $value The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant * bit of number is the sign bit. The remaining 9 bits are magnitude bits. * Negative numbers are represented using two's-complement notation. * If number is not a valid binary number, or if number contains more than * 10 characters (10 bits), BIN2OCT returns the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, BIN2OCT uses the + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, BIN2OCT uses the * minimum number of characters necessary. Places is useful for padding the * return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, BIN2OCT returns the #VALUE! error value. * If places is negative, BIN2OCT returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toOctal($value, $places = null): string + public static function toOctal($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateBinary($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } @@ -126,7 +155,7 @@ public static function toOctal($value, $places = null): string protected static function validateBinary(string $value): string { if ((strlen($value) > preg_match_all('/[01]/', $value)) || (strlen($value) > 10)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertDecimal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertDecimal.php index a34332f..9b59d39 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertDecimal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertDecimal.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ConvertDecimal extends ConvertBase { @@ -22,7 +22,7 @@ class ConvertDecimal extends ConvertBase * Excel Function: * DEC2BIN(x[,places]) * - * @param string $value The decimal integer you want to convert. If number is negative, + * @param array|string $value The decimal integer you want to convert. If number is negative, * valid place values are ignored and DEC2BIN returns a 10-character * (10-bit) binary number in which the most significant bit is the sign * bit. The remaining 9 bits are magnitude bits. Negative numbers are @@ -32,26 +32,36 @@ class ConvertDecimal extends ConvertBase * If number is nonnumeric, DEC2BIN returns the #VALUE! error value. * If DEC2BIN requires more than places characters, it returns the #NUM! * error value. - * @param int $places The number of characters to use. If places is omitted, DEC2BIN uses + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, DEC2BIN uses * the minimum number of characters necessary. Places is useful for * padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2BIN returns the #VALUE! error value. * If places is zero or negative, DEC2BIN returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toBinary($value, $places = null): string + public static function toBinary($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateDecimal($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } $value = (int) floor((float) $value); if ($value > self::LARGEST_BINARY_IN_DECIMAL || $value < self::SMALLEST_BINARY_IN_DECIMAL) { - return Functions::NAN(); + return ExcelError::NAN(); } $r = decbin($value); @@ -69,7 +79,7 @@ public static function toBinary($value, $places = null): string * Excel Function: * DEC2HEX(x[,places]) * - * @param string $value The decimal integer you want to convert. If number is negative, + * @param array|string $value The decimal integer you want to convert. If number is negative, * places is ignored and DEC2HEX returns a 10-character (40-bit) * hexadecimal number in which the most significant bit is the sign * bit. The remaining 39 bits are magnitude bits. Negative numbers @@ -79,26 +89,36 @@ public static function toBinary($value, $places = null): string * If number is nonnumeric, DEC2HEX returns the #VALUE! error value. * If DEC2HEX requires more than places characters, it returns the * #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, DEC2HEX uses + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, DEC2HEX uses * the minimum number of characters necessary. Places is useful for * padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2HEX returns the #VALUE! error value. * If places is zero or negative, DEC2HEX returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toHex($value, $places = null): string + public static function toHex($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateDecimal($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } $value = floor((float) $value); if ($value > self::LARGEST_HEX_IN_DECIMAL || $value < self::SMALLEST_HEX_IN_DECIMAL) { - return Functions::NAN(); + return ExcelError::NAN(); } $r = strtoupper(dechex((int) $value)); $r = self::hex32bit($value, $r); @@ -135,7 +155,7 @@ public static function hex32bit(float $value, string $hexstr, bool $force = fals * Excel Function: * DEC2OCT(x[,places]) * - * @param string $value The decimal integer you want to convert. If number is negative, + * @param array|string $value The decimal integer you want to convert. If number is negative, * places is ignored and DEC2OCT returns a 10-character (30-bit) * octal number in which the most significant bit is the sign bit. * The remaining 29 bits are magnitude bits. Negative numbers are @@ -145,26 +165,36 @@ public static function hex32bit(float $value, string $hexstr, bool $force = fals * If number is nonnumeric, DEC2OCT returns the #VALUE! error value. * If DEC2OCT requires more than places characters, it returns the * #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, DEC2OCT uses + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, DEC2OCT uses * the minimum number of characters necessary. Places is useful for * padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, DEC2OCT returns the #VALUE! error value. * If places is zero or negative, DEC2OCT returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toOctal($value, $places = null): string + public static function toOctal($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateDecimal($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } $value = (int) floor((float) $value); if ($value > self::LARGEST_OCTAL_IN_DECIMAL || $value < self::SMALLEST_OCTAL_IN_DECIMAL) { - return Functions::NAN(); + return ExcelError::NAN(); } $r = decoct($value); $r = substr($r, -10); @@ -175,7 +205,7 @@ public static function toOctal($value, $places = null): string protected static function validateDecimal(string $value): string { if (strlen($value) > preg_match_all('/[-0123456789.]/', $value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php index de1b070..55ce209 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertHex.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ConvertHex extends ConvertBase { @@ -15,7 +15,7 @@ class ConvertHex extends ConvertBase * Excel Function: * HEX2BIN(x[,places]) * - * @param string $value The hexadecimal number you want to convert. + * @param array|string $value The hexadecimal number you want to convert. * Number cannot contain more than 10 characters. * The most significant bit of number is the sign bit (40th bit from the right). * The remaining 9 bits are magnitude bits. @@ -25,19 +25,29 @@ class ConvertHex extends ConvertBase * and if number is positive, it cannot be greater than 1FF. * If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value. * If HEX2BIN requires more than places characters, it returns the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, * HEX2BIN uses the minimum number of characters necessary. Places * is useful for padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, HEX2BIN returns the #VALUE! error value. * If places is negative, HEX2BIN returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toBinary($value, $places = null): string + public static function toBinary($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateHex($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } @@ -55,25 +65,34 @@ public static function toBinary($value, $places = null): string * Excel Function: * HEX2DEC(x) * - * @param string $value The hexadecimal number you want to convert. This number cannot + * @param array|string $value The hexadecimal number you want to convert. This number cannot * contain more than 10 characters (40 bits). The most significant * bit of number is the sign bit. The remaining 39 bits are magnitude * bits. Negative numbers are represented using two's-complement * notation. * If number is not a valid hexadecimal number, HEX2DEC returns the * #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toDecimal($value): string + public static function toDecimal($value) { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateHex($value); } catch (Exception $e) { return $e->getMessage(); } if (strlen($value) > 10) { - return Functions::NAN(); + return ExcelError::NAN(); } $binX = ''; @@ -99,7 +118,7 @@ public static function toDecimal($value): string * Excel Function: * HEX2OCT(x[,places]) * - * @param string $value The hexadecimal number you want to convert. Number cannot + * @param array|string $value The hexadecimal number you want to convert. Number cannot * contain more than 10 characters. The most significant bit of * number is the sign bit. The remaining 39 bits are magnitude * bits. Negative numbers are represented using two's-complement @@ -112,20 +131,30 @@ public static function toDecimal($value): string * the #NUM! error value. * If HEX2OCT requires more than places characters, it returns * the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, HEX2OCT + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, HEX2OCT * uses the minimum number of characters necessary. Places is * useful for padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, HEX2OCT returns the #VALUE! error * value. * If places is negative, HEX2OCT returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toOctal($value, $places = null): string + public static function toOctal($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateHex($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } @@ -138,7 +167,7 @@ public static function toOctal($value, $places = null): string protected static function validateHex(string $value): string { if (strlen($value) > preg_match_all('/[0123456789ABCDEF]/', $value)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php index 1181e2e..add7aba 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertOctal.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ConvertOctal extends ConvertBase { @@ -15,7 +15,7 @@ class ConvertOctal extends ConvertBase * Excel Function: * OCT2BIN(x[,places]) * - * @param string $value The octal number you want to convert. Number may not + * @param array|string $value The octal number you want to convert. Number may not * contain more than 10 characters. The most significant * bit of number is the sign bit. The remaining 29 bits * are magnitude bits. Negative numbers are represented @@ -28,7 +28,8 @@ class ConvertOctal extends ConvertBase * the #NUM! error value. * If OCT2BIN requires more than places characters, it * returns the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, * OCT2BIN uses the minimum number of characters necessary. * Places is useful for padding the return value with * leading 0s (zeros). @@ -37,13 +38,22 @@ class ConvertOctal extends ConvertBase * error value. * If places is negative, OCT2BIN returns the #NUM! error * value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toBinary($value, $places = null): string + public static function toBinary($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateOctal($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } @@ -59,18 +69,27 @@ public static function toBinary($value, $places = null): string * Excel Function: * OCT2DEC(x) * - * @param string $value The octal number you want to convert. Number may not contain + * @param array|string $value The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant * bit of number is the sign bit. The remaining 29 bits are * magnitude bits. Negative numbers are represented using * two's-complement notation. * If number is not a valid octal number, OCT2DEC returns the * #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toDecimal($value): string + public static function toDecimal($value) { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateOctal($value); } catch (Exception $e) { return $e->getMessage(); @@ -99,7 +118,7 @@ public static function toDecimal($value): string * Excel Function: * OCT2HEX(x[,places]) * - * @param string $value The octal number you want to convert. Number may not contain + * @param array|string $value The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant * bit of number is the sign bit. The remaining 29 bits are * magnitude bits. Negative numbers are represented using @@ -110,25 +129,35 @@ public static function toDecimal($value): string * #NUM! error value. * If OCT2HEX requires more than places characters, it returns * the #NUM! error value. - * @param int $places The number of characters to use. If places is omitted, OCT2HEX + * Or can be an array of values + * @param array|int $places The number of characters to use. If places is omitted, OCT2HEX * uses the minimum number of characters necessary. Places is useful * for padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. * If places is negative, OCT2HEX returns the #NUM! error value. + * Or can be an array of values + * + * @return array|string Result, or an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ - public static function toHex($value, $places = null): string + public static function toHex($value, $places = null) { + if (is_array($value) || is_array($places)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); + } + try { - $value = self::validateValue(Functions::flattenSingleValue($value)); + $value = self::validateValue($value); $value = self::validateOctal($value); - $places = self::validatePlaces(Functions::flattenSingleValue($places)); + $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } $hexVal = strtoupper(dechex((int) self::toDecimal($value))); - $hexVal = (PHP_INT_SIZE === 4 && strlen($value) === 10 && $value[0] >= '4') ? "FF$hexVal" : $hexVal; + $hexVal = (PHP_INT_SIZE === 4 && strlen($value) === 10 && $value[0] >= '4') ? "FF{$hexVal}" : $hexVal; return self::nbrConversionFormat($hexVal, $places); } @@ -137,7 +166,7 @@ protected static function validateOctal(string $value): string { $numDigits = (int) preg_match_all('/[01234567]/', $value); if (strlen($value) > $numDigits || $numDigits > 10) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php index d169ae5..677fb0f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ConvertUOM { + use ArrayEnabled; + public const CATEGORY_WEIGHT_AND_MASS = 'Weight and Mass'; public const CATEGORY_DISTANCE = 'Distance'; public const CATEGORY_TIME = 'Time'; @@ -518,33 +521,39 @@ public static function getBinaryConversionMultipliers() * Excel Function: * CONVERT(value,fromUOM,toUOM) * - * @param float|int $value the value in fromUOM to convert - * @param string $fromUOM the units for value - * @param string $toUOM the units for the result + * @param array|float|int|string $value the value in fromUOM to convert + * Or can be an array of values + * @param array|string $fromUOM the units for value + * Or can be an array of values + * @param array|string $toUOM the units for the result + * Or can be an array of values * - * @return float|string + * @return array|float|string Result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function CONVERT($value, $fromUOM, $toUOM) { - $value = Functions::flattenSingleValue($value); - $fromUOM = Functions::flattenSingleValue($fromUOM); - $toUOM = Functions::flattenSingleValue($toUOM); + if (is_array($value) || is_array($fromUOM) || is_array($toUOM)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $fromUOM, $toUOM); + } if (!is_numeric($value)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } try { [$fromUOM, $fromCategory, $fromMultiplier] = self::getUOMDetails($fromUOM); [$toUOM, $toCategory, $toMultiplier] = self::getUOMDetails($toUOM); } catch (Exception $e) { - return Functions::NA(); + return ExcelError::NA(); } if ($fromCategory !== $toCategory) { - return Functions::NA(); + return ExcelError::NA(); } + // @var float $value $value *= $fromMultiplier; if (($fromUOM === $toUOM) && ($fromMultiplier === $toMultiplier)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/EngineeringValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/EngineeringValidations.php index 01630af..c0202ea 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/EngineeringValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/EngineeringValidations.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class EngineeringValidations { @@ -13,7 +13,7 @@ class EngineeringValidations public static function validateFloat($value): float { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (float) $value; @@ -25,7 +25,7 @@ public static function validateFloat($value): float public static function validateInt($value): int { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) floor((float) $value); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Erf.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Erf.php index db87ec0..6254d47 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Erf.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/Erf.php @@ -2,10 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Erf { + use ArrayEnabled; + private static $twoSqrtPi = 1.128379167095512574; /** @@ -22,15 +26,20 @@ class Erf * ERF(lower[,upper]) * * @param mixed $lower Lower bound float for integrating ERF + * Or can be an array of values * @param mixed $upper Upper bound float for integrating ERF. * If omitted, ERF integrates between zero and lower_limit + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function ERF($lower, $upper = null) { - $lower = Functions::flattenSingleValue($lower); - $upper = Functions::flattenSingleValue($upper); + if (is_array($lower) || is_array($upper)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $lower, $upper); + } if (is_numeric($lower)) { if ($upper === null) { @@ -41,7 +50,7 @@ public static function ERF($lower, $upper = null) } } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** @@ -53,12 +62,17 @@ public static function ERF($lower, $upper = null) * ERF.PRECISE(limit) * * @param mixed $limit Float bound for integrating ERF, other bound is zero + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function ERFPRECISE($limit) { - $limit = Functions::flattenSingleValue($limit); + if (is_array($limit)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $limit); + } return self::ERF($limit); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ErfC.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ErfC.php index c57a28f..7b023be 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ErfC.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ErfC.php @@ -2,10 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ErfC { + use ArrayEnabled; + /** * ERFC. * @@ -20,18 +24,23 @@ class ErfC * ERFC(x) * * @param mixed $value The float lower bound for integrating ERFC + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function ERFC($value) { - $value = Functions::flattenSingleValue($value); + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } if (is_numeric($value)) { return self::erfcValue($value); } - return Functions::VALUE(); + return ExcelError::VALUE(); } // @@ -45,7 +54,7 @@ private static function erfcValue($value) return 1 - Erf::erfValue($value); } if ($value < 0) { - return 2 - self::ERFC(-$value); + return 2 - self::erfcValue(-$value); } $a = $n = 1; $b = $c = $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php index 9d933b4..4215a51 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php @@ -587,10 +587,10 @@ public static function DISC($settlement, $maturity, $price, $redemption, $basis * @see Financial\Dollar::decimal() * Use the decimal() method in the Financial\Dollar class instead * - * @param float $fractional_dollar Fractional Dollar - * @param int $fraction Fraction + * @param array|float $fractional_dollar Fractional Dollar + * @param array|int $fraction Fraction * - * @return float|string + * @return array|float|string */ public static function DOLLARDE($fractional_dollar = null, $fraction = 0) { @@ -612,10 +612,10 @@ public static function DOLLARDE($fractional_dollar = null, $fraction = 0) * @see Financial\Dollar::fractional() * Use the fractional() method in the Financial\Dollar class instead * - * @param float $decimal_dollar Decimal Dollar - * @param int $fraction Fraction + * @param array|float $decimal_dollar Decimal Dollar + * @param array|int $fraction Fraction * - * @return float|string + * @return array|float|string */ public static function DOLLARFR($decimal_dollar = null, $fraction = 0) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Amortization.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Amortization.php index ba7fb52..691ba40 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Amortization.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Amortization.php @@ -70,10 +70,12 @@ public static function AMORDEGRC( return $e->getMessage(); } - $yearFrac = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis); - if (is_string($yearFrac)) { - return $yearFrac; + $yearFracx = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis); + if (is_string($yearFracx)) { + return $yearFracx; } + /** @var float */ + $yearFrac = $yearFracx; $amortiseCoeff = self::getAmortizationCoefficient($rate); @@ -161,14 +163,16 @@ public static function AMORLINC( $fCostDelta = $cost - $salvage; // Note, quirky variation for leap years on the YEARFRAC for this function $purchasedYear = DateTimeExcel\DateParts::year($purchased); - $yearFrac = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis); - if (is_string($yearFrac)) { - return $yearFrac; + $yearFracx = DateTimeExcel\YearFrac::fraction($purchased, $firstPeriod, $basis); + if (is_string($yearFracx)) { + return $yearFracx; } + /** @var float */ + $yearFrac = $yearFracx; if ( ($basis == FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL) && - ($yearFrac < 1) && (DateTimeExcel\Helpers::isLeapYear($purchasedYear)) + ($yearFrac < 1) && (Functions::scalar(DateTimeExcel\Helpers::isLeapYear($purchasedYear))) ) { $yearFrac *= 365 / 366; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php index e4c8a3a..8ebe9ed 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php @@ -5,7 +5,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Financial\FinancialValidations; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class CashFlowValidations extends FinancialValidations { @@ -29,7 +29,7 @@ public static function validatePeriodType($type): int $type !== FinancialConstants::PAYMENT_END_OF_PERIOD && $type !== FinancialConstants::PAYMENT_BEGINNING_OF_PERIOD ) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $rate; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic.php index e8a159c..a19c37f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\CashFlowValidations; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Periodic { @@ -94,7 +95,7 @@ public static function presentValue( // Validate parameters if ($numberOfPeriods < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculatePresentValue($rate, $numberOfPeriods, $payment, $futureValue, $type); @@ -138,7 +139,7 @@ public static function periods( // Validate parameters if ($payment == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculatePeriods($rate, $payment, $presentValue, $futureValue, $type); @@ -187,7 +188,7 @@ private static function calculatePeriods( ) { if ($rate != 0.0) { if ($presentValue == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return log(($payment * (1 + $rate * $type) / $rate - $futureValue) / diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Cumulative.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Cumulative.php index b7f6011..b7aaffd 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Cumulative.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Cumulative.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\CashFlowValidations; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Cumulative { @@ -57,7 +58,7 @@ public static function interest( // Validate parameters if ($start < 1 || $start > $end) { - return Functions::NAN(); + return ExcelError::NAN(); } // Calculate @@ -122,7 +123,7 @@ public static function principal( // Validate parameters if ($start < 1 || $start > $end) { - return Functions::VALUE(); + return ExcelError::VALUE(); } // Calculate diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php index 56d2e37..8041208 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Interest.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\CashFlowValidations; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Interest { @@ -59,7 +60,7 @@ public static function payment( // Validate parameters if ($period <= 0 || $period > $numberOfPeriods) { - return Functions::NAN(); + return ExcelError::NAN(); } // Calculate @@ -106,7 +107,7 @@ public static function schedulePayment($interestRate, $period, $numberOfPeriods, // Validate parameters if ($period <= 0 || $period > $numberOfPeriods) { - return Functions::NAN(); + return ExcelError::NAN(); } // Return value @@ -193,13 +194,13 @@ public static function rate( $rate = $rate1; } - return $close ? $rate : Functions::NAN(); + return $close ? $rate : ExcelError::NAN(); } private static function rateNextGuess($rate, $numberOfPeriods, $payment, $presentValue, $futureValue, $type) { if ($rate == 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } $tt1 = ($rate + 1) ** $numberOfPeriods; $tt2 = ($rate + 1) ** ($numberOfPeriods - 1); @@ -208,7 +209,7 @@ private static function rateNextGuess($rate, $numberOfPeriods, $payment, $presen * ($rate * $type + 1) / ($rate * $rate) + $numberOfPeriods * $payment * $tt2 * ($rate * $type + 1) / $rate + $payment * ($tt1 - 1) * $type / $rate; if ($denominator == 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return $numerator / $denominator; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Payments.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Payments.php index e103f92..83965f9 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Payments.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Constant/Periodic/Payments.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\CashFlowValidations; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Payments { @@ -97,7 +98,7 @@ public static function interestPayment( // Validate parameters if ($period <= 0 || $period > $numberOfPeriods) { - return Functions::NAN(); + return ExcelError::NAN(); } // Calculate diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Single.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Single.php index a30634d..058e89c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Single.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Single.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Single { @@ -67,7 +68,7 @@ public static function periods($rate, $presentValue, $futureValue) // Validate parameters if ($rate <= 0.0 || $presentValue <= 0.0 || $futureValue <= 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (log($futureValue) - log($presentValue)) / log(1 + $rate); @@ -100,7 +101,7 @@ public static function interestRate($periods = 0.0, $presentValue = 0.0, $future // Validate parameters if ($periods <= 0.0 || $presentValue <= 0.0 || $futureValue < 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return ($futureValue / $presentValue) ** (1 / $periods) - 1; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php index 8986146..b812613 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php @@ -5,6 +5,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class NonPeriodic { @@ -12,6 +13,8 @@ class NonPeriodic const FINANCIAL_PRECISION = 1.0e-08; + const DEFAULT_GUESS = 0.1; + /** * XIRR. * @@ -25,11 +28,11 @@ class NonPeriodic * @param mixed[] $dates A series of payment dates * The first payment date indicates the beginning of the schedule of payments * All other dates must be later than this date, but they may occur in any order - * @param float $guess An optional guess at the expected answer + * @param mixed $guess An optional guess at the expected answer * * @return float|string */ - public static function rate($values, $dates, $guess = 0.1) + public static function rate($values, $dates, $guess = self::DEFAULT_GUESS) { $rslt = self::xirrPart1($values, $dates); if ($rslt !== '') { @@ -37,9 +40,13 @@ public static function rate($values, $dates, $guess = 0.1) } // create an initial range, with a root somewhere between 0 and guess - $guess = Functions::flattenSingleValue($guess); + $guess = Functions::flattenSingleValue($guess) ?? self::DEFAULT_GUESS; + if (!is_numeric($guess)) { + return ExcelError::VALUE(); + } + $guess = ($guess + 0.0) ?: self::DEFAULT_GUESS; $x1 = 0.0; - $x2 = $guess ?: 0.1; + $x2 = $guess + 0.0; $f1 = self::xnpvOrdered($x1, $values, $dates, false); $f2 = self::xnpvOrdered($x2, $values, $dates, false); $found = false; @@ -54,13 +61,15 @@ public static function rate($values, $dates, $guess = 0.1) break; } elseif (abs($f1) < abs($f2)) { - $f1 = self::xnpvOrdered($x1 += 1.6 * ($x1 - $x2), $values, $dates, false); + $x1 += 1.6 * ($x1 - $x2); + $f1 = self::xnpvOrdered($x1, $values, $dates, false); } else { - $f2 = self::xnpvOrdered($x2 += 1.6 * ($x2 - $x1), $values, $dates, false); + $x2 += 1.6 * ($x2 - $x1); + $f2 = self::xnpvOrdered($x2, $values, $dates, false); } } if (!$found) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::xirrPart3($values, $dates, $x1, $x2); @@ -104,13 +113,15 @@ private static function bothNegAndPos(bool $neg, bool $pos): bool */ private static function xirrPart1(&$values, &$dates): string { - if (!is_array($values) && !is_array($dates)) { - return Functions::NA(); - } $values = Functions::flattenArray($values); $dates = Functions::flattenArray($dates); + $valuesIsArray = count($values) > 1; + $datesIsArray = count($dates) > 1; + if (!$valuesIsArray && !$datesIsArray) { + return ExcelError::NA(); + } if (count($values) != count($dates)) { - return Functions::NAN(); + return ExcelError::NAN(); } $datesCount = count($dates); @@ -133,7 +144,7 @@ private static function xirrPart2(array &$values): string for ($i = 0; $i < $valCount; ++$i) { $fld = $values[$i]; if (!is_numeric($fld)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } elseif ($fld > 0) { $foundpos = true; } elseif ($fld < 0) { @@ -141,7 +152,7 @@ private static function xirrPart2(array &$values): string } } if (!self::bothNegAndPos($foundneg, $foundpos)) { - return Functions::NAN(); + return ExcelError::NAN(); } return ''; @@ -161,7 +172,7 @@ private static function xirrPart3(array $values, array $dates, float $x1, float $dx = $x1 - $x2; } - $rslt = Functions::VALUE(); + $rslt = ExcelError::VALUE(); for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { $dx *= 0.5; $x_mid = $rtb + $dx; @@ -203,7 +214,7 @@ private static function xnpvOrdered($rate, $values, $dates, bool $ordered = true $xnpv = 0.0; for ($i = 0; $i < $valCount; ++$i) { if (!is_numeric($values[$i])) { - return Functions::VALUE(); + return ExcelError::VALUE(); } try { @@ -212,17 +223,21 @@ private static function xnpvOrdered($rate, $values, $dates, bool $ordered = true return $e->getMessage(); } if ($date0 > $datei) { - $dif = $ordered ? Functions::NAN() : -((int) DateTimeExcel\Difference::interval($datei, $date0, 'd')); + $dif = $ordered ? ExcelError::NAN() : -((int) DateTimeExcel\Difference::interval($datei, $date0, 'd')); } else { $dif = DateTimeExcel\Difference::interval($date0, $datei, 'd'); } if (!is_numeric($dif)) { return $dif; } - $xnpv += $values[$i] / (1 + $rate) ** ($dif / 365); + if ($rate <= -1.0) { + $xnpv += -abs($values[$i]) / (-1 - $rate) ** ($dif / 365); + } else { + $xnpv += $values[$i] / (1 + $rate) ** ($dif / 365); + } } - return is_finite($xnpv) ? $xnpv : Functions::VALUE(); + return is_finite($xnpv) ? $xnpv : ExcelError::VALUE(); } /** @@ -231,14 +246,14 @@ private static function xnpvOrdered($rate, $values, $dates, bool $ordered = true private static function validateXnpv($rate, array $values, array $dates): void { if (!is_numeric($rate)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $valCount = count($values); if ($valCount != count($dates)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } if ($valCount > 1 && ((min($values) > 0) || (max($values) < 0))) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php index c42df0c..49d063c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/Periodic.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Periodic { @@ -33,7 +34,7 @@ class Periodic public static function rate($values, $guess = 0.1) { if (!is_array($values)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $values = Functions::flattenArray($values); $guess = Functions::flattenSingleValue($guess); @@ -54,7 +55,7 @@ public static function rate($values, $guess = 0.1) } } if (($f1 * $f2) > 0.0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $f = self::presentValue($x1, $values); @@ -78,7 +79,7 @@ public static function rate($values, $guess = 0.1) } } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** @@ -101,7 +102,7 @@ public static function rate($values, $guess = 0.1) public static function modifiedRate($values, $financeRate, $reinvestmentRate) { if (!is_array($values)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $values = Functions::flattenArray($values); $financeRate = Functions::flattenSingleValue($financeRate); @@ -121,13 +122,13 @@ public static function modifiedRate($values, $financeRate, $reinvestmentRate) } if (($npvNeg === 0.0) || ($npvPos === 0.0) || ($reinvestmentRate <= -1.0)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $mirr = ((-$npvPos * $rr ** $n) / ($npvNeg * ($rr))) ** (1.0 / ($n - 1)) - 1.0; - return is_finite($mirr) ? $mirr : Functions::VALUE(); + return is_finite($mirr) ? $mirr : ExcelError::VALUE(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Coupons.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Coupons.php index 3fd6c1d..6138075 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Coupons.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Coupons.php @@ -7,6 +7,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Date; class Coupons @@ -64,9 +65,9 @@ public static function COUPDAYBS( return $e->getMessage(); } - $daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis); + $daysPerYear = Helpers::daysPerYear(Functions::scalar(DateTimeExcel\DateParts::year($settlement)), $basis); if (is_string($daysPerYear)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_PREVIOUS); @@ -134,7 +135,7 @@ public static function COUPDAYS( case FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL: // Actual/actual if ($frequency == FinancialConstants::FREQUENCY_ANNUAL) { - $daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis); + $daysPerYear = (int) Helpers::daysPerYear(Functions::scalar(DateTimeExcel\DateParts::year($settlement)), $basis); return $daysPerYear / $frequency; } @@ -198,6 +199,7 @@ public static function COUPDAYSNC( return $e->getMessage(); } + /** @var int */ $daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis); $next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_NEXT); @@ -409,7 +411,7 @@ private static function couponFirstPeriodDate(float $settlement, float $maturity private static function validateCouponPeriod(float $settlement, float $maturity): void { if ($settlement >= $maturity) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Depreciation.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Depreciation.php index 650a486..3d72757 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Depreciation.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Depreciation.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Depreciation { @@ -117,7 +118,7 @@ public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) } if ($period > $life) { - return Functions::NAN(); + return ExcelError::NAN(); } // Loop through each period calculating the depreciation @@ -161,7 +162,7 @@ public static function SLN($cost, $salvage, $life) } if ($life === 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } return ($cost - $salvage) / $life; @@ -196,7 +197,7 @@ public static function SYD($cost, $salvage, $life, $period) } if ($period > $life) { - return Functions::NAN(); + return ExcelError::NAN(); } $syd = (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1)); @@ -208,7 +209,7 @@ private static function validateCost($cost, bool $negativeValueAllowed = false): { $cost = FinancialValidations::validateFloat($cost); if ($cost < 0.0 && $negativeValueAllowed === false) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $cost; @@ -218,7 +219,7 @@ private static function validateSalvage($salvage, bool $negativeValueAllowed = f { $salvage = FinancialValidations::validateFloat($salvage); if ($salvage < 0.0 && $negativeValueAllowed === false) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $salvage; @@ -228,7 +229,7 @@ private static function validateLife($life, bool $negativeValueAllowed = false): { $life = FinancialValidations::validateFloat($life); if ($life < 0.0 && $negativeValueAllowed === false) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $life; @@ -238,7 +239,7 @@ private static function validatePeriod($period, bool $negativeValueAllowed = fal { $period = FinancialValidations::validateFloat($period); if ($period <= 0.0 && $negativeValueAllowed === false) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $period; @@ -248,7 +249,7 @@ private static function validateMonth($month): int { $month = FinancialValidations::validateInt($month); if ($month < 1) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $month; @@ -258,7 +259,7 @@ private static function validateFactor($factor): float { $factor = FinancialValidations::validateFloat($factor); if ($factor <= 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $factor; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Dollar.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Dollar.php index 7bebb39..b1f0d25 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Dollar.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Dollar.php @@ -2,23 +2,34 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Financial; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; +use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\TextData\Format; class Dollar { + use ArrayEnabled; + /** * DOLLAR. * * This function converts a number to text using currency format, with the decimals rounded to the specified place. * The format used is $#,##0.00_);($#,##0.00).. * - * @param mixed $number The value to format + * @param mixed $number The value to format, or can be an array of numbers + * Or can be an array of values * @param mixed $precision The number of digits to display to the right of the decimal point (as an integer). * If precision is negative, number is rounded to the left of the decimal point. * If you omit precision, it is assumed to be 2 + * Or can be an array of precision values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function format($number, $precision = 2): string + public static function format($number, $precision = 2) { return Format::DOLLAR($number, $precision); } @@ -34,25 +45,37 @@ public static function format($number, $precision = 2): string * DOLLARDE(fractional_dollar,fraction) * * @param mixed $fractionalDollar Fractional Dollar + * Or can be an array of values * @param mixed $fraction Fraction + * Or can be an array of values * - * @return float|string + * @return array|float|string */ public static function decimal($fractionalDollar = null, $fraction = 0) { - $fractionalDollar = Functions::flattenSingleValue($fractionalDollar); - $fraction = (int) Functions::flattenSingleValue($fraction); + if (is_array($fractionalDollar) || is_array($fraction)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $fractionalDollar, $fraction); + } + + try { + $fractionalDollar = FinancialValidations::validateFloat( + Functions::flattenSingleValue($fractionalDollar) ?? 0.0 + ); + $fraction = FinancialValidations::validateInt(Functions::flattenSingleValue($fraction)); + } catch (Exception $e) { + return $e->getMessage(); + } - // Validate parameters - if ($fractionalDollar === null || $fraction < 0) { - return Functions::NAN(); + // Additional parameter validations + if ($fraction < 0) { + return ExcelError::NAN(); } if ($fraction == 0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } - $dollars = floor($fractionalDollar); - $cents = fmod($fractionalDollar, 1); + $dollars = ($fractionalDollar < 0) ? ceil($fractionalDollar) : floor($fractionalDollar); + $cents = fmod($fractionalDollar, 1.0); $cents /= $fraction; $cents *= 10 ** ceil(log10($fraction)); @@ -70,24 +93,36 @@ public static function decimal($fractionalDollar = null, $fraction = 0) * DOLLARFR(decimal_dollar,fraction) * * @param mixed $decimalDollar Decimal Dollar + * Or can be an array of values * @param mixed $fraction Fraction + * Or can be an array of values * - * @return float|string + * @return array|float|string */ public static function fractional($decimalDollar = null, $fraction = 0) { - $decimalDollar = Functions::flattenSingleValue($decimalDollar); - $fraction = (int) Functions::flattenSingleValue($fraction); + if (is_array($decimalDollar) || is_array($fraction)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $decimalDollar, $fraction); + } + + try { + $decimalDollar = FinancialValidations::validateFloat( + Functions::flattenSingleValue($decimalDollar) ?? 0.0 + ); + $fraction = FinancialValidations::validateInt(Functions::flattenSingleValue($fraction)); + } catch (Exception $e) { + return $e->getMessage(); + } - // Validate parameters - if ($decimalDollar === null || $fraction < 0) { - return Functions::NAN(); + // Additional parameter validations + if ($fraction < 0) { + return ExcelError::NAN(); } if ($fraction == 0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } - $dollars = floor($decimalDollar); + $dollars = ($decimalDollar < 0.0) ? ceil($decimalDollar) : floor($decimalDollar); $cents = fmod($decimalDollar, 1); $cents *= $fraction; $cents *= 10 ** (-ceil(log10($fraction))); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/FinancialValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/FinancialValidations.php index 310e005..1b04419 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/FinancialValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/FinancialValidations.php @@ -5,7 +5,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class FinancialValidations { @@ -39,7 +39,7 @@ public static function validateMaturityDate($maturity): float public static function validateFloat($value): float { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (float) $value; @@ -51,7 +51,7 @@ public static function validateFloat($value): float public static function validateInt($value): int { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) floor((float) $value); @@ -64,7 +64,7 @@ public static function validateRate($rate): float { $rate = self::validateFloat($rate); if ($rate < 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $rate; @@ -81,7 +81,7 @@ public static function validateFrequency($frequency): int ($frequency !== FinancialConstants::FREQUENCY_SEMI_ANNUAL) && ($frequency !== FinancialConstants::FREQUENCY_QUARTERLY) ) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $frequency; @@ -93,12 +93,12 @@ public static function validateFrequency($frequency): int public static function validateBasis($basis): int { if (!is_numeric($basis)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $basis = (int) $basis; if (($basis < 0) || ($basis > 4)) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $basis; @@ -111,7 +111,7 @@ public static function validatePrice($price): float { $price = self::validateFloat($price); if ($price < 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $price; @@ -124,7 +124,7 @@ public static function validateParValue($parValue): float { $parValue = self::validateFloat($parValue); if ($parValue < 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $parValue; @@ -137,7 +137,7 @@ public static function validateYield($yield): float { $yield = self::validateFloat($yield); if ($yield < 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $yield; @@ -150,7 +150,7 @@ public static function validateDiscount($discount): float { $discount = self::validateFloat($discount); if ($discount <= 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $discount; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Helpers.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Helpers.php index d339b13..c7f1f46 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Helpers.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Helpers.php @@ -5,7 +5,7 @@ use DateTimeInterface; use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Helpers { @@ -27,7 +27,7 @@ class Helpers public static function daysPerYear($year, $basis = 0) { if (!is_numeric($basis)) { - return Functions::NAN(); + return ExcelError::NAN(); } switch ($basis) { @@ -41,7 +41,7 @@ public static function daysPerYear($year, $basis = 0) return (DateTimeExcel\Helpers::isLeapYear($year)) ? 366 : 365; } - return Functions::NAN(); + return ExcelError::NAN(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/InterestRate.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/InterestRate.php index 72df31e..1cbe265 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/InterestRate.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/InterestRate.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class InterestRate { @@ -34,7 +35,7 @@ public static function effective($nominalRate = 0, $periodsPerYear = 0) } if ($nominalRate <= 0 || $periodsPerYear < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } return ((1 + $nominalRate / $periodsPerYear) ** $periodsPerYear) - 1; @@ -63,7 +64,7 @@ public static function nominal($effectiveRate = 0, $periodsPerYear = 0) } if ($effectiveRate <= 0 || $periodsPerYear < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } // Calculate diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/AccruedInterest.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/AccruedInterest.php index e167429..95996b4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/AccruedInterest.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/AccruedInterest.php @@ -78,12 +78,12 @@ public static function periodic( return $e->getMessage(); } - $daysBetweenIssueAndSettlement = YearFrac::fraction($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Functions::scalar(YearFrac::fraction($issue, $settlement, $basis)); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } - $daysBetweenFirstInterestAndSettlement = YearFrac::fraction($firstInterest, $settlement, $basis); + $daysBetweenFirstInterestAndSettlement = Functions::scalar(YearFrac::fraction($firstInterest, $settlement, $basis)); if (!is_numeric($daysBetweenFirstInterestAndSettlement)) { // return date error return $daysBetweenFirstInterestAndSettlement; @@ -140,7 +140,7 @@ public static function atMaturity( return $e->getMessage(); } - $daysBetweenIssueAndSettlement = YearFrac::fraction($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Functions::scalar(YearFrac::fraction($issue, $settlement, $basis)); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php index 7d8d5a3..de1748a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Price.php @@ -8,6 +8,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Helpers; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Price { @@ -134,7 +135,7 @@ public static function priceDiscounted( return $e->getMessage(); } - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -194,23 +195,23 @@ public static function priceAtMaturity( return $e->getMessage(); } - $daysPerYear = Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis); + $daysPerYear = Functions::scalar(Helpers::daysPerYear(DateTimeExcel\DateParts::year($settlement), $basis)); if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Functions::scalar(DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis)); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } $daysBetweenIssueAndSettlement *= $daysPerYear; - $daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis); + $daysBetweenIssueAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis)); if (!is_numeric($daysBetweenIssueAndMaturity)) { // return date error return $daysBetweenIssueAndMaturity; } $daysBetweenIssueAndMaturity *= $daysPerYear; - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -270,7 +271,7 @@ public static function received( } if ($investment <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); if (!is_numeric($daysBetweenSettlementAndMaturity)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Rates.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Rates.php index c5c5211..f8d8673 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Rates.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Rates.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Rates { @@ -60,10 +61,10 @@ public static function discount( } if ($price <= 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -123,10 +124,10 @@ public static function interest( } if ($investment <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/SecurityValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/SecurityValidations.php index 497197b..d3196f0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/SecurityValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/SecurityValidations.php @@ -4,7 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\FinancialValidations; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class SecurityValidations extends FinancialValidations { @@ -23,7 +23,7 @@ public static function validateIssueDate($issue): float public static function validateSecurityPeriod($settlement, $maturity): void { if ($settlement >= $maturity) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } } @@ -34,7 +34,7 @@ public static function validateRedemption($redemption): float { $redemption = self::validateFloat($redemption); if ($redemption <= 0.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $redemption; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Yields.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Yields.php index aa62693..bb2e8ae 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Yields.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/Securities/Yields.php @@ -61,7 +61,7 @@ public static function yieldDiscounted( if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; @@ -126,19 +126,19 @@ public static function yieldAtMaturity( if (!is_numeric($daysPerYear)) { return $daysPerYear; } - $daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis); + $daysBetweenIssueAndSettlement = Functions::scalar(DateTimeExcel\YearFrac::fraction($issue, $settlement, $basis)); if (!is_numeric($daysBetweenIssueAndSettlement)) { // return date error return $daysBetweenIssueAndSettlement; } $daysBetweenIssueAndSettlement *= $daysPerYear; - $daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis); + $daysBetweenIssueAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($issue, $maturity, $basis)); if (!is_numeric($daysBetweenIssueAndMaturity)) { // return date error return $daysBetweenIssueAndMaturity; } $daysBetweenIssueAndMaturity *= $daysPerYear; - $daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis); + $daysBetweenSettlementAndMaturity = Functions::scalar(DateTimeExcel\YearFrac::fraction($settlement, $maturity, $basis)); if (!is_numeric($daysBetweenSettlementAndMaturity)) { // return date error return $daysBetweenSettlementAndMaturity; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/TreasuryBill.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/TreasuryBill.php index c60af0b..7ee34f7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/TreasuryBill.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial/TreasuryBill.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class TreasuryBill { @@ -38,17 +39,17 @@ public static function bondEquivalentYield($settlement, $maturity, $discount) } if ($discount <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $daysBetweenSettlementAndMaturity = $maturity - $settlement; $daysPerYear = Helpers::daysPerYear( - DateTimeExcel\DateParts::year($maturity), + Functions::scalar(DateTimeExcel\DateParts::year($maturity)), FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL ); if ($daysBetweenSettlementAndMaturity > $daysPerYear || $daysBetweenSettlementAndMaturity < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity); @@ -83,22 +84,22 @@ public static function price($settlement, $maturity, $discount) } if ($discount <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $daysBetweenSettlementAndMaturity = $maturity - $settlement; $daysPerYear = Helpers::daysPerYear( - DateTimeExcel\DateParts::year($maturity), + Functions::scalar(DateTimeExcel\DateParts::year($maturity)), FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL ); if ($daysBetweenSettlementAndMaturity > $daysPerYear || $daysBetweenSettlementAndMaturity < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360)); if ($price < 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return $price; @@ -134,12 +135,12 @@ public static function yield($settlement, $maturity, $price) $daysBetweenSettlementAndMaturity = $maturity - $settlement; $daysPerYear = Helpers::daysPerYear( - DateTimeExcel\DateParts::year($maturity), + Functions::scalar(DateTimeExcel\DateParts::year($maturity)), FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL ); if ($daysBetweenSettlementAndMaturity > $daysPerYear || $daysBetweenSettlementAndMaturity < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php index 75d4582..dc6ee82 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php @@ -4,7 +4,6 @@ use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Shared\Date; -use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class Functions { @@ -41,30 +40,14 @@ class Functions */ protected static $returnDateType = self::RETURNDATE_EXCEL; - /** - * List of error codes. - * - * @var array - */ - protected static $errorCodes = [ - 'null' => '#NULL!', - 'divisionbyzero' => '#DIV/0!', - 'value' => '#VALUE!', - 'reference' => '#REF!', - 'name' => '#NAME?', - 'num' => '#NUM!', - 'na' => '#N/A', - 'gettingdata' => '#GETTING_DATA', - ]; - /** * Set the Compatibility Mode. * * @param string $compatibilityMode Compatibility Mode - * Permitted values are: - * Functions::COMPATIBILITY_EXCEL 'Excel' - * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' - * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * Permitted values are: + * Functions::COMPATIBILITY_EXCEL 'Excel' + * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' * * @return bool (Success or Failure) */ @@ -87,10 +70,10 @@ public static function setCompatibilityMode($compatibilityMode) * Return the current Compatibility Mode. * * @return string Compatibility Mode - * Possible Return values are: - * Functions::COMPATIBILITY_EXCEL 'Excel' - * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' - * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * Possible Return values are: + * Functions::COMPATIBILITY_EXCEL 'Excel' + * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' */ public static function getCompatibilityMode() { @@ -98,13 +81,13 @@ public static function getCompatibilityMode() } /** - * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). + * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP DateTime Object). * * @param string $returnDateType Return Date Format - * Permitted values are: - * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' - * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' - * Functions::RETURNDATE_EXCEL 'E' + * Permitted values are: + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' + * Functions::RETURNDATE_EXCEL 'E' * * @return bool Success or failure */ @@ -127,10 +110,10 @@ public static function setReturnDateType($returnDateType) * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). * * @return string Return Date Format - * Possible Return values are: - * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' - * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' - * Functions::RETURNDATE_EXCEL 'E' + * Possible Return values are: + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' + * Functions::RETURNDATE_EXCEL ' 'E' */ public static function getReturnDateType() { @@ -147,92 +130,6 @@ public static function DUMMY() return '#Not Yet Implemented'; } - /** - * DIV0. - * - * @return string #Not Yet Implemented - */ - public static function DIV0() - { - return self::$errorCodes['divisionbyzero']; - } - - /** - * NA. - * - * Excel Function: - * =NA() - * - * Returns the error value #N/A - * #N/A is the error value that means "no value is available." - * - * @return string #N/A! - */ - public static function NA() - { - return self::$errorCodes['na']; - } - - /** - * NaN. - * - * Returns the error value #NUM! - * - * @return string #NUM! - */ - public static function NAN() - { - return self::$errorCodes['num']; - } - - /** - * NAME. - * - * Returns the error value #NAME? - * - * @return string #NAME? - */ - public static function NAME() - { - return self::$errorCodes['name']; - } - - /** - * REF. - * - * Returns the error value #REF! - * - * @return string #REF! - */ - public static function REF() - { - return self::$errorCodes['reference']; - } - - /** - * NULL. - * - * Returns the error value #NULL! - * - * @return string #NULL! - */ - public static function null() - { - return self::$errorCodes['null']; - } - - /** - * VALUE. - * - * Returns the error value #VALUE! - * - * @return string #VALUE! - */ - public static function VALUE() - { - return self::$errorCodes['value']; - } - public static function isMatrixValue($idx) { return (substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0); @@ -240,7 +137,7 @@ public static function isMatrixValue($idx) public static function isValue($idx) { - return substr_count($idx, '.') == 0; + return substr_count($idx, '.') === 0; } public static function isCellValue($idx) @@ -260,6 +157,10 @@ public static function ifCondition($condition) if (is_bool($condition)) { return '=' . ($condition ? 'TRUE' : 'FALSE'); } elseif (!is_numeric($condition)) { + if ($condition !== '""') { // Not an empty string + // Escape any quotes in the string value + $condition = preg_replace('/"/ui', '""', $condition); + } $condition = Calculation::wrapResult(strtoupper($condition)); } @@ -300,26 +201,142 @@ private static function operandSpecialHandling($operand) return $operand; } + /** + * NULL. + * + * Returns the error value #NULL! + * + * @Deprecated 1.23.0 + * + * @return string #NULL! + * + *@see Information\ExcelError::null() + * Use the null() method in the Information\Error class instead + */ + public static function null() + { + return Information\ExcelError::null(); + } + + /** + * NaN. + * + * Returns the error value #NUM! + * + * @Deprecated 1.23.0 + * + * @return string #NUM! + * + * @see Information\ExcelError::NAN() + * Use the NAN() method in the Information\Error class instead + */ + public static function NAN() + { + return Information\ExcelError::NAN(); + } + + /** + * REF. + * + * Returns the error value #REF! + * + * @Deprecated 1.23.0 + * + * @return string #REF! + * + * @see Information\ExcelError::REF() + * Use the REF() method in the Information\Error class instead + */ + public static function REF() + { + return Information\ExcelError::REF(); + } + + /** + * NA. + * + * Excel Function: + * =NA() + * + * Returns the error value #N/A + * #N/A is the error value that means "no value is available." + * + * @Deprecated 1.23.0 + * + * @return string #N/A! + * + * @see Information\ExcelError::NA() + * Use the NA() method in the Information\Error class instead + */ + public static function NA() + { + return Information\ExcelError::NA(); + } + + /** + * VALUE. + * + * Returns the error value #VALUE! + * + * @Deprecated 1.23.0 + * + * @return string #VALUE! + * + * @see Information\ExcelError::VALUE() + * Use the VALUE() method in the Information\Error class instead + */ + public static function VALUE() + { + return Information\ExcelError::VALUE(); + } + + /** + * NAME. + * + * Returns the error value #NAME? + * + * @Deprecated 1.23.0 + * + * @return string #NAME? + * + * @see Information\ExcelError::NAME() + * Use the NAME() method in the Information\Error class instead + */ + public static function NAME() + { + return Information\ExcelError::NAME(); + } + + /** + * DIV0. + * + * @Deprecated 1.23.0 + * + * @return string #Not Yet Implemented + * + *@see Information\ExcelError::DIV0() + * Use the DIV0() method in the Information\Error class instead + */ + public static function DIV0() + { + return Information\ExcelError::DIV0(); + } + /** * ERROR_TYPE. * * @param mixed $value Value to check * - * @return int|string + * @Deprecated 1.23.0 + * + * @return array|int|string + * + * @see Information\ExcelError::type() + * Use the type() method in the Information\Error class instead */ public static function errorType($value = '') { - $value = self::flattenSingleValue($value); - - $i = 1; - foreach (self::$errorCodes as $errorCode) { - if ($value === $errorCode) { - return $i; - } - ++$i; - } - - return self::NA(); + return Information\ExcelError::type($value); } /** @@ -327,15 +344,16 @@ public static function errorType($value = '') * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isBlank() + * Use the isBlank() method in the Information\Value class instead + * + * @return array|bool */ public static function isBlank($value = null) { - if ($value !== null) { - $value = self::flattenSingleValue($value); - } - - return $value === null; + return Information\Value::isBlank($value); } /** @@ -343,13 +361,16 @@ public static function isBlank($value = null) * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isErr() + * Use the isErr() method in the Information\Value class instead + * + * @return array|bool */ public static function isErr($value = '') { - $value = self::flattenSingleValue($value); - - return self::isError($value) && (!self::isNa(($value))); + return Information\ErrorValue::isErr($value); } /** @@ -357,17 +378,16 @@ public static function isErr($value = '') * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isError() + * Use the isError() method in the Information\Value class instead + * + * @return array|bool */ public static function isError($value = '') { - $value = self::flattenSingleValue($value); - - if (!is_string($value)) { - return false; - } - - return in_array($value, self::$errorCodes); + return Information\ErrorValue::isError($value); } /** @@ -375,13 +395,16 @@ public static function isError($value = '') * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isNa() + * Use the isNa() method in the Information\Value class instead + * + * @return array|bool */ public static function isNa($value = '') { - $value = self::flattenSingleValue($value); - - return $value === self::NA(); + return Information\ErrorValue::isNa($value); } /** @@ -389,19 +412,16 @@ public static function isNa($value = '') * * @param mixed $value Value to check * - * @return bool|string + * @Deprecated 1.23.0 + * + * @see Information\Value::isEven() + * Use the isEven() method in the Information\Value class instead + * + * @return array|bool|string */ public static function isEven($value = null) { - $value = self::flattenSingleValue($value); - - if ($value === null) { - return self::NAME(); - } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { - return self::VALUE(); - } - - return $value % 2 == 0; + return Information\Value::isEven($value); } /** @@ -409,19 +429,16 @@ public static function isEven($value = null) * * @param mixed $value Value to check * - * @return bool|string + * @Deprecated 1.23.0 + * + * @see Information\Value::isOdd() + * Use the isOdd() method in the Information\Value class instead + * + * @return array|bool|string */ public static function isOdd($value = null) { - $value = self::flattenSingleValue($value); - - if ($value === null) { - return self::NAME(); - } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { - return self::VALUE(); - } - - return abs($value) % 2 == 1; + return Information\Value::isOdd($value); } /** @@ -429,17 +446,16 @@ public static function isOdd($value = null) * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isNumber() + * Use the isNumber() method in the Information\Value class instead + * + * @return array|bool */ public static function isNumber($value = null) { - $value = self::flattenSingleValue($value); - - if (is_string($value)) { - return false; - } - - return is_numeric($value); + return Information\Value::isNumber($value); } /** @@ -447,13 +463,16 @@ public static function isNumber($value = null) * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isLogical() + * Use the isLogical() method in the Information\Value class instead + * + * @return array|bool */ public static function isLogical($value = null) { - $value = self::flattenSingleValue($value); - - return is_bool($value); + return Information\Value::isLogical($value); } /** @@ -461,13 +480,16 @@ public static function isLogical($value = null) * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isText() + * Use the isText() method in the Information\Value class instead + * + * @return array|bool */ public static function isText($value = null) { - $value = self::flattenSingleValue($value); - - return is_string($value) && !self::isError($value); + return Information\Value::isText($value); } /** @@ -475,11 +497,16 @@ public static function isText($value = null) * * @param mixed $value Value to check * - * @return bool + * @Deprecated 1.23.0 + * + * @see Information\Value::isNonText() + * Use the isNonText() method in the Information\Value class instead + * + * @return array|bool */ public static function isNonText($value = null) { - return !self::isText($value); + return Information\Value::isNonText($value); } /** @@ -487,9 +514,14 @@ public static function isNonText($value = null) * * Returns a value converted to a number * + * @Deprecated 1.23.0 + * + * @see Information\Value::asNumber() + * Use the asNumber() method in the Information\Value class instead + * * @param null|mixed $value The value you want converted * - * @return number N converts values listed in the following table + * @return number|string N converts values listed in the following table * If value is or refers to N returns * A number That number * A date The serial number of that date @@ -500,27 +532,7 @@ public static function isNonText($value = null) */ public static function n($value = null) { - while (is_array($value)) { - $value = array_shift($value); - } - - switch (gettype($value)) { - case 'double': - case 'float': - case 'integer': - return $value; - case 'boolean': - return (int) $value; - case 'string': - // Errors - if ((strlen($value) > 0) && ($value[0] == '#')) { - return $value; - } - - break; - } - - return 0; + return Information\Value::asNumber($value); } /** @@ -528,6 +540,11 @@ public static function n($value = null) * * Returns a number that identifies the type of a value * + * @Deprecated 1.23.0 + * + * @see Information\Value::type() + * Use the type() method in the Information\Value class instead + * * @param null|mixed $value The value you want tested * * @return number N converts values listed in the following table @@ -540,39 +557,7 @@ public static function n($value = null) */ public static function TYPE($value = null) { - $value = self::flattenArrayIndexed($value); - if (is_array($value) && (count($value) > 1)) { - end($value); - $a = key($value); - // Range of cells is an error - if (self::isCellValue($a)) { - return 16; - // Test for Matrix - } elseif (self::isMatrixValue($a)) { - return 64; - } - } elseif (empty($value)) { - // Empty Cell - return 1; - } - $value = self::flattenSingleValue($value); - - if (($value === null) || (is_float($value)) || (is_int($value))) { - return 1; - } elseif (is_bool($value)) { - return 4; - } elseif (is_array($value)) { - return 64; - } elseif (is_string($value)) { - // Errors - if ((strlen($value) > 0) && ($value[0] == '#')) { - return 16; - } - - return 2; - } - - return 0; + return Information\Value::type($value); } /** @@ -608,6 +593,24 @@ public static function flattenArray($array) return $arrayValues; } + /** + * @param mixed $value + * + * @return null|mixed + */ + public static function scalar($value) + { + if (!is_array($value)) { + return $value; + } + + do { + $value = array_pop($value); + } while (is_array($value)); + + return $value; + } + /** * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing. * @@ -660,29 +663,19 @@ public static function flattenSingleValue($value = '') /** * ISFORMULA. * + * @Deprecated 1.23.0 + * + * @see Information\Value::isFormula() + * Use the isFormula() method in the Information\Value class instead + * * @param mixed $cellReference The cell to check * @param ?Cell $cell The current cell (containing this formula) * - * @return bool|string + * @return array|bool|string */ public static function isFormula($cellReference = '', ?Cell $cell = null) { - if ($cell === null) { - return self::REF(); - } - $cellReference = self::expandDefinedName((string) $cellReference, $cell); - $cellReference = self::trimTrailingRange($cellReference); - - preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches); - - $cellReference = $matches[6] . $matches[7]; - $worksheetName = str_replace("''", "'", trim($matches[2], "'")); - - $worksheet = (!empty($worksheetName)) - ? $cell->getWorksheet()->getParent()->getSheetByName($worksheetName) - : $cell->getWorksheet(); - - return $worksheet->getCell($cellReference)->isFormula(); + return Information\Value::isFormula($cellReference, $cell); } public static function expandDefinedName(string $coordinate, Cell $cell): string @@ -692,12 +685,13 @@ public static function expandDefinedName(string $coordinate, Cell $cell): string // Uppercase coordinate $pCoordinatex = strtoupper($coordinate); // Eliminate leading equal sign - $pCoordinatex = Worksheet::pregReplace('/^=/', '', $pCoordinatex); + $pCoordinatex = (string) preg_replace('/^=/', '', $pCoordinatex); $defined = $spreadsheet->getDefinedName($pCoordinatex, $worksheet); if ($defined !== null) { $worksheet2 = $defined->getWorkSheet(); if (!$defined->isFormula() && $worksheet2 !== null) { - $coordinate = "'" . $worksheet2->getTitle() . "'!" . Worksheet::pregReplace('/^=/', '', $defined->getValue()); + $coordinate = "'" . $worksheet2->getTitle() . "'!" . + (string) preg_replace('/^=/', '', $defined->getValue()); } } @@ -706,6 +700,15 @@ public static function expandDefinedName(string $coordinate, Cell $cell): string public static function trimTrailingRange(string $coordinate): string { - return Worksheet::pregReplace('/:[\\w\$]+$/', '', $coordinate); + return (string) preg_replace('/:[\\w\$]+$/', '', $coordinate); + } + + public static function trimSheetFromCellReference(string $coordinate): string + { + while (strpos($coordinate, '!') !== false) { + $coordinate = substr($coordinate, strpos($coordinate, '!') + 1); + } + + return $coordinate; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/ErrorValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/ErrorValue.php new file mode 100644 index 0000000..cffad6a --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/ErrorValue.php @@ -0,0 +1,71 @@ + '#NULL!', + 'divisionbyzero' => '#DIV/0!', + 'value' => '#VALUE!', + 'reference' => '#REF!', + 'name' => '#NAME?', + 'num' => '#NUM!', + 'na' => '#N/A', + 'gettingdata' => '#GETTING_DATA', + 'spill' => '#SPILL!', + ]; + + /** + * ERROR_TYPE. + * + * @param mixed $value Value to check + * + * @return array|int|string + */ + public static function type($value = '') + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + $i = 1; + foreach (self::$errorCodes as $errorCode) { + if ($value === $errorCode) { + return $i; + } + ++$i; + } + + if ($value === self::CALC()) { + return 14; + } + + return self::NA(); + } + + /** + * NULL. + * + * Returns the error value #NULL! + * + * @return string #NULL! + */ + public static function null() + { + return self::$errorCodes['null']; + } + + /** + * NaN. + * + * Returns the error value #NUM! + * + * @return string #NUM! + */ + public static function NAN() + { + return self::$errorCodes['num']; + } + + /** + * REF. + * + * Returns the error value #REF! + * + * @return string #REF! + */ + public static function REF() + { + return self::$errorCodes['reference']; + } + + /** + * NA. + * + * Excel Function: + * =NA() + * + * Returns the error value #N/A + * #N/A is the error value that means "no value is available." + * + * @return string #N/A! + */ + public static function NA() + { + return self::$errorCodes['na']; + } + + /** + * VALUE. + * + * Returns the error value #VALUE! + * + * @return string #VALUE! + */ + public static function VALUE() + { + return self::$errorCodes['value']; + } + + /** + * NAME. + * + * Returns the error value #NAME? + * + * @return string #NAME? + */ + public static function NAME() + { + return self::$errorCodes['name']; + } + + /** + * DIV0. + * + * @return string #DIV/0! + */ + public static function DIV0() + { + return self::$errorCodes['divisionbyzero']; + } + + /** + * CALC. + * + * @return string #Not Yet Implemented + */ + public static function CALC() + { + return '#CALC!'; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/Value.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/Value.php new file mode 100644 index 0000000..0ac6b66 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Information/Value.php @@ -0,0 +1,328 @@ +getCoordinate()) { + return false; + } + + $cellValue = Functions::trimTrailingRange($value); + if (preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/ui', $cellValue) === 1) { + [$worksheet, $cellValue] = Worksheet::extractSheetTitle($cellValue, true); + if (!empty($worksheet) && $cell->getWorksheet()->getParent()->getSheetByName($worksheet) === null) { + return false; + } + [$column, $row] = Coordinate::indexesFromString($cellValue); + if ($column > 16384 || $row > 1048576) { + return false; + } + + return true; + } + + $namedRange = $cell->getWorksheet()->getParent()->getNamedRange($value); + + return $namedRange instanceof NamedRange; + } + + /** + * IS_EVEN. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isEven($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + if ($value === null) { + return ExcelError::NAME(); + } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return ExcelError::VALUE(); + } + + return ((int) fmod($value, 2)) === 0; + } + + /** + * IS_ODD. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isOdd($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + if ($value === null) { + return ExcelError::NAME(); + } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return ExcelError::VALUE(); + } + + return ((int) fmod($value, 2)) !== 0; + } + + /** + * IS_NUMBER. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isNumber($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + if (is_string($value)) { + return false; + } + + return is_numeric($value); + } + + /** + * IS_LOGICAL. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isLogical($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + return is_bool($value); + } + + /** + * IS_TEXT. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isText($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + return is_string($value) && !ErrorValue::isError($value); + } + + /** + * IS_NONTEXT. + * + * @param mixed $value Value to check + * Or can be an array of values + * + * @return array|bool + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions + */ + public static function isNonText($value = null) + { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + + return !self::isText($value); + } + + /** + * ISFORMULA. + * + * @param mixed $cellReference The cell to check + * @param ?Cell $cell The current cell (containing this formula) + * + * @return array|bool|string + */ + public static function isFormula($cellReference = '', ?Cell $cell = null) + { + if ($cell === null) { + return ExcelError::REF(); + } + + $fullCellReference = Functions::expandDefinedName((string) $cellReference, $cell); + + if (strpos($cellReference, '!') !== false) { + $cellReference = Functions::trimSheetFromCellReference($cellReference); + $cellReferences = Coordinate::extractAllCellReferencesInRange($cellReference); + if (count($cellReferences) > 1) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $cellReferences, $cell); + } + } + + $fullCellReference = Functions::trimTrailingRange($fullCellReference); + + preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $fullCellReference, $matches); + + $fullCellReference = $matches[6] . $matches[7]; + $worksheetName = str_replace("''", "'", trim($matches[2], "'")); + + $worksheet = (!empty($worksheetName)) + ? $cell->getWorksheet()->getParent()->getSheetByName($worksheetName) + : $cell->getWorksheet(); + + return ($worksheet !== null) ? $worksheet->getCell($fullCellReference)->isFormula() : ExcelError::REF(); + } + + /** + * N. + * + * Returns a value converted to a number + * + * @param null|mixed $value The value you want converted + * + * @return number N converts values listed in the following table + * If value is or refers to N returns + * A number That number value + * A date The Excel serialized number of that date + * TRUE 1 + * FALSE 0 + * An error value The error value + * Anything else 0 + */ + public static function asNumber($value = null) + { + while (is_array($value)) { + $value = array_shift($value); + } + + switch (gettype($value)) { + case 'double': + case 'float': + case 'integer': + return $value; + case 'boolean': + return (int) $value; + case 'string': + // Errors + if ((strlen($value) > 0) && ($value[0] == '#')) { + return $value; + } + + break; + } + + return 0; + } + + /** + * TYPE. + * + * Returns a number that identifies the type of a value + * + * @param null|mixed $value The value you want tested + * + * @return number N converts values listed in the following table + * If value is or refers to N returns + * A number 1 + * Text 2 + * Logical Value 4 + * An error value 16 + * Array or Matrix 64 + */ + public static function type($value = null) + { + $value = Functions::flattenArrayIndexed($value); + if (is_array($value) && (count($value) > 1)) { + end($value); + $a = key($value); + // Range of cells is an error + if (Functions::isCellValue($a)) { + return 16; + // Test for Matrix + } elseif (Functions::isMatrixValue($a)) { + return 64; + } + } elseif (empty($value)) { + // Empty Cell + return 1; + } + + $value = Functions::flattenSingleValue($value); + if (($value === null) || (is_float($value)) || (is_int($value))) { + return 1; + } elseif (is_bool($value)) { + return 4; + } elseif (is_array($value)) { + return 64; + } elseif (is_string($value)) { + // Errors + if ((strlen($value) > 0) && ($value[0] == '#')) { + return 16; + } + + return 2; + } + + return 0; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Internal/WildcardMatch.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Internal/WildcardMatch.php index 5731569..371ad8b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Internal/WildcardMatch.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Internal/WildcardMatch.php @@ -25,13 +25,13 @@ class WildcardMatch public static function wildcard(string $wildcard): string { // Preg Escape the wildcard, but protecting the Excel * and ? search characters - return str_replace(self::SEARCH_SET, self::REPLACEMENT_SET, preg_quote($wildcard)); + return str_replace(self::SEARCH_SET, self::REPLACEMENT_SET, preg_quote($wildcard, '/')); } - public static function compare(string $value, string $wildcard): bool + public static function compare(?string $value, string $wildcard): bool { - if ($value === '') { - return true; + if ($value === '' || $value === null) { + return false; } return (bool) preg_match("/^{$wildcard}\$/mui", $value); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php index b267e1f..d5d993a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php @@ -163,7 +163,7 @@ public static function logicalXor(...$args) * * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE * - * @return bool|string the boolean inverse of the argument + * @return array|bool|string the boolean inverse of the argument */ public static function NOT($logical = false) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Conditional.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Conditional.php index e84d0f3..6a7757c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Conditional.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Conditional.php @@ -2,11 +2,17 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Logical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; +use PhpOffice\PhpSpreadsheet\Calculation\Information\Value; class Conditional { + use ArrayEnabled; + /** * STATEMENT_IF. * @@ -34,21 +40,24 @@ class Conditional * * @param mixed $condition Condition to evaluate * @param mixed $returnIfTrue Value to return when condition is true + * Note that this can be an array value * @param mixed $returnIfFalse Optional value to return when condition is false + * Note that this can be an array value * * @return mixed The value of returnIfTrue or returnIfFalse determined by condition */ public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false) { - if (Functions::isError($condition)) { + $condition = ($condition === null) ? true : Functions::flattenSingleValue($condition); + + if (ErrorValue::isError($condition)) { return $condition; } - $condition = ($condition === null) ? true : (bool) Functions::flattenSingleValue($condition); - $returnIfTrue = ($returnIfTrue === null) ? 0 : Functions::flattenSingleValue($returnIfTrue); - $returnIfFalse = ($returnIfFalse === null) ? false : Functions::flattenSingleValue($returnIfFalse); + $returnIfTrue = $returnIfTrue ?? 0; + $returnIfFalse = $returnIfFalse ?? false; - return ($condition) ? $returnIfTrue : $returnIfFalse; + return ((bool) $condition) ? $returnIfTrue : $returnIfFalse; } /** @@ -67,9 +76,11 @@ public static function statementIf($condition = true, $returnIfTrue = 0, $return * result1, result2, ... result_n * A list of results. The SWITCH function returns the corresponding result when a value * matches expression. + * Note that these can be array values to be returned * default * Optional. It is the default to return if expression does not match any of the values * (value1, value2, ... value_n). + * Note that this can be an array value to be returned * * @param mixed $arguments Statement arguments * @@ -77,7 +88,7 @@ public static function statementIf($condition = true, $returnIfTrue = 0, $return */ public static function statementSwitch(...$arguments) { - $result = Functions::VALUE(); + $result = ExcelError::VALUE(); if (count($arguments) > 0) { $targetValue = Functions::flattenSingleValue($arguments[0]); @@ -99,7 +110,7 @@ public static function statementSwitch(...$arguments) } if ($switchSatisfied !== true) { - $result = $hasDefaultClause ? $defaultClause : Functions::NA(); + $result = $hasDefaultClause ? $defaultClause : ExcelError::NA(); } } @@ -113,16 +124,23 @@ public static function statementSwitch(...$arguments) * =IFERROR(testValue,errorpart) * * @param mixed $testValue Value to check, is also the value returned when no error + * Or can be an array of values * @param mixed $errorpart Value to return when testValue is an error condition + * Note that this can be an array value to be returned * * @return mixed The value of errorpart or testValue determined by error condition + * If an array of values is passed as the $testValue argument, then the returned result will also be + * an array with the same dimensions */ public static function IFERROR($testValue = '', $errorpart = '') { - $testValue = ($testValue === null) ? '' : Functions::flattenSingleValue($testValue); - $errorpart = ($errorpart === null) ? '' : Functions::flattenSingleValue($errorpart); + if (is_array($testValue)) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $testValue, $errorpart); + } - return self::statementIf(Functions::isError($testValue), $errorpart, $testValue); + $errorpart = $errorpart ?? ''; + + return self::statementIf(ErrorValue::isError($testValue), $errorpart, $testValue); } /** @@ -132,16 +150,23 @@ public static function IFERROR($testValue = '', $errorpart = '') * =IFNA(testValue,napart) * * @param mixed $testValue Value to check, is also the value returned when not an NA + * Or can be an array of values * @param mixed $napart Value to return when testValue is an NA condition + * Note that this can be an array value to be returned * * @return mixed The value of errorpart or testValue determined by error condition + * If an array of values is passed as the $testValue argument, then the returned result will also be + * an array with the same dimensions */ public static function IFNA($testValue = '', $napart = '') { - $testValue = ($testValue === null) ? '' : Functions::flattenSingleValue($testValue); - $napart = ($napart === null) ? '' : Functions::flattenSingleValue($napart); + if (is_array($testValue)) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $testValue, $napart); + } + + $napart = $napart ?? ''; - return self::statementIf(Functions::isNa($testValue), $napart, $testValue); + return self::statementIf(ErrorValue::isNa($testValue), $napart, $testValue); } /** @@ -156,6 +181,7 @@ public static function IFNA($testValue = '', $napart = '') * Value returned if corresponding testValue (nth) was true * * @param mixed ...$arguments Statement arguments + * Note that this can be an array value to be returned * * @return mixed|string The value of returnIfTrue_n, if testValue_n was true. #N/A if none of testValues was true */ @@ -164,13 +190,13 @@ public static function IFS(...$arguments) $argumentCount = count($arguments); if ($argumentCount % 2 != 0) { - return Functions::NA(); + return ExcelError::NA(); } // We use instance of Exception as a falseValue in order to prevent string collision with value in cell $falseValueException = new Exception(); for ($i = 0; $i < $argumentCount; $i += 2) { $testValue = ($arguments[$i] === null) ? '' : Functions::flattenSingleValue($arguments[$i]); - $returnIfTrue = ($arguments[$i + 1] === null) ? '' : Functions::flattenSingleValue($arguments[$i + 1]); + $returnIfTrue = ($arguments[$i + 1] === null) ? '' : $arguments[$i + 1]; $result = self::statementIf($testValue, $returnIfTrue, $falseValueException); if ($result !== $falseValueException) { @@ -178,6 +204,6 @@ public static function IFS(...$arguments) } } - return Functions::NA(); + return ExcelError::NA(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Operations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Operations.php index 6bfb6a5..2e2faa1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Operations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical/Operations.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Logical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Operations { + use ArrayEnabled; + /** * LOGICAL_AND. * @@ -32,7 +36,7 @@ public static function logicalAnd(...$args) $args = Functions::flattenArray($args); if (count($args) == 0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $args = array_filter($args, function ($value) { @@ -73,7 +77,7 @@ public static function logicalOr(...$args) $args = Functions::flattenArray($args); if (count($args) == 0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $args = array_filter($args, function ($value) { @@ -115,7 +119,7 @@ public static function logicalXor(...$args) $args = Functions::flattenArray($args); if (count($args) == 0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $args = array_filter($args, function ($value) { @@ -146,12 +150,17 @@ public static function logicalXor(...$args) * holds the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value * * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE + * Or can be an array of values * - * @return bool|string the boolean inverse of the argument + * @return array|bool|string the boolean inverse of the argument + * If an array of values is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function NOT($logical = false) { - $logical = Functions::flattenSingleValue($logical); + if (is_array($logical)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $logical); + } if (is_string($logical)) { $logical = mb_strtoupper($logical, 'UTF-8'); @@ -161,7 +170,7 @@ public static function NOT($logical = false) return true; } - return Functions::VALUE(); + return ExcelError::VALUE(); } return !$logical; @@ -187,7 +196,7 @@ private static function countTrueValues(array $args) } elseif (($arg == 'FALSE') || ($arg == Calculation::getFALSE())) { $arg = false; } else { - return Functions::VALUE(); + return ExcelError::VALUE(); } $trueValueCount += ($arg != 0); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php index 6765048..758c4ef 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -41,9 +41,9 @@ class LookupRef * @param bool $referenceStyle A logical value that specifies the A1 or R1C1 reference style. * TRUE or omitted CELL_ADDRESS returns an A1-style reference * FALSE CELL_ADDRESS returns an R1C1-style reference - * @param string $sheetText Optional Name of worksheet to use + * @param array|string $sheetText Optional Name of worksheet to use * - * @return string + * @return array|string */ public static function cellAddress($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '') { @@ -277,7 +277,7 @@ public static function CHOOSE(...$chooseArgs) * @param mixed $matchType The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. * If match_type is 1 or -1, the list has to be ordered. * - * @return int|string The relative position of the found item + * @return array|int|string The relative position of the found item */ public static function MATCH($lookupValue, $lookupArray, $matchType = 1) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Address.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Address.php index 58215f2..c8cdf2d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Address.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Address.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; class Address { + use ArrayEnabled; + public const ADDRESS_ABSOLUTE = 1; public const ADDRESS_COLUMN_RELATIVE = 2; public const ADDRESS_ROW_RELATIVE = 3; @@ -24,29 +27,47 @@ class Address * =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText]) * * @param mixed $row Row number (integer) to use in the cell reference + * Or can be an array of values * @param mixed $column Column number (integer) to use in the cell reference + * Or can be an array of values * @param mixed $relativity Integer flag indicating the type of reference to return * 1 or omitted Absolute * 2 Absolute row; relative column * 3 Relative row; absolute column * 4 Relative + * Or can be an array of values * @param mixed $referenceStyle A logical (boolean) value that specifies the A1 or R1C1 reference style. * TRUE or omitted ADDRESS returns an A1-style reference * FALSE ADDRESS returns an R1C1-style reference + * Or can be an array of values * @param mixed $sheetName Optional Name of worksheet to use + * Or can be an array of values * - * @return string + * @return array|string + * If an array of values is passed as the $testValue argument, then the returned result will also be + * an array with the same dimensions */ public static function cell($row, $column, $relativity = 1, $referenceStyle = true, $sheetName = '') { - $row = Functions::flattenSingleValue($row); - $column = Functions::flattenSingleValue($column); - $relativity = ($relativity === null) ? 1 : Functions::flattenSingleValue($relativity); - $referenceStyle = ($referenceStyle === null) ? true : Functions::flattenSingleValue($referenceStyle); - $sheetName = Functions::flattenSingleValue($sheetName); + if ( + is_array($row) || is_array($column) || + is_array($relativity) || is_array($referenceStyle) || is_array($sheetName) + ) { + return self::evaluateArrayArguments( + [self::class, __FUNCTION__], + $row, + $column, + $relativity, + $referenceStyle, + $sheetName + ); + } + + $relativity = $relativity ?? 1; + $referenceStyle = $referenceStyle ?? true; if (($row < 1) || ($column < 1)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $sheetName = self::sheetName($sheetName); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php index 71358bf..2f691be 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/ExcelMatch.php @@ -2,13 +2,17 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class ExcelMatch { + use ArrayEnabled; + public const MATCHTYPE_SMALLEST_VALUE = -1; public const MATCHTYPE_FIRST_VALUE = 0; public const MATCHTYPE_LARGEST_VALUE = 1; @@ -26,15 +30,16 @@ class ExcelMatch * @param mixed $matchType The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. * If match_type is 1 or -1, the list has to be ordered. * - * @return int|string The relative position of the found item + * @return array|int|string The relative position of the found item */ public static function MATCH($lookupValue, $lookupArray, $matchType = self::MATCHTYPE_LARGEST_VALUE) { + if (is_array($lookupValue)) { + return self::evaluateArrayArgumentsIgnore([self::class, __FUNCTION__], 1, $lookupValue, $lookupArray, $matchType); + } + $lookupArray = Functions::flattenArray($lookupArray); - $lookupValue = Functions::flattenSingleValue($lookupValue); - $matchType = ($matchType === null) - ? self::MATCHTYPE_LARGEST_VALUE - : (int) Functions::flattenSingleValue($matchType); + $matchType = (int) ($matchType ?? self::MATCHTYPE_LARGEST_VALUE); try { // Input validation @@ -79,7 +84,7 @@ public static function MATCH($lookupValue, $lookupArray, $matchType = self::MATC } // Unsuccessful in finding a match, return #N/A error value - return Functions::NA(); + return ExcelError::NA(); } private static function matchFirstValue($lookupArray, $lookupValue) @@ -149,7 +154,7 @@ private static function validateLookupValue($lookupValue): void { // Lookup_value type has to be number, text, or logical values if ((!is_numeric($lookupValue)) && (!is_string($lookupValue)) && (!is_bool($lookupValue))) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } } @@ -160,7 +165,7 @@ private static function validateMatchType($matchType): void ($matchType !== self::MATCHTYPE_FIRST_VALUE) && ($matchType !== self::MATCHTYPE_LARGEST_VALUE) && ($matchType !== self::MATCHTYPE_SMALLEST_VALUE) ) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } } @@ -169,7 +174,7 @@ private static function validateLookupArray($lookupArray): void // Lookup_array should not be empty $lookupArraySize = count($lookupArray); if ($lookupArraySize <= 0) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } } @@ -179,7 +184,7 @@ private static function prepareLookupArray($lookupArray, $matchType) foreach ($lookupArray as $i => $value) { // check the type of the value if ((!is_numeric($value)) && (!is_string($value)) && (!is_bool($value)) && ($value !== null)) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } // Convert strings to lowercase for case-insensitive testing if (is_string($value)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Filter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Filter.php new file mode 100644 index 0000000..74fa832 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Filter.php @@ -0,0 +1,81 @@ +cellExists($cellReference) || !$worksheet->getCell($cellReference)->isFormula() ) { - return Functions::NA(); + return ExcelError::NA(); } return $worksheet->getCell($cellReference)->getValue(); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php index 7db2780..c7e8731 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/HLookup.php @@ -2,13 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class HLookup extends LookupBase { + use ArrayEnabled; + /** * HLOOKUP * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value @@ -24,12 +27,15 @@ class HLookup extends LookupBase */ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExactMatch = true) { - $lookupValue = Functions::flattenSingleValue($lookupValue); - $indexNumber = Functions::flattenSingleValue($indexNumber); - $notExactMatch = ($notExactMatch === null) ? true : Functions::flattenSingleValue($notExactMatch); - $lookupArray = self::convertLiteralArray($lookupArray); + if (is_array($lookupValue)) { + return self::evaluateArrayArgumentsIgnore([self::class, __FUNCTION__], 1, $lookupValue, $lookupArray, $indexNumber, $notExactMatch); + } + + $notExactMatch = (bool) ($notExactMatch ?? true); try { + self::validateLookupArray($lookupArray); + $lookupArray = self::convertLiteralArray($lookupArray); $indexNumber = self::validateIndexLookup($lookupArray, $indexNumber); } catch (Exception $e) { return $e->getMessage(); @@ -38,12 +44,12 @@ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExac $f = array_keys($lookupArray); $firstRow = reset($f); if ((!is_array($lookupArray[$firstRow])) || ($indexNumber > count($lookupArray))) { - return Functions::REF(); + return ExcelError::REF(); } $firstkey = $f[0] - 1; $returnColumn = $firstkey + $indexNumber; - $firstColumn = array_shift($f); + $firstColumn = array_shift($f) ?? 1; $rowNumber = self::hLookupSearch($lookupValue, $lookupArray, $firstColumn, $notExactMatch); if ($rowNumber !== null) { @@ -51,15 +57,14 @@ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExac return $lookupArray[$returnColumn][Coordinate::stringFromColumnIndex($rowNumber)]; } - return Functions::NA(); + return ExcelError::NA(); } /** * @param mixed $lookupValue The value that you want to match in lookup_array - * @param mixed $column The column to look up - * @param mixed $notExactMatch determines if you are looking for an exact match based on lookup_value + * @param int|string $column */ - private static function hLookupSearch($lookupValue, array $lookupArray, $column, $notExactMatch): ?int + private static function hLookupSearch($lookupValue, array $lookupArray, $column, bool $notExactMatch): ?int { $lookupLower = StringHelper::strToLower($lookupValue); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php index 1448c08..5387833 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Cell; class Hyperlink @@ -25,7 +26,7 @@ public static function set($linkURL = '', $displayName = null, ?Cell $cell = nul $displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName); if ((!is_object($cell)) || (trim($linkURL) == '')) { - return Functions::REF(); + return ExcelError::REF(); } if ((is_object($displayName)) || trim($displayName) == '') { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php index b5a3541..417a1f7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php @@ -5,6 +5,7 @@ use Exception; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; @@ -23,7 +24,7 @@ private static function a1Format($a1fmt): bool return Helpers::CELLADDRESS_USE_A1; } if (is_string($a1fmt)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (bool) $a1fmt; @@ -38,7 +39,7 @@ private static function validateAddress($cellAddress): string { $cellAddress = Functions::flattenSingleValue($cellAddress); if (!is_string($cellAddress) || !$cellAddress) { - throw new Exception(Functions::REF()); + throw new Exception(ExcelError::REF()); } return $cellAddress; @@ -71,13 +72,19 @@ public static function INDIRECT($cellAddress, $a1fmt, Cell $cell) [$cellAddress, $worksheet, $sheetName] = Helpers::extractWorksheet($cellAddress, $cell); + if (preg_match('/^' . Calculation::CALCULATION_REGEXP_COLUMNRANGE_RELATIVE . '$/miu', $cellAddress, $matches)) { + $cellAddress = self::handleRowColumnRanges($worksheet, ...explode(':', $cellAddress)); + } elseif (preg_match('/^' . Calculation::CALCULATION_REGEXP_ROWRANGE_RELATIVE . '$/miu', $cellAddress, $matches)) { + $cellAddress = self::handleRowColumnRanges($worksheet, ...explode(':', $cellAddress)); + } + [$cellAddress1, $cellAddress2, $cellAddress] = Helpers::extractCellAddresses($cellAddress, $a1, $cell->getWorkSheet(), $sheetName); if ( - (!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || - (($cellAddress2 !== null) && (!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches))) + (!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/miu', $cellAddress1, $matches)) || + (($cellAddress2 !== null) && (!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/miu', $cellAddress2, $matches))) ) { - return Functions::REF(); + return ExcelError::REF(); } return self::extractRequiredCells($worksheet, $cellAddress); @@ -94,4 +101,22 @@ private static function extractRequiredCells(?Worksheet $worksheet, string $cell return Calculation::getInstance($worksheet !== null ? $worksheet->getParent() : null) ->extractCellRange($cellAddress, $worksheet, false); } + + private static function handleRowColumnRanges(?Worksheet $worksheet, string $start, string $end): string + { + // Being lazy, we're only checking a single row/column to get the max + if (ctype_digit($start) && $start <= 1048576) { + // Max 16,384 columns for Excel2007 + $endColRef = ($worksheet !== null) ? $worksheet->getHighestDataColumn((int) $start) : 'XFD'; + + return "A{$start}:{$endColRef}{$end}"; + } elseif (ctype_alpha($start) && strlen($start) <= 3) { + // Max 1,048,576 rows for Excel2007 + $endRowRef = ($worksheet !== null) ? $worksheet->getHighestDataRow($start) : 1048576; + + return "{$start}1:{$end}{$endRowRef}"; + } + + return "{$start}:{$end}"; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php index e21d35d..76a360b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Lookup.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; class Lookup { + use ArrayEnabled; + /** * LOOKUP * The LOOKUP function searches for value either from a one-row or one-column range or from an array. @@ -19,10 +22,12 @@ class Lookup */ public static function lookup($lookupValue, $lookupVector, $resultVector = null) { - $lookupValue = Functions::flattenSingleValue($lookupValue); + if (is_array($lookupValue)) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $lookupValue, $lookupVector, $resultVector); + } if (!is_array($lookupVector)) { - return Functions::NA(); + return ExcelError::NA(); } $hasResultVector = isset($resultVector); $lookupRows = self::rowCount($lookupVector); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php index 80fc99a..8e451fe 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php @@ -3,20 +3,30 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; abstract class LookupBase { - protected static function validateIndexLookup($lookup_array, $index_number) + /** + * @param mixed $lookup_array + */ + protected static function validateLookupArray($lookup_array): void + { + if (!is_array($lookup_array)) { + throw new Exception(ExcelError::REF()); + } + } + + protected static function validateIndexLookup(array $lookup_array, $index_number): int { // index_number must be a number greater than or equal to 1 if (!is_numeric($index_number) || $index_number < 1) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } // index_number must be less than or equal to the number of columns in lookup_array if ((!is_array($lookup_array)) || (empty($lookup_array))) { - throw new Exception(Functions::REF()); + throw new Exception(ExcelError::REF()); } return (int) $index_number; @@ -25,7 +35,7 @@ protected static function validateIndexLookup($lookup_array, $index_number) protected static function checkMatch( bool $bothNumeric, bool $bothNotNumeric, - $notExactMatch, + bool $notExactMatch, int $rowKey, string $cellDataLower, string $lookupLower, diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php index b0739eb..2282bf4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php @@ -3,7 +3,8 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class LookupRefValidations { @@ -13,11 +14,11 @@ class LookupRefValidations public static function validateInt($value): int { if (!is_numeric($value)) { - if (Functions::isError($value)) { + if (ErrorValue::isError($value)) { throw new Exception($value); } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) floor((float) $value); @@ -31,7 +32,7 @@ public static function validatePositiveInt($value, bool $allowZero = true): int $value = self::validateInt($value); if (($allowZero === false && $value <= 0) || $value < 0) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php index 71d22b3..a447e20 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php @@ -2,11 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Matrix { + use ArrayEnabled; + + /** + * Helper function; NOT an implementation of any Excel Function. + */ + public static function isColumnVector(array $values): bool + { + return count($values, COUNT_RECURSIVE) === (count($values, COUNT_NORMAL) * 2); + } + + /** + * Helper function; NOT an implementation of any Excel Function. + */ + public static function isRowVector(array $values): bool + { + return count($values, COUNT_RECURSIVE) > 1 && + (count($values, COUNT_NORMAL) === 1 || count($values, COUNT_RECURSIVE) === count($values, COUNT_NORMAL)); + } + /** * TRANSPOSE. * @@ -45,17 +65,25 @@ public static function transpose($matrixData) * @param mixed $matrix A range of cells or an array constant * @param mixed $rowNum The row in the array or range from which to return a value. * If row_num is omitted, column_num is required. + * Or can be an array of values * @param mixed $columnNum The column in the array or range from which to return a value. * If column_num is omitted, row_num is required. + * Or can be an array of values * * TODO Provide support for area_num, currently not supported * * @return mixed the value of a specified cell or array of cells + * If an array of values is passed as the $rowNum and/or $columnNum arguments, then the returned result + * will also be an array with the same dimensions */ public static function index($matrix, $rowNum = 0, $columnNum = 0) { - $rowNum = ($rowNum === null) ? 0 : Functions::flattenSingleValue($rowNum); - $columnNum = ($columnNum === null) ? 0 : Functions::flattenSingleValue($columnNum); + if (is_array($rowNum) || is_array($columnNum)) { + return self::evaluateArrayArgumentsSubsetFrom([self::class, __FUNCTION__], 1, $matrix, $rowNum, $columnNum); + } + + $rowNum = $rowNum ?? 0; + $columnNum = $columnNum ?? 0; try { $rowNum = LookupRefValidations::validatePositiveInt($rowNum); @@ -65,14 +93,14 @@ public static function index($matrix, $rowNum = 0, $columnNum = 0) } if (!is_array($matrix) || ($rowNum > count($matrix))) { - return Functions::REF(); + return ExcelError::REF(); } $rowKeys = array_keys($matrix); $columnKeys = @array_keys($matrix[$rowKeys[0]]); if ($columnNum > count($columnKeys)) { - return Functions::REF(); + return ExcelError::REF(); } if ($columnNum === 0) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php index 7e1e287..9f3377f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Offset.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; @@ -48,11 +49,11 @@ public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $hei $width = Functions::flattenSingleValue($width); if ($cellAddress === null || $cellAddress === '') { - return 0; + return ExcelError::VALUE(); } if (!is_object($cell)) { - return Functions::REF(); + return ExcelError::REF(); } [$cellAddress, $worksheet] = self::extractWorksheet($cellAddress, $cell); @@ -69,7 +70,7 @@ public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $hei $startCellColumn += $columns; if (($startCellRow <= 0) || ($startCellColumn < 0)) { - return Functions::REF(); + return ExcelError::REF(); } $endCellColumn = self::adjustEndCellColumnForWidth($endCellColumn, $width, $startCellColumn, $columns); @@ -78,7 +79,7 @@ public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $hei $endCellRow = self::adustEndCellRowForHeight($height, $startCellRow, $rows, $endCellRow); if (($endCellRow <= 0) || ($endCellColumn < 0)) { - return Functions::REF(); + return ExcelError::REF(); } $endCellColumn = Coordinate::stringFromColumnIndex($endCellColumn + 1); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php index 9752d67..1f84804 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; @@ -99,7 +99,7 @@ public static function COLUMNS($cellAddress = null) return 1; } if (!is_array($cellAddress)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } reset($cellAddress); @@ -166,6 +166,7 @@ public static function ROW($cellAddress = null, ?Cell $cell = null) function ($value) { return [$value]; }, + // @phpstan-ignore-next-line range($startAddress, $endAddress) ); } @@ -193,7 +194,7 @@ public static function ROWS($cellAddress = null) return 1; } if (!is_array($cellAddress)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } reset($cellAddress); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Selection.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Selection.php index 6c18d73..0ac9177 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Selection.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Selection.php @@ -2,10 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Selection { + use ArrayEnabled; + /** * CHOOSE. * @@ -15,26 +19,27 @@ class Selection * Excel Function: * =CHOOSE(index_num, value1, [value2], ...) * + * @param mixed $chosenEntry The entry to select from the list (indexed from 1) * @param mixed ...$chooseArgs Data values * * @return mixed The selected value */ - public static function choose(...$chooseArgs) + public static function choose($chosenEntry, ...$chooseArgs) { - $chosenEntry = Functions::flattenArray(array_shift($chooseArgs)); - $entryCount = count($chooseArgs) - 1; - if (is_array($chosenEntry)) { - $chosenEntry = array_shift($chosenEntry); + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $chosenEntry, ...$chooseArgs); } + + $entryCount = count($chooseArgs) - 1; + if (is_numeric($chosenEntry)) { --$chosenEntry; } else { - return Functions::VALUE(); + return ExcelError::VALUE(); } $chosenEntry = floor($chosenEntry); if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } if (is_array($chooseArgs[$chosenEntry])) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Sort.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Sort.php new file mode 100644 index 0000000..ff78fbe --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Sort.php @@ -0,0 +1,342 @@ +getMessage(); + } + + // We want a simple, enumrated array of arrays where we can reference column by its index number. + $sortArray = array_values(array_map('array_values', $sortArray)); + + return ($byColumn === true) + ? self::sortByColumn($sortArray, $sortIndex, $sortOrder) + : self::sortByRow($sortArray, $sortIndex, $sortOrder); + } + + /** + * SORTBY + * The SORTBY function sorts the contents of a range or array based on the values in a corresponding range or array. + * The returned array is the same shape as the provided array argument. + * Both $sortIndex and $sortOrder can be arrays, to provide multi-level sorting. + * + * @param mixed $sortArray The range of cells being sorted + * @param mixed $args + * At least one additional argument must be provided, The vector or range to sort on + * After that, arguments are passed as pairs: + * sort order: ascending or descending + * Ascending = 1 (self::ORDER_ASCENDING) + * Descending = -1 (self::ORDER_DESCENDING) + * additional arrays or ranges for multi-level sorting + * + * @return mixed The sorted values from the sort range + */ + public static function sortBy($sortArray, ...$args) + { + if (!is_array($sortArray)) { + // Scalars are always returned "as is" + return $sortArray; + } + + $sortArray = self::enumerateArrayKeys($sortArray); + + $lookupArraySize = count($sortArray); + $argumentCount = count($args); + + try { + $sortBy = $sortOrder = []; + for ($i = 0; $i < $argumentCount; $i += 2) { + $sortBy[] = self::validateSortVector($args[$i], $lookupArraySize); + $sortOrder[] = self::validateSortOrder($args[$i + 1] ?? self::ORDER_ASCENDING); + } + } catch (Exception $e) { + return $e->getMessage(); + } + + return self::processSortBy($sortArray, $sortBy, $sortOrder); + } + + private static function enumerateArrayKeys(array $sortArray): array + { + array_walk( + $sortArray, + function (&$columns): void { + if (is_array($columns)) { + $columns = array_values($columns); + } + } + ); + + return array_values($sortArray); + } + + /** + * @param mixed $sortIndex + * @param mixed $sortOrder + */ + private static function validateScalarArgumentsForSort(&$sortIndex, &$sortOrder, int $sortArraySize): void + { + if (is_array($sortIndex) || is_array($sortOrder)) { + throw new Exception(ExcelError::VALUE()); + } + + $sortIndex = self::validatePositiveInt($sortIndex, false); + + if ($sortIndex > $sortArraySize) { + throw new Exception(ExcelError::VALUE()); + } + + $sortOrder = self::validateSortOrder($sortOrder); + } + + /** + * @param mixed $sortVector + */ + private static function validateSortVector($sortVector, int $sortArraySize): array + { + if (!is_array($sortVector)) { + throw new Exception(ExcelError::VALUE()); + } + + // It doesn't matter if it's a row or a column vectors, it works either way + $sortVector = Functions::flattenArray($sortVector); + if (count($sortVector) !== $sortArraySize) { + throw new Exception(ExcelError::VALUE()); + } + + return $sortVector; + } + + /** + * @param mixed $sortOrder + */ + private static function validateSortOrder($sortOrder): int + { + $sortOrder = self::validateInt($sortOrder); + if (($sortOrder == self::ORDER_ASCENDING || $sortOrder === self::ORDER_DESCENDING) === false) { + throw new Exception(ExcelError::VALUE()); + } + + return $sortOrder; + } + + /** + * @param array $sortIndex + * @param mixed $sortOrder + */ + private static function validateArrayArgumentsForSort(&$sortIndex, &$sortOrder, int $sortArraySize): void + { + // It doesn't matter if they're row or column vectors, it works either way + $sortIndex = Functions::flattenArray($sortIndex); + $sortOrder = Functions::flattenArray($sortOrder); + + if ( + count($sortOrder) === 0 || count($sortOrder) > $sortArraySize || + (count($sortOrder) > count($sortIndex)) + ) { + throw new Exception(ExcelError::VALUE()); + } + + if (count($sortIndex) > count($sortOrder)) { + // If $sortOrder has fewer elements than $sortIndex, then the last order element is repeated. + $sortOrder = array_merge( + $sortOrder, + array_fill(0, count($sortIndex) - count($sortOrder), array_pop($sortOrder)) + ); + } + + foreach ($sortIndex as $key => &$value) { + self::validateScalarArgumentsForSort($value, $sortOrder[$key], $sortArraySize); + } + } + + private static function prepareSortVectorValues(array $sortVector): array + { + // Strings should be sorted case-insensitive; with booleans converted to locale-strings + return array_map( + function ($value) { + if (is_bool($value)) { + return ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } elseif (is_string($value)) { + return StringHelper::strToLower($value); + } + + return $value; + }, + $sortVector + ); + } + + /** + * @param array[] $sortIndex + * @param int[] $sortOrder + */ + private static function processSortBy(array $sortArray, array $sortIndex, $sortOrder): array + { + $sortArguments = []; + $sortData = []; + foreach ($sortIndex as $index => $sortValues) { + $sortData[] = $sortValues; + $sortArguments[] = self::prepareSortVectorValues($sortValues); + $sortArguments[] = $sortOrder[$index] === self::ORDER_ASCENDING ? SORT_ASC : SORT_DESC; + } + $sortArguments = self::applyPHP7Patch($sortArray, $sortArguments); + + $sortVector = self::executeVectorSortQuery($sortData, $sortArguments); + + return self::sortLookupArrayFromVector($sortArray, $sortVector); + } + + /** + * @param int[] $sortIndex + * @param int[] $sortOrder + */ + private static function sortByRow(array $sortArray, array $sortIndex, array $sortOrder): array + { + $sortVector = self::buildVectorForSort($sortArray, $sortIndex, $sortOrder); + + return self::sortLookupArrayFromVector($sortArray, $sortVector); + } + + /** + * @param int[] $sortIndex + * @param int[] $sortOrder + */ + private static function sortByColumn(array $sortArray, array $sortIndex, array $sortOrder): array + { + $sortArray = Matrix::transpose($sortArray); + $result = self::sortByRow($sortArray, $sortIndex, $sortOrder); + + return Matrix::transpose($result); + } + + /** + * @param int[] $sortIndex + * @param int[] $sortOrder + */ + private static function buildVectorForSort(array $sortArray, array $sortIndex, array $sortOrder): array + { + $sortArguments = []; + $sortData = []; + foreach ($sortIndex as $index => $sortIndexValue) { + $sortValues = array_column($sortArray, $sortIndexValue - 1); + $sortData[] = $sortValues; + $sortArguments[] = self::prepareSortVectorValues($sortValues); + $sortArguments[] = $sortOrder[$index] === self::ORDER_ASCENDING ? SORT_ASC : SORT_DESC; + } + $sortArguments = self::applyPHP7Patch($sortArray, $sortArguments); + + $sortData = self::executeVectorSortQuery($sortData, $sortArguments); + + return $sortData; + } + + private static function executeVectorSortQuery(array $sortData, array $sortArguments): array + { + $sortData = Matrix::transpose($sortData); + + // We need to set an index that can be retained, as array_multisort doesn't maintain numeric keys. + $sortDataIndexed = []; + foreach ($sortData as $key => $value) { + $sortDataIndexed[Coordinate::stringFromColumnIndex($key + 1)] = $value; + } + unset($sortData); + + $sortArguments[] = &$sortDataIndexed; + + array_multisort(...$sortArguments); + + // After the sort, we restore the numeric keys that will now be in the correct, sorted order + $sortedData = []; + foreach (array_keys($sortDataIndexed) as $key) { + $sortedData[] = Coordinate::columnIndexFromString($key) - 1; + } + + return $sortedData; + } + + private static function sortLookupArrayFromVector(array $sortArray, array $sortVector): array + { + // Building a new array in the correct (sorted) order works; but may be memory heavy for larger arrays + $sortedArray = []; + foreach ($sortVector as $index) { + $sortedArray[] = $sortArray[$index]; + } + + return $sortedArray; + +// uksort( +// $lookupArray, +// function (int $a, int $b) use (array $sortVector) { +// return $sortVector[$a] <=> $sortVector[$b]; +// } +// ); +// +// return $lookupArray; + } + + /** + * Hack to handle PHP 7: + * From PHP 8.0.0, If two members compare as equal in a sort, they retain their original order; + * but prior to PHP 8.0.0, their relative order in the sorted array was undefined. + * MS Excel replicates the PHP 8.0.0 behaviour, retaining the original order of matching elements. + * To replicate that behaviour with PHP 7, we add an extra sort based on the row index. + */ + private static function applyPHP7Patch(array $sortArray, array $sortArguments): array + { + if (PHP_VERSION_ID < 80000) { + $sortArguments[] = range(1, count($sortArray)); + $sortArguments[] = SORT_ASC; + } + + return $sortArguments; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Unique.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Unique.php new file mode 100644 index 0000000..2ba5128 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/Unique.php @@ -0,0 +1,141 @@ + count($flattenedLookupVector, COUNT_RECURSIVE) + 1) { + // We're looking at a full column check (multiple rows) + $transpose = Matrix::transpose($lookupVector); + $result = self::uniqueByRow($transpose, $exactlyOnce); + + return (is_array($result)) ? Matrix::transpose($result) : $result; + } + + $result = self::countValuesCaseInsensitive($flattenedLookupVector); + + if ($exactlyOnce === true) { + $result = self::exactlyOnceFilter($result); + } + + if (count($result) === 0) { + return ExcelError::CALC(); + } + + $result = array_keys($result); + + return $result; + } + + private static function countValuesCaseInsensitive(array $caseSensitiveLookupValues): array + { + $caseInsensitiveCounts = array_count_values( + array_map( + function (string $value) { + return StringHelper::strToUpper($value); + }, + $caseSensitiveLookupValues + ) + ); + + $caseSensitiveCounts = []; + foreach ($caseInsensitiveCounts as $caseInsensitiveKey => $count) { + if (is_numeric($caseInsensitiveKey)) { + $caseSensitiveCounts[$caseInsensitiveKey] = $count; + } else { + foreach ($caseSensitiveLookupValues as $caseSensitiveValue) { + if ($caseInsensitiveKey === StringHelper::strToUpper($caseSensitiveValue)) { + $caseSensitiveCounts[$caseSensitiveValue] = $count; + + break; + } + } + } + } + + return $caseSensitiveCounts; + } + + private static function exactlyOnceFilter(array $values): array + { + return array_filter( + $values, + function ($value) { + return $value === 1; + } + ); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php index ddd5d9e..bc8624f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class VLookup extends LookupBase { + use ArrayEnabled; + /** * VLOOKUP * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value @@ -23,11 +26,14 @@ class VLookup extends LookupBase */ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExactMatch = true) { - $lookupValue = Functions::flattenSingleValue($lookupValue); - $indexNumber = Functions::flattenSingleValue($indexNumber); - $notExactMatch = ($notExactMatch === null) ? true : Functions::flattenSingleValue($notExactMatch); + if (is_array($lookupValue)) { + return self::evaluateArrayArgumentsIgnore([self::class, __FUNCTION__], 1, $lookupValue, $lookupArray, $indexNumber, $notExactMatch); + } + + $notExactMatch = (bool) ($notExactMatch ?? true); try { + self::validateLookupArray($lookupArray); $indexNumber = self::validateIndexLookup($lookupArray, $indexNumber); } catch (Exception $e) { return $e->getMessage(); @@ -36,11 +42,11 @@ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExac $f = array_keys($lookupArray); $firstRow = array_pop($f); if ((!is_array($lookupArray[$firstRow])) || ($indexNumber > count($lookupArray[$firstRow]))) { - return Functions::REF(); + return ExcelError::REF(); } $columnKeys = array_keys($lookupArray[$firstRow]); $returnColumn = $columnKeys[--$indexNumber]; - $firstColumn = array_shift($columnKeys); + $firstColumn = array_shift($columnKeys) ?? 1; if (!$notExactMatch) { uasort($lookupArray, ['self', 'vlookupSort']); @@ -53,7 +59,7 @@ public static function lookup($lookupValue, $lookupArray, $indexNumber, $notExac return $lookupArray[$rowNumber][$returnColumn]; } - return Functions::NA(); + return ExcelError::NA(); } private static function vlookupSort($a, $b) @@ -70,7 +76,11 @@ private static function vlookupSort($a, $b) return ($aLower < $bLower) ? -1 : 1; } - private static function vLookupSearch($lookupValue, $lookupArray, $column, $notExactMatch) + /** + * @param mixed $lookupValue The value that you want to match in lookup_array + * @param int|string $column + */ + private static function vLookupSearch($lookupValue, array $lookupArray, $column, bool $notExactMatch): ?int { $lookupLower = StringHelper::strToLower($lookupValue); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php index ec251f6..993154c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -20,9 +20,9 @@ class MathTrig * @See MathTrig\Arabic::evaluate() * Use the evaluate method in the MathTrig\Arabic class instead * - * @param string $roman + * @param array|string $roman * - * @return int|string the arabic numberal contrived from the roman numeral + * @return array|int|string the arabic numberal contrived from the roman numeral */ public static function ARABIC($roman) { @@ -50,10 +50,10 @@ public static function ARABIC($roman) * @See MathTrig\Trig\Tangent::atan2() * Use the atan2 method in the MathTrig\Trig\Tangent class instead * - * @param float $xCoordinate the x-coordinate of the point - * @param float $yCoordinate the y-coordinate of the point + * @param array|float $xCoordinate the x-coordinate of the point + * @param array|float $yCoordinate the y-coordinate of the point * - * @return float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error + * @return array|float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error */ public static function ATAN2($xCoordinate = null, $yCoordinate = null) { @@ -77,7 +77,7 @@ public static function ATAN2($xCoordinate = null, $yCoordinate = null) * @param float $radix * @param int $minLength * - * @return string the text representation with the given radix (base) + * @return array|string the text representation with the given radix (base) */ public static function BASE($number, $radix, $minLength = null) { @@ -100,7 +100,7 @@ public static function BASE($number, $radix, $minLength = null) * @param float $number the number you want to round * @param float $significance the multiple to which you want to round * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error * * @see MathTrig\Ceiling::ceiling() * Use the ceiling() method in the MathTrig\Ceiling class instead @@ -124,10 +124,10 @@ public static function CEILING($number, $significance = null) * @see MathTrig\Combinations::withoutRepetition() * Use the withoutRepetition() method in the MathTrig\Combinations class instead * - * @param int $numObjs Number of different objects - * @param int $numInSet Number of objects in each combination + * @param array|int $numObjs Number of different objects + * @param array|int $numInSet Number of objects in each combination * - * @return float|int|string Number of combinations, or a string containing an error + * @return array|float|int|string Number of combinations, or a string containing an error */ public static function COMBIN($numObjs, $numInSet) { @@ -151,9 +151,9 @@ public static function COMBIN($numObjs, $numInSet) * @see MathTrig\Round::even() * Use the even() method in the MathTrig\Round class instead * - * @param float $number Number to round + * @param array|float $number Number to round * - * @return float|int|string Rounded Number, or a string containing an error + * @return array|float|int|string Rounded Number, or a string containing an error */ public static function EVEN($number) { @@ -184,9 +184,9 @@ public static function getEven(float $number): int * * @Deprecated 1.18.0 * - * @param float $factVal Factorial Value + * @param array|float $factVal Factorial Value * - * @return float|int|string Factorial, or a string containing an error + * @return array|float|int|string Factorial, or a string containing an error * *@see MathTrig\Factorial::fact() * Use the fact() method in the MathTrig\Factorial class instead @@ -206,9 +206,9 @@ public static function FACT($factVal) * * @Deprecated 1.18.0 * - * @param float $factVal Factorial Value + * @param array|float $factVal Factorial Value * - * @return float|int|string Double Factorial, or a string containing an error + * @return array|float|int|string Double Factorial, or a string containing an error * *@see MathTrig\Factorial::factDouble() * Use the factDouble() method in the MathTrig\Factorial class instead @@ -231,7 +231,7 @@ public static function FACTDOUBLE($factVal) * @param float $number Number to round * @param float $significance Significance * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error * *@see MathTrig\Floor::floor() * Use the floor() method in the MathTrig\Floor class instead @@ -255,7 +255,7 @@ public static function FLOOR($number, $significance = null) * @param float $significance Significance * @param int $mode direction to round negative numbers * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error * *@see MathTrig\Floor::math() * Use the math() method in the MathTrig\Floor class instead @@ -278,7 +278,7 @@ public static function FLOORMATH($number, $significance = null, $mode = 0) * @param float $number Number to round * @param float $significance Significance * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error * *@see MathTrig\Floor::precise() * Use the precise() method in the MathTrig\Floor class instead @@ -301,9 +301,9 @@ public static function FLOORPRECISE($number, $significance = 1) * @see MathTrig\IntClass::evaluate() * Use the evaluate() method in the MathTrig\IntClass class instead * - * @param float $number Number to cast to an integer + * @param array|float $number Number to cast to an integer * - * @return int|string Integer value, or a string containing an error + * @return array|int|string Integer value, or a string containing an error */ public static function INT($number) { @@ -375,7 +375,7 @@ public static function LCM(...$args) * @param float $number The positive real number for which you want the logarithm * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function logBase($number, $base = 10) { @@ -455,7 +455,7 @@ public static function MMULT($matrixData1, $matrixData2) * @param int $a Dividend * @param int $b Divisor * - * @return float|int|string Remainder, or a string containing an error + * @return array|float|int|string Remainder, or a string containing an error */ public static function MOD($a = 1, $b = 1) { @@ -470,9 +470,9 @@ public static function MOD($a = 1, $b = 1) * @Deprecated 1.17.0 * * @param float $number Number to round - * @param int $multiple Multiple to which you want to round $number + * @param array|int $multiple Multiple to which you want to round $number * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error * *@see MathTrig\Round::multiple() * Use the multiple() method in the MathTrig\Mround class instead @@ -511,9 +511,9 @@ public static function MULTINOMIAL(...$args) * @See MathTrig\Round::odd() * Use the odd method in the MathTrig\Round class instead * - * @param float $number Number to round + * @param array|float $number Number to round * - * @return float|int|string Rounded Number, or a string containing an error + * @return array|float|int|string Rounded Number, or a string containing an error */ public static function ODD($number) { @@ -533,7 +533,7 @@ public static function ODD($number) * @param float $x * @param float $y * - * @return float|int|string The result, or a string containing an error + * @return array|float|int|string The result, or a string containing an error */ public static function POWER($x = 0, $y = 2) { @@ -579,7 +579,7 @@ public static function PRODUCT(...$args) * @param mixed $numerator * @param mixed $denominator * - * @return int|string + * @return array|int|string */ public static function QUOTIENT($numerator, $denominator) { @@ -597,7 +597,7 @@ public static function QUOTIENT($numerator, $denominator) * @param int $min Minimal value * @param int $max Maximal value * - * @return float|int|string Random number + * @return array|float|int|string Random number */ public static function RAND($min = 0, $max = 0) { @@ -617,7 +617,7 @@ public static function RAND($min = 0, $max = 0) * @param mixed $aValue Number to convert * @param mixed $style Number indicating one of five possible forms * - * @return string Roman numeral, or a string containing an error + * @return array|string Roman numeral, or a string containing an error */ public static function ROMAN($aValue, $style = 0) { @@ -634,10 +634,10 @@ public static function ROMAN($aValue, $style = 0) * @See MathTrig\Round::up() * Use the up() method in the MathTrig\Round class instead * - * @param float $number Number to round - * @param int $digits Number of digits to which you want to round $number + * @param array|float $number Number to round + * @param array|int $digits Number of digits to which you want to round $number * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error */ public static function ROUNDUP($number, $digits) { @@ -654,10 +654,10 @@ public static function ROUNDUP($number, $digits) * @See MathTrig\Round::down() * Use the down() method in the MathTrig\Round class instead * - * @param float $number Number to round - * @param int $digits Number of digits to which you want to round $number + * @param array|float $number Number to round + * @param array|int $digits Number of digits to which you want to round $number * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error */ public static function ROUNDDOWN($number, $digits) { @@ -679,7 +679,7 @@ public static function ROUNDDOWN($number, $digits) * @param mixed $m Step * @param mixed[] $args An array of coefficients for the Data Series * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function SERIESSUM($x, $n, $m, ...$args) { @@ -697,9 +697,9 @@ public static function SERIESSUM($x, $n, $m, ...$args) * @See MathTrig\Sign::evaluate() * Use the evaluate method in the MathTrig\Sign class instead * - * @param float $number Number to round + * @param array|float $number Number to round * - * @return int|string sign value, or a string containing an error + * @return array|int|string sign value, or a string containing an error */ public static function SIGN($number) { @@ -729,9 +729,9 @@ public static function returnSign(float $number): int * @See MathTrig\Sqrt::sqrt() * Use the pi method in the MathTrig\Sqrt class instead * - * @param float $number Number + * @param array|float $number Number * - * @return float|string Square Root of Number * Pi, or a string containing an error + * @return array|float|string Square Root of Number * Pi, or a string containing an error */ public static function SQRTPI($number) { @@ -941,7 +941,7 @@ public static function SUMXMY2($matrixData1, $matrixData2) * @param float $value * @param int $digits * - * @return float|string Truncated value, or a string containing an error + * @return array|float|string Truncated value, or a string containing an error */ public static function TRUNC($value = 0, $digits = 0) { @@ -958,9 +958,9 @@ public static function TRUNC($value = 0, $digits = 0) * @See MathTrig\Trig\Secant::sec() * Use the sec method in the MathTrig\Trig\Secant class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The secant of the angle + * @return array|float|string The secant of the angle */ public static function SEC($angle) { @@ -977,9 +977,9 @@ public static function SEC($angle) * @See MathTrig\Trig\Secant::sech() * Use the sech method in the MathTrig\Trig\Secant class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The hyperbolic secant of the angle + * @return array|float|string The hyperbolic secant of the angle */ public static function SECH($angle) { @@ -996,9 +996,9 @@ public static function SECH($angle) * @See MathTrig\Trig\Cosecant::csc() * Use the csc method in the MathTrig\Trig\Cosecant class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The cosecant of the angle + * @return array|float|string The cosecant of the angle */ public static function CSC($angle) { @@ -1015,9 +1015,9 @@ public static function CSC($angle) * @See MathTrig\Trig\Cosecant::csch() * Use the csch method in the MathTrig\Trig\Cosecant class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The hyperbolic cosecant of the angle + * @return array|float|string The hyperbolic cosecant of the angle */ public static function CSCH($angle) { @@ -1034,9 +1034,9 @@ public static function CSCH($angle) * @See MathTrig\Trig\Cotangent::cot() * Use the cot method in the MathTrig\Trig\Cotangent class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The cotangent of the angle + * @return array|float|string The cotangent of the angle */ public static function COT($angle) { @@ -1053,9 +1053,9 @@ public static function COT($angle) * @See MathTrig\Trig\Cotangent::coth() * Use the coth method in the MathTrig\Trig\Cotangent class instead * - * @param float $angle Number + * @param array|float $angle Number * - * @return float|string The hyperbolic cotangent of the angle + * @return array|float|string The hyperbolic cotangent of the angle */ public static function COTH($angle) { @@ -1072,9 +1072,9 @@ public static function COTH($angle) * @See MathTrig\Trig\Cotangent::acot() * Use the acot method in the MathTrig\Trig\Cotangent class instead * - * @param float $number Number + * @param array|float $number Number * - * @return float|string The arccotangent of the number + * @return array|float|string The arccotangent of the number */ public static function ACOT($number) { @@ -1108,9 +1108,9 @@ public static function numberOrNan($result) * @See MathTrig\Trig\Cotangent::acoth() * Use the acoth method in the MathTrig\Trig\Cotangent class instead * - * @param float $number Number + * @param array|float $number Number * - * @return float|string The hyperbolic arccotangent of the number + * @return array|float|string The hyperbolic arccotangent of the number */ public static function ACOTH($number) { @@ -1127,10 +1127,10 @@ public static function ACOTH($number) * @See MathTrig\Round::round() * Use the round() method in the MathTrig\Round class instead * - * @param mixed $number Should be numeric - * @param mixed $precision Should be int + * @param array|mixed $number Should be numeric + * @param array|mixed $precision Should be int * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinROUND($number, $precision) { @@ -1147,9 +1147,9 @@ public static function builtinROUND($number, $precision) * @See MathTrig\Absolute::evaluate() * Use the evaluate method in the MathTrig\Absolute class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|int|string Rounded number + * @return array|float|int|string Rounded number */ public static function builtinABS($number) { @@ -1166,9 +1166,9 @@ public static function builtinABS($number) * * Returns the result of builtin function acos after validating args. * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinACOS($number) { @@ -1185,9 +1185,9 @@ public static function builtinACOS($number) * @See MathTrig\Trig\Cosine::acosh() * Use the acosh method in the MathTrig\Trig\Cosine class instead * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinACOSH($number) { @@ -1204,9 +1204,9 @@ public static function builtinACOSH($number) * @See MathTrig\Trig\Sine::asin() * Use the asin method in the MathTrig\Trig\Sine class instead * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinASIN($number) { @@ -1223,9 +1223,9 @@ public static function builtinASIN($number) * @See MathTrig\Trig\Sine::asinh() * Use the asinh method in the MathTrig\Trig\Sine class instead * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinASINH($number) { @@ -1242,9 +1242,9 @@ public static function builtinASINH($number) * @See MathTrig\Trig\Tangent::atan() * Use the atan method in the MathTrig\Trig\Tangent class instead * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinATAN($number) { @@ -1261,9 +1261,9 @@ public static function builtinATAN($number) * @See MathTrig\Trig\Tangent::atanh() * Use the atanh method in the MathTrig\Trig\Tangent class instead * - * @param mixed $number Should be numeric + * @param array|float $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinATANH($number) { @@ -1280,9 +1280,9 @@ public static function builtinATANH($number) * @See MathTrig\Trig\Cosine::cos() * Use the cos method in the MathTrig\Trig\Cosine class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinCOS($number) { @@ -1299,9 +1299,9 @@ public static function builtinCOS($number) * @See MathTrig\Trig\Cosine::cosh() * Use the cosh method in the MathTrig\Trig\Cosine class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinCOSH($number) { @@ -1318,9 +1318,9 @@ public static function builtinCOSH($number) * @See MathTrig\Angle::toDegrees() * Use the toDegrees method in the MathTrig\Angle class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinDEGREES($number) { @@ -1337,9 +1337,9 @@ public static function builtinDEGREES($number) * @See MathTrig\Exp::evaluate() * Use the evaluate method in the MathTrig\Exp class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinEXP($number) { @@ -1358,7 +1358,7 @@ public static function builtinEXP($number) * * @param mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinLN($number) { @@ -1377,7 +1377,7 @@ public static function builtinLN($number) * * @param mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinLOG10($number) { @@ -1394,9 +1394,9 @@ public static function builtinLOG10($number) * @See MathTrig\Angle::toRadians() * Use the toRadians method in the MathTrig\Angle class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinRADIANS($number) { @@ -1413,9 +1413,9 @@ public static function builtinRADIANS($number) * @See MathTrig\Trig\Sine::evaluate() * Use the sin method in the MathTrig\Trig\Sine class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string sine + * @return array|float|string sine */ public static function builtinSIN($number) { @@ -1432,9 +1432,9 @@ public static function builtinSIN($number) * @See MathTrig\Trig\Sine::sinh() * Use the sinh method in the MathTrig\Trig\Sine class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinSINH($number) { @@ -1451,9 +1451,9 @@ public static function builtinSINH($number) * @See MathTrig\Sqrt::sqrt() * Use the sqrt method in the MathTrig\Sqrt class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinSQRT($number) { @@ -1470,9 +1470,9 @@ public static function builtinSQRT($number) * @See MathTrig\Trig\Tangent::tan() * Use the tan method in the MathTrig\Trig\Tangent class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinTAN($number) { @@ -1489,9 +1489,9 @@ public static function builtinTAN($number) * @See MathTrig\Trig\Tangent::tanh() * Use the tanh method in the MathTrig\Trig\Tangent class instead * - * @param mixed $number Should be numeric + * @param array|mixed $number Should be numeric * - * @return float|string Rounded number + * @return array|float|string Rounded number */ public static function builtinTANH($number) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Absolute.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Absolute.php index 9f1bd80..f21c6b7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Absolute.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Absolute.php @@ -2,21 +2,30 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Absolute { + use ArrayEnabled; + /** * ABS. * * Returns the result of builtin function abs after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|int|string Rounded number + * @return array|float|int|string rounded number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Angle.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Angle.php index 3062481..cbeec6f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Angle.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Angle.php @@ -2,21 +2,30 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Angle { + use ArrayEnabled; + /** * DEGREES. * * Returns the result of builtin function rad2deg after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function toDegrees($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -31,12 +40,18 @@ public static function toDegrees($number) * * Returns the result of builtin function deg2rad after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function toRadians($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php index b852eea..ee48850 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Arabic { + use ArrayEnabled; + private const ROMAN_LOOKUP = [ 'M' => 1000, 'D' => 500, @@ -70,14 +73,20 @@ private static function strSplit(string $roman): array * Excel Function: * ARABIC(text) * - * @param string $roman + * @param mixed $roman Should be a string, or can be an array of strings * - * @return int|string the arabic numberal contrived from the roman numeral + * @return array|int|string the arabic numberal contrived from the roman numeral + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($roman) { + if (is_array($roman)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $roman); + } + // An empty string should return 0 - $roman = substr(trim(strtoupper((string) Functions::flattenSingleValue($roman))), 0, 255); + $roman = substr(trim(strtoupper((string) $roman)), 0, 255); if ($roman === '') { return 0; } @@ -91,7 +100,7 @@ public static function evaluate($roman) try { $arabic = self::calculateArabic(self::strSplit($roman)); } catch (Exception $e) { - return Functions::VALUE(); // Invalid character detected + return ExcelError::VALUE(); // Invalid character detected } if ($negativeNumber) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Base.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Base.php index 4be7b7c..2fec947 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Base.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Base.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Base { + use ArrayEnabled; + /** * BASE. * @@ -16,24 +19,40 @@ class Base * BASE(Number, Radix [Min_length]) * * @param mixed $number expect float + * Or can be an array of values * @param mixed $radix expect float + * Or can be an array of values * @param mixed $minLength expect int or null + * Or can be an array of values * - * @return string the text representation with the given radix (base) + * @return array|string the text representation with the given radix (base) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($number, $radix, $minLength = null) { + if (is_array($number) || is_array($radix) || is_array($minLength)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $radix, $minLength); + } + try { $number = (float) floor(Helpers::validateNumericNullBool($number)); $radix = (int) Helpers::validateNumericNullBool($radix); } catch (Exception $e) { return $e->getMessage(); } - $minLength = Functions::flattenSingleValue($minLength); + return self::calculate($number, $radix, $minLength); + } + + /** + * @param mixed $minLength + */ + private static function calculate(float $number, int $radix, $minLength): string + { if ($minLength === null || is_numeric($minLength)) { if ($number < 0 || $number >= 2 ** 53 || $radix < 2 || $radix > 36) { - return Functions::NAN(); // Numeric range constraints + return ExcelError::NAN(); // Numeric range constraints } $outcome = strtoupper((string) base_convert("$number", 10, $radix)); @@ -44,6 +63,6 @@ public static function evaluate($number, $radix, $minLength = null) return $outcome; } - return Functions::VALUE(); + return ExcelError::VALUE(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php index 73f54a5..635f1bb 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Ceiling { + use ArrayEnabled; + /** * CEILING. * @@ -18,13 +22,21 @@ class Ceiling * Excel Function: * CEILING(number[,significance]) * - * @param float $number the number you want the ceiling - * @param float $significance the multiple to which you want to round + * @param array|float $number the number you want the ceiling + * Or can be an array of values + * @param array|float $significance the multiple to which you want to round + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function ceiling($number, $significance = null) { + if (is_array($number) || is_array($significance)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance); + } + if ($significance === null) { self::floorCheck1Arg(); } @@ -48,13 +60,22 @@ public static function ceiling($number, $significance = null) * CEILING.MATH(number[,significance[,mode]]) * * @param mixed $number Number to round + * Or can be an array of values * @param mixed $significance Significance - * @param int $mode direction to round negative numbers + * Or can be an array of values + * @param array|int $mode direction to round negative numbers + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function math($number, $significance = null, $mode = 0) { + if (is_array($number) || is_array($significance) || is_array($mode)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance, $mode); + } + try { $number = Helpers::validateNumericNullBool($number); $significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1); @@ -82,12 +103,20 @@ public static function math($number, $significance = null, $mode = 0) * CEILING.PRECISE(number[,significance]) * * @param mixed $number the number you want to round - * @param float $significance the multiple to which you want to round + * Or can be an array of values + * @param array|float $significance the multiple to which you want to round + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function precise($number, $significance = 1) { + if (is_array($number) || is_array($significance)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance); + } + try { $number = Helpers::validateNumericNullBool($number); $significance = Helpers::validateNumericNullSubstitution($significance, null); @@ -125,7 +154,7 @@ private static function argumentsOk(float $number, float $significance) return ceil($number / $significance) * $significance; } - return Functions::NAN(); + return ExcelError::NAN(); } private static function floorCheck1Arg(): void diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php index 97508bb..5a652da 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php @@ -2,10 +2,13 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Combinations { + use ArrayEnabled; + /** * COMBIN. * @@ -15,13 +18,19 @@ class Combinations * Excel Function: * COMBIN(numObjs,numInSet) * - * @param mixed $numObjs Number of different objects - * @param mixed $numInSet Number of objects in each combination + * @param mixed $numObjs Number of different objects, or can be an array of numbers + * @param mixed $numInSet Number of objects in each combination, or can be an array of numbers * - * @return float|int|string Number of combinations, or a string containing an error + * @return array|float|int|string Number of combinations, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function withoutRepetition($numObjs, $numInSet) { + if (is_array($numObjs) || is_array($numInSet)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $numObjs, $numInSet); + } + try { $numObjs = Helpers::validateNumericNullSubstitution($numObjs, null); $numInSet = Helpers::validateNumericNullSubstitution($numInSet, null); @@ -35,21 +44,27 @@ public static function withoutRepetition($numObjs, $numInSet) } /** - * COMBIN. + * COMBINA. * * Returns the number of combinations for a given number of items. Use COMBIN to * determine the total possible number of groups for a given number of items. * * Excel Function: - * COMBIN(numObjs,numInSet) + * COMBINA(numObjs,numInSet) * - * @param mixed $numObjs Number of different objects - * @param mixed $numInSet Number of objects in each combination + * @param mixed $numObjs Number of different objects, or can be an array of numbers + * @param mixed $numInSet Number of objects in each combination, or can be an array of numbers * - * @return float|int|string Number of combinations, or a string containing an error + * @return array|float|int|string Number of combinations, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function withRepetition($numObjs, $numInSet) { + if (is_array($numObjs) || is_array($numInSet)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $numObjs, $numInSet); + } + try { $numObjs = Helpers::validateNumericNullSubstitution($numObjs, null); $numInSet = Helpers::validateNumericNullSubstitution($numInSet, null); @@ -69,6 +84,8 @@ public static function withRepetition($numObjs, $numInSet) return $e->getMessage(); } - return round(Factorial::fact($numObjs + $numInSet - 1) / Factorial::fact($numObjs - 1)) / Factorial::fact($numInSet); + return round( + Factorial::fact($numObjs + $numInSet - 1) / Factorial::fact($numObjs - 1) + ) / Factorial::fact($numInSet); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Exp.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Exp.php index ce930a8..f65c2c1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Exp.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Exp.php @@ -2,21 +2,30 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Exp { + use ArrayEnabled; + /** * EXP. * * Returns the result of builtin function exp after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php index f443f8e..b6883e2 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Factorial.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\Statistical; class Factorial { + use ArrayEnabled; + /** * FACT. * @@ -17,12 +20,18 @@ class Factorial * Excel Function: * FACT(factVal) * - * @param float $factVal Factorial Value + * @param array|float $factVal Factorial Value, or can be an array of numbers * - * @return float|int|string Factorial, or a string containing an error + * @return array|float|int|string Factorial, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function fact($factVal) { + if (is_array($factVal)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $factVal); + } + try { $factVal = Helpers::validateNumericNullBool($factVal); Helpers::validateNotNegative($factVal); @@ -53,12 +62,18 @@ public static function fact($factVal) * Excel Function: * FACTDOUBLE(factVal) * - * @param float $factVal Factorial Value + * @param array|float $factVal Factorial Value, or can be an array of numbers * - * @return float|int|string Double Factorial, or a string containing an error + * @return array|float|int|string Double Factorial, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function factDouble($factVal) { + if (is_array($factVal)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $factVal); + } + try { $factVal = Helpers::validateNumericNullSubstitution($factVal, 0); Helpers::validateNotNegative($factVal); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php index 04e1220..2199dda 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Floor { + use ArrayEnabled; + private static function floorCheck1Arg(): void { $compatibility = Functions::getCompatibilityMode(); @@ -24,12 +28,20 @@ private static function floorCheck1Arg(): void * FLOOR(number[,significance]) * * @param mixed $number Expect float. Number to round + * Or can be an array of values * @param mixed $significance Expect float. Significance + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function floor($number, $significance = null) { + if (is_array($number) || is_array($significance)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance); + } + if ($significance === null) { self::floorCheck1Arg(); } @@ -53,13 +65,22 @@ public static function floor($number, $significance = null) * FLOOR.MATH(number[,significance[,mode]]) * * @param mixed $number Number to round + * Or can be an array of values * @param mixed $significance Significance + * Or can be an array of values * @param mixed $mode direction to round negative numbers + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function math($number, $significance = null, $mode = 0) { + if (is_array($number) || is_array($significance) || is_array($mode)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance, $mode); + } + try { $number = Helpers::validateNumericNullBool($number); $significance = Helpers::validateNumericNullSubstitution($significance, ($number < 0) ? -1 : 1); @@ -79,13 +100,21 @@ public static function math($number, $significance = null, $mode = 0) * Excel Function: * FLOOR.PRECISE(number[,significance]) * - * @param float $number Number to round - * @param float $significance Significance + * @param array|float $number Number to round + * Or can be an array of values + * @param array|float $significance Significance + * Or can be an array of values * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function precise($number, $significance = 1) { + if (is_array($number) || is_array($significance)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $significance); + } + try { $number = Helpers::validateNumericNullBool($number); $significance = Helpers::validateNumericNullSubstitution($significance, null); @@ -104,7 +133,7 @@ public static function precise($number, $significance = 1) private static function argumentsOkPrecise(float $number, float $significance) { if ($significance == 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } if ($number == 0.0) { return 0.0; @@ -121,7 +150,7 @@ private static function argumentsOkPrecise(float $number, float $significance) private static function argsOk(float $number, float $significance, int $mode) { if (!$significance) { - return Functions::DIV0(); + return ExcelError::DIV0(); } if (!$number) { return 0.0; @@ -149,7 +178,7 @@ private static function floorMathTest(float $number, float $significance, int $m private static function argumentsOk(float $number, float $significance) { if ($significance == 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } if ($number == 0.0) { return 0.0; @@ -161,6 +190,6 @@ private static function argumentsOk(float $number, float $significance) return floor($number / $significance) * $significance; } - return Functions::NAN(); + return ExcelError::NAN(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Gcd.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Gcd.php index 1dd52fa..f703599 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Gcd.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Gcd.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Gcd { @@ -57,7 +58,7 @@ public static function evaluate(...$args) } if (count($arrayArgs) <= 0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $gcd = (int) array_pop($arrayArgs); do { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php index b89644a..348aa5b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Helpers { @@ -14,7 +15,7 @@ class Helpers */ public static function verySmallDenominator(float $numerator, float $denominator) { - return (abs($denominator) < 1.0E-12) ? Functions::DIV0() : ($numerator / $denominator); + return (abs($denominator) < 1.0E-12) ? ExcelError::DIV0() : ($numerator / $denominator); } /** @@ -37,7 +38,7 @@ public static function validateNumericNullBool($number) return 0 + $number; } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** @@ -58,7 +59,7 @@ public static function validateNumericNullSubstitution($number, $substitute) return 0 + $number; } - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } /** @@ -72,7 +73,7 @@ public static function validateNotNegative($number, ?string $except = null): voi return; } - throw new Exception($except ?? Functions::NAN()); + throw new Exception($except ?? ExcelError::NAN()); } /** @@ -86,7 +87,7 @@ public static function validatePositive($number, ?string $except = null): void return; } - throw new Exception($except ?? Functions::NAN()); + throw new Exception($except ?? ExcelError::NAN()); } /** @@ -100,7 +101,7 @@ public static function validateNotZero($number): void return; } - throw new Exception(Functions::DIV0()); + throw new Exception(ExcelError::DIV0()); } public static function returnSign(float $number): int @@ -124,6 +125,6 @@ public static function getEven(float $number): float */ public static function numberOrNan($result) { - return is_nan($result) ? Functions::NAN() : $result; + return is_nan($result) ? ExcelError::NAN() : $result; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php index 7aa3d06..f7f7764 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php @@ -2,10 +2,13 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class IntClass { + use ArrayEnabled; + /** * INT. * @@ -14,12 +17,18 @@ class IntClass * Excel Function: * INT(number) * - * @param float $number Number to cast to an integer + * @param array|float $number Number to cast to an integer, or can be an array of numbers * - * @return int|string Integer value, or a string containing an error + * @return array|string Integer value, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php index 46e9816..3b23c1d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Lcm { @@ -104,7 +105,7 @@ private static function processPoweredFactors(array &$allPoweredFactors, array & private static function testNonNulls(int $anyNonNulls): void { if (!$anyNonNulls) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Logarithms.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Logarithms.php index d6878d8..7b07f09 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Logarithms.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Logarithms.php @@ -2,10 +2,13 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Logarithms { + use ArrayEnabled; + /** * LOG_BASE. * @@ -15,12 +18,20 @@ class Logarithms * LOG(number[,base]) * * @param mixed $number The positive real number for which you want the logarithm + * Or can be an array of values * @param mixed $base The base of the logarithm. If base is omitted, it is assumed to be 10. + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function withBase($number, $base = 10) { + if (is_array($number) || is_array($base)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $base); + } + try { $number = Helpers::validateNumericNullBool($number); Helpers::validatePositive($number); @@ -39,11 +50,18 @@ public static function withBase($number, $base = 10) * Returns the result of builtin function log after validating args. * * @param mixed $number Should be numeric + * Or can be an array of values * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function base10($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); Helpers::validatePositive($number); @@ -60,11 +78,18 @@ public static function base10($number) * Returns the result of builtin function log after validating args. * * @param mixed $number Should be numeric + * Or can be an array of values * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function natural($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); Helpers::validatePositive($number); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php index 92e1ff8..5a5125a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php @@ -7,12 +7,12 @@ use Matrix\Exception as MatrixException; use Matrix\Matrix; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class MatrixFunctions { /** - * Convert parameter to matrix. + * Convert parameter to Matrix. * * @param mixed $matrixValues A matrix of values */ @@ -31,7 +31,7 @@ private static function getMatrix($matrixValues): Matrix $column = 0; foreach ($matrixRow as $matrixCell) { if ((is_string($matrixCell)) || ($matrixCell === null)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } $matrixData[$row][$column] = $matrixCell; ++$column; @@ -42,6 +42,47 @@ private static function getMatrix($matrixValues): Matrix return new Matrix($matrixData); } + /** + * SEQUENCE. + * + * Generates a list of sequential numbers in an array. + * + * Excel Function: + * SEQUENCE(rows,[columns],[start],[step]) + * + * @param mixed $rows the number of rows to return, defaults to 1 + * @param mixed $columns the number of columns to return, defaults to 1 + * @param mixed $start the first number in the sequence, defaults to 1 + * @param mixed $step the amount to increment each subsequent value in the array, defaults to 1 + * + * @return array|string The resulting array, or a string containing an error + */ + public static function sequence($rows = 1, $columns = 1, $start = 1, $step = 1) + { + try { + $rows = (int) Helpers::validateNumericNullSubstitution($rows, 1); + Helpers::validatePositive($rows); + $columns = (int) Helpers::validateNumericNullSubstitution($columns, 1); + Helpers::validatePositive($columns); + $start = Helpers::validateNumericNullSubstitution($start, 1); + $step = Helpers::validateNumericNullSubstitution($step, 1); + } catch (Exception $e) { + return $e->getMessage(); + } + + if ($step === 0) { + return array_chunk( + array_fill(0, $rows * $columns, $start), + max($columns, 1) + ); + } + + return array_chunk( + range($start, $start + (($rows * $columns - 1) * $step), $step), + max($columns, 1) + ); + } + /** * MDETERM. * @@ -61,7 +102,7 @@ public static function determinant($matrixValues) return $matrix->determinant(); } catch (MatrixException $ex) { - return Functions::VALUE(); + return ExcelError::VALUE(); } catch (Exception $e) { return $e->getMessage(); } @@ -86,9 +127,9 @@ public static function inverse($matrixValues) return $matrix->inverse()->toArray(); } catch (MatrixDiv0Exception $e) { - return Functions::NAN(); + return ExcelError::NAN(); } catch (MatrixException $e) { - return Functions::VALUE(); + return ExcelError::VALUE(); } catch (Exception $e) { return $e->getMessage(); } @@ -110,7 +151,7 @@ public static function multiply($matrixData1, $matrixData2) return $matrixA->multiply($matrixB)->toArray(); } catch (MatrixException $ex) { - return Functions::VALUE(); + return ExcelError::VALUE(); } catch (Exception $e) { return $e->getMessage(); } @@ -127,7 +168,7 @@ public static function identity($dimension) { try { $dimension = (int) Helpers::validateNumericNullBool($dimension); - Helpers::validatePositive($dimension, Functions::VALUE()); + Helpers::validatePositive($dimension, ExcelError::VALUE()); $matrix = Builder::createIdentityMatrix($dimension, 0)->toArray(); return $matrix; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php index 595c7fd..7fd3023 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php @@ -2,21 +2,33 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Operations { + use ArrayEnabled; + /** * MOD. * * @param mixed $dividend Dividend + * Or can be an array of values * @param mixed $divisor Divisor + * Or can be an array of values * - * @return float|int|string Remainder, or a string containing an error + * @return array|float|int|string Remainder, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function mod($dividend, $divisor) { + if (is_array($dividend) || is_array($divisor)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $dividend, $divisor); + } + try { $dividend = Helpers::validateNumericNullBool($dividend); $divisor = Helpers::validateNumericNullBool($divisor); @@ -40,13 +52,21 @@ public static function mod($dividend, $divisor) * * Computes x raised to the power y. * - * @param float|int $x - * @param float|int $y + * @param array|float|int $x + * Or can be an array of values + * @param array|float|int $y + * Or can be an array of values * - * @return float|int|string The result, or a string containing an error + * @return array|float|int|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function power($x, $y) { + if (is_array($x) || is_array($y)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $y); + } + try { $x = Helpers::validateNumericNullBool($x); $y = Helpers::validateNumericNullBool($y); @@ -56,10 +76,10 @@ public static function power($x, $y) // Validate parameters if (!$x && !$y) { - return Functions::NAN(); + return ExcelError::NAN(); } if (!$x && $y < 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } // Return @@ -95,7 +115,7 @@ public static function product(...$args) $returnValue *= $arg; } } else { - return Functions::VALUE(); + return ExcelError::VALUE(); } } @@ -117,12 +137,20 @@ public static function product(...$args) * QUOTIENT(value1,value2) * * @param mixed $numerator Expect float|int + * Or can be an array of values * @param mixed $denominator Expect float|int + * Or can be an array of values * - * @return int|string + * @return array|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function quotient($numerator, $denominator) { + if (is_array($numerator) || is_array($denominator)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $numerator, $denominator); + } + try { $numerator = Helpers::validateNumericNullSubstitution($numerator, 0); $denominator = Helpers::validateNumericNullSubstitution($denominator, 0); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Random.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Random.php index 963a789..b9fcfc7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Random.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Random.php @@ -2,10 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Random { + use ArrayEnabled; + /** * RAND. * @@ -20,12 +24,20 @@ public static function rand() * RANDBETWEEN. * * @param mixed $min Minimal value + * Or can be an array of values * @param mixed $max Maximal value + * Or can be an array of values * - * @return float|int|string Random number + * @return array|float|int|string Random number + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function randBetween($min, $max) { + if (is_array($min) || is_array($max)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $min, $max); + } + try { $min = (int) Helpers::validateNumericNullBool($min); $max = (int) Helpers::validateNumericNullBool($max); @@ -36,4 +48,52 @@ public static function randBetween($min, $max) return mt_rand($min, $max); } + + /** + * RANDARRAY. + * + * Generates a list of sequential numbers in an array. + * + * Excel Function: + * RANDARRAY([rows],[columns],[start],[step]) + * + * @param mixed $rows the number of rows to return, defaults to 1 + * @param mixed $columns the number of columns to return, defaults to 1 + * @param mixed $min the minimum number to be returned, defaults to 0 + * @param mixed $max the maximum number to be returned, defaults to 1 + * @param bool $wholeNumber the type of numbers to return: + * False - Decimal numbers to 15 decimal places. (default) + * True - Whole (integer) numbers + * + * @return array|string The resulting array, or a string containing an error + */ + public static function randArray($rows = 1, $columns = 1, $min = 0, $max = 1, $wholeNumber = false) + { + try { + $rows = (int) Helpers::validateNumericNullSubstitution($rows, 1); + Helpers::validatePositive($rows); + $columns = (int) Helpers::validateNumericNullSubstitution($columns, 1); + Helpers::validatePositive($columns); + $min = Helpers::validateNumericNullSubstitution($min, 1); + $max = Helpers::validateNumericNullSubstitution($max, 1); + + if ($max <= $min) { + return ExcelError::VALUE(); + } + } catch (Exception $e) { + return $e->getMessage(); + } + + return array_chunk( + array_map( + function () use ($min, $max, $wholeNumber) { + return $wholeNumber + ? mt_rand((int) $min, (int) $max) + : (mt_rand() / mt_getrandmax()) * ($max - $min) + $min; + }, + array_fill(0, $rows * $columns, $min) + ), + max($columns, 1) + ); + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php index 71a6df3..0541548 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Roman { + use ArrayEnabled; + private const VALUES = [ 45 => ['VL'], 46 => ['VLI'], @@ -800,12 +803,12 @@ private static function valueOk(int $aValue, int $style): string private static function styleOk(int $aValue, int $style): string { - return ($aValue < 0 || $aValue > self::MAX_ROMAN_VALUE) ? Functions::VALUE() : self::valueOk($aValue, $style); + return ($aValue < 0 || $aValue > self::MAX_ROMAN_VALUE) ? ExcelError::VALUE() : self::valueOk($aValue, $style); } public static function calculateRoman(int $aValue, int $style): string { - return ($style < 0 || $style > self::MAX_ROMAN_STYLE) ? Functions::VALUE() : self::styleOk($aValue, $style); + return ($style < 0 || $style > self::MAX_ROMAN_STYLE) ? ExcelError::VALUE() : self::styleOk($aValue, $style); } /** @@ -814,12 +817,20 @@ public static function calculateRoman(int $aValue, int $style): string * Converts a number to Roman numeral * * @param mixed $aValue Number to convert + * Or can be an array of numbers * @param mixed $style Number indicating one of five possible forms + * Or can be an array of styles * - * @return string Roman numeral, or a string containing an error + * @return array|string Roman numeral, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($aValue, $style = 0) { + if (is_array($aValue) || is_array($style)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $aValue, $style); + } + try { $aValue = Helpers::validateNumericNullBool($aValue); if (is_bool($style)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Round.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Round.php index 2ddde90..776f7eb 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Round.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Round.php @@ -2,23 +2,32 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Round { + use ArrayEnabled; + /** * ROUND. * * Returns the result of builtin function round after validating args. * - * @param mixed $number Should be numeric - * @param mixed $precision Should be int + * @param mixed $number Should be numeric, or can be an array of numbers + * @param mixed $precision Should be int, or can be an array of numbers * - * @return float|string Rounded number + * @return array|float|string Rounded number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function round($number, $precision) { + if (is_array($number) || is_array($precision)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $precision); + } + try { $number = Helpers::validateNumericNullBool($number); $precision = Helpers::validateNumericNullBool($precision); @@ -34,13 +43,19 @@ public static function round($number, $precision) * * Rounds a number up to a specified number of decimal places * - * @param float $number Number to round - * @param int $digits Number of digits to which you want to round $number + * @param array|float $number Number to round, or can be an array of numbers + * @param array|int $digits Number of digits to which you want to round $number, or can be an array of numbers * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function up($number, $digits) { + if (is_array($number) || is_array($digits)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $digits); + } + try { $number = Helpers::validateNumericNullBool($number); $digits = (int) Helpers::validateNumericNullSubstitution($digits, null); @@ -64,13 +79,19 @@ public static function up($number, $digits) * * Rounds a number down to a specified number of decimal places * - * @param float $number Number to round - * @param int $digits Number of digits to which you want to round $number + * @param array|float $number Number to round, or can be an array of numbers + * @param array|int $digits Number of digits to which you want to round $number, or can be an array of numbers * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function down($number, $digits) { + if (is_array($number) || is_array($digits)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $digits); + } + try { $number = Helpers::validateNumericNullBool($number); $digits = (int) Helpers::validateNumericNullSubstitution($digits, null); @@ -94,13 +115,19 @@ public static function down($number, $digits) * * Rounds a number to the nearest multiple of a specified value * - * @param mixed $number Expect float. Number to round. - * @param mixed $multiple Expect int. Multiple to which you want to round. + * @param mixed $number Expect float. Number to round, or can be an array of numbers + * @param mixed $multiple Expect int. Multiple to which you want to round, or can be an array of numbers. * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function multiple($number, $multiple) { + if (is_array($number) || is_array($multiple)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $multiple); + } + try { $number = Helpers::validateNumericNullSubstitution($number, 0); $multiple = Helpers::validateNumericNullSubstitution($multiple, null); @@ -117,7 +144,7 @@ public static function multiple($number, $multiple) return round($number * $multiplier) / $multiplier; } - return Functions::NAN(); + return ExcelError::NAN(); } /** @@ -132,12 +159,18 @@ public static function multiple($number, $multiple) * Excel Function: * EVEN(number) * - * @param float $number Number to round + * @param array|float $number Number to round, or can be an array of numbers * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function even($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -152,12 +185,18 @@ public static function even($number) * * Returns number rounded up to the nearest odd integer. * - * @param float $number Number to round + * @param array|float $number Number to round, or can be an array of numbers * - * @return float|string Rounded Number, or a string containing an error + * @return array|float|string Rounded Number, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function odd($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php index 2ada9df..ecce359 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; class SeriesSum { + use ArrayEnabled; + /** * SERIESSUM. * @@ -17,10 +20,14 @@ class SeriesSum * @param mixed $m Step * @param mixed[] $args An array of coefficients for the Data Series * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function evaluate($x, $n, $m, ...$args) { + if (is_array($x) || is_array($n) || is_array($m)) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 3, $x, $n, $m, ...$args); + } + try { $x = Helpers::validateNumericNullSubstitution($x, 0); $n = Helpers::validateNumericNullSubstitution($n, 0); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php index a48cf0f..e40e1f6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Sign { + use ArrayEnabled; + /** * SIGN. * * Determines the sign of a number. Returns 1 if the number is positive, zero (0) * if the number is 0, and -1 if the number is negative. * - * @param float $number Number to round + * @param array|float $number Number to round, or can be an array of numbers * - * @return int|string sign value, or a string containing an error + * @return array|int|string sign value, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sqrt.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sqrt.php index 8ead578..bb9f15f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sqrt.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sqrt.php @@ -2,21 +2,30 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Sqrt { + use ArrayEnabled; + /** * SQRT. * * Returns the result of builtin function sqrt after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string square roor + * @return array|float|string square root + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function sqrt($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -31,12 +40,18 @@ public static function sqrt($number) * * Returns the square root of (number * pi). * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string Square Root of Number * Pi, or a string containing an error + * @return array|float|string Square Root of Number * Pi, or a string containing an error + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function pi($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullSubstitution($number, 0); Helpers::validateNotNegative($number); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php index 2edb86f..74f95de 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\Statistical; class Subtotal @@ -39,7 +40,10 @@ function ($index) use ($cellReference) { if ($cellReference->getWorksheet()->cellExists($column . $row)) { //take this cell out if it contains the SUBTOTAL or AGGREGATE functions in a formula $isFormula = $cellReference->getWorksheet()->getCell($column . $row)->isFormula(); - $cellFormula = !preg_match('/^=.*\b(SUBTOTAL|AGGREGATE)\s*\(/i', $cellReference->getWorksheet()->getCell($column . $row)->getValue()); + $cellFormula = !preg_match( + '/^=.*\b(SUBTOTAL|AGGREGATE)\s*\(/i', + $cellReference->getWorksheet()->getCell($column . $row)->getValue() ?? '' + ); $retVal = !$isFormula || $cellFormula; } @@ -52,17 +56,17 @@ function ($index) use ($cellReference) { /** @var callable[] */ private const CALL_FUNCTIONS = [ - 1 => [Statistical\Averages::class, 'average'], - [Statistical\Counts::class, 'COUNT'], // 2 - [Statistical\Counts::class, 'COUNTA'], // 3 - [Statistical\Maximum::class, 'max'], // 4 - [Statistical\Minimum::class, 'min'], // 5 - [Operations::class, 'product'], // 6 - [Statistical\StandardDeviations::class, 'STDEV'], // 7 - [Statistical\StandardDeviations::class, 'STDEVP'], // 8 - [Sum::class, 'sumIgnoringStrings'], // 9 - [Statistical\Variances::class, 'VAR'], // 10 - [Statistical\Variances::class, 'VARP'], // 11 + 1 => [Statistical\Averages::class, 'average'], // 1 and 101 + [Statistical\Counts::class, 'COUNT'], // 2 and 102 + [Statistical\Counts::class, 'COUNTA'], // 3 and 103 + [Statistical\Maximum::class, 'max'], // 4 and 104 + [Statistical\Minimum::class, 'min'], // 5 and 105 + [Operations::class, 'product'], // 6 and 106 + [Statistical\StandardDeviations::class, 'STDEV'], // 7 and 107 + [Statistical\StandardDeviations::class, 'STDEVP'], // 8 and 108 + [Sum::class, 'sumIgnoringStrings'], // 9 and 109 + [Statistical\Variances::class, 'VAR'], // 10 and 110 + [Statistical\Variances::class, 'VARP'], // 111 and 111 ]; /** @@ -106,6 +110,6 @@ public static function evaluate($functionType, ...$args) return call_user_func_array($call, $aArgs); } - return Functions::VALUE(); + return ExcelError::VALUE(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sum.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sum.php index 741734d..1a797c8 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sum.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Sum.php @@ -3,6 +3,9 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; +use PhpOffice\PhpSpreadsheet\Calculation\Information\Value; class Sum { @@ -27,7 +30,7 @@ public static function sumIgnoringStrings(...$args) // Is it a numeric value? if (is_numeric($arg)) { $returnValue += $arg; - } elseif (Functions::isError($arg)) { + } elseif (ErrorValue::isError($arg)) { return $arg; } } @@ -61,11 +64,11 @@ public static function sumErroringStrings(...$args) $returnValue += $arg; } elseif (is_bool($arg)) { $returnValue += (int) $arg; - } elseif (Functions::isError($arg)) { + } elseif (ErrorValue::isError($arg)) { return $arg; // ignore non-numerics from cell, but fail as literals (except null) } elseif ($arg !== null && !Functions::isCellValue($k)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } } @@ -99,7 +102,7 @@ public static function product(...$args) $array2 = Functions::flattenArray($matrixData); $count = count($array2); if ($wrkCellCount != $count) { - return Functions::VALUE(); + return ExcelError::VALUE(); } foreach ($array2 as $i => $val) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SumSquares.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SumSquares.php index 49fa638..34b397c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SumSquares.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/SumSquares.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class SumSquares { @@ -40,7 +41,7 @@ private static function getCount(array $array1, array $array2): int { $count = count($array1); if ($count !== count($array2)) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } return $count; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosecant.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosecant.php index 3038e6c..845b6c1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosecant.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosecant.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Cosecant { + use ArrayEnabled; + /** * CSC. * * Returns the cosecant of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The cosecant of the angle + * @return array|float|string The cosecant of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function csc($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -32,12 +41,18 @@ public static function csc($angle) * * Returns the hyperbolic cosecant of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The hyperbolic cosecant of the angle + * @return array|float|string The hyperbolic cosecant of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function csch($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosine.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosine.php index 6c69e12..c06f04d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosine.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cosine.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Cosine { + use ArrayEnabled; + /** * COS. * * Returns the result of builtin function cos after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string cosine + * @return array|float|string cosine + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function cos($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -32,12 +41,18 @@ public static function cos($number) * * Returns the result of builtin function cosh after validating args. * - * @param mixed $number Should be numeric + * @param mixed $number Should be numeric, or can be an array of numbers * - * @return float|string hyperbolic cosine + * @return array|float|string hyperbolic cosine + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function cosh($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -52,12 +67,18 @@ public static function cosh($number) * * Returns the arccosine of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The arccosine of the number + * @return array|float|string The arccosine of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function acos($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -72,12 +93,18 @@ public static function acos($number) * * Returns the arc inverse hyperbolic cosine of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The inverse hyperbolic cosine of the number, or an error string + * @return array|float|string The inverse hyperbolic cosine of the number, or an error string + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function acosh($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cotangent.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cotangent.php index 1b796f5..eeedef9 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cotangent.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Cotangent.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Cotangent { + use ArrayEnabled; + /** * COT. * * Returns the cotangent of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The cotangent of the angle + * @return array|float|string The cotangent of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function cot($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -32,12 +41,18 @@ public static function cot($angle) * * Returns the hyperbolic cotangent of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The hyperbolic cotangent of the angle + * @return array|float|string The hyperbolic cotangent of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function coth($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -52,12 +67,18 @@ public static function coth($angle) * * Returns the arccotangent of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The arccotangent of the number + * @return array|float|string The arccotangent of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function acot($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -72,12 +93,18 @@ public static function acot($number) * * Returns the hyperbolic arccotangent of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The hyperbolic arccotangent of the number + * @return array|float|string The hyperbolic arccotangent of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function acoth($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Secant.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Secant.php index 70299cb..2d26e5d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Secant.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Secant.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Secant { + use ArrayEnabled; + /** * SEC. * * Returns the secant of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The secant of the angle + * @return array|float|string The secant of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function sec($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -32,12 +41,18 @@ public static function sec($angle) * * Returns the hyperbolic secant of an angle. * - * @param float $angle Number + * @param array|float $angle Number, or can be an array of numbers * - * @return float|string The hyperbolic secant of the angle + * @return array|float|string The hyperbolic secant of the angle + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function sech($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Sine.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Sine.php index 2c6a8a0..6af568c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Sine.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Sine.php @@ -2,22 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Sine { + use ArrayEnabled; + /** * SIN. * * Returns the result of builtin function sin after validating args. * - * @param mixed $angle Should be numeric + * @param mixed $angle Should be numeric, or can be an array of numbers * - * @return float|string sine + * @return array|float|string sine + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function sin($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -32,12 +41,18 @@ public static function sin($angle) * * Returns the result of builtin function sinh after validating args. * - * @param mixed $angle Should be numeric + * @param mixed $angle Should be numeric, or can be an array of numbers * - * @return float|string hyperbolic sine + * @return array|float|string hyperbolic sine + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function sinh($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -52,12 +67,18 @@ public static function sinh($angle) * * Returns the arcsine of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The arcsine of the number + * @return array|float|string The arcsine of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function asin($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -72,12 +93,18 @@ public static function asin($number) * * Returns the inverse hyperbolic sine of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The inverse hyperbolic sine of the number + * @return array|float|string The inverse hyperbolic sine of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function asinh($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Tangent.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Tangent.php index 6cd235f..9e77021 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Tangent.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trig/Tangent.php @@ -2,23 +2,32 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; class Tangent { + use ArrayEnabled; + /** * TAN. * * Returns the result of builtin function tan after validating args. * - * @param mixed $angle Should be numeric + * @param mixed $angle Should be numeric, or can be an array of numbers * - * @return float|string tangent + * @return array|float|string tangent + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function tan($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -33,12 +42,18 @@ public static function tan($angle) * * Returns the result of builtin function sinh after validating args. * - * @param mixed $angle Should be numeric + * @param mixed $angle Should be numeric, or can be an array of numbers * - * @return float|string hyperbolic tangent + * @return array|float|string hyperbolic tangent + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function tanh($angle) { + if (is_array($angle)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); + } + try { $angle = Helpers::validateNumericNullBool($angle); } catch (Exception $e) { @@ -53,12 +68,18 @@ public static function tanh($angle) * * Returns the arctangent of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The arctangent of the number + * @return array|float|string The arctangent of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function atan($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -73,12 +94,18 @@ public static function atan($number) * * Returns the inverse hyperbolic tangent of a number. * - * @param float $number Number + * @param array|float $number Number, or can be an array of numbers * - * @return float|string The inverse hyperbolic tangent of the number + * @return array|float|string The inverse hyperbolic tangent of the number + * If an array of numbers is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function atanh($number) { + if (is_array($number)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); + } + try { $number = Helpers::validateNumericNullBool($number); } catch (Exception $e) { @@ -104,13 +131,20 @@ public static function atanh($number) * Excel Function: * ATAN2(xCoordinate,yCoordinate) * - * @param mixed $xCoordinate should be float, the x-coordinate of the point - * @param mixed $yCoordinate should be float, the y-coordinate of the point + * @param mixed $xCoordinate should be float, the x-coordinate of the point, or can be an array of numbers + * @param mixed $yCoordinate should be float, the y-coordinate of the point, or can be an array of numbers * - * @return float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error + * @return array|float|string + * The inverse tangent of the specified x- and y-coordinates, or a string containing an error + * If an array of numbers is passed as one of the arguments, then the returned result will also be an array + * with the same dimensions */ public static function atan2($xCoordinate, $yCoordinate) { + if (is_array($xCoordinate) || is_array($yCoordinate)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $xCoordinate, $yCoordinate); + } + try { $xCoordinate = Helpers::validateNumericNullBool($xCoordinate); $yCoordinate = Helpers::validateNumericNullBool($yCoordinate); @@ -119,7 +153,7 @@ public static function atan2($xCoordinate, $yCoordinate) } if (($xCoordinate == 0) && ($yCoordinate == 0)) { - return Functions::DIV0(); + return ExcelError::DIV0(); } return atan2($yCoordinate, $xCoordinate); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php index 4b3670f..943e209 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php @@ -2,22 +2,33 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; class Trunc { + use ArrayEnabled; + /** * TRUNC. * * Truncates value to the number of fractional digits by number_digits. * - * @param float $value - * @param int $digits + * @param array|float $value + * Or can be an array of values + * @param array|int $digits + * Or can be an array of values * - * @return float|string Truncated value, or a string containing an error + * @return array|float|string Truncated value, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function evaluate($value = 0, $digits = 0) { + if (is_array($value) || is_array($digits)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $digits); + } + try { $value = Helpers::validateNumericNullBool($value); $digits = Helpers::validateNumericNullSubstitution($digits, null); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php index d43a85f..497c929 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php @@ -130,7 +130,7 @@ public static function AVERAGEIF($range, $condition, $averageRange = []) * @param mixed $rMin * @param mixed $rMax * - * @return float|string + * @return array|float|string */ public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) { @@ -153,7 +153,7 @@ public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) * @param float $rMin Minimum value * @param float $rMax Maximum value * - * @return float|string + * @return array|float|string */ public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1) { @@ -179,7 +179,7 @@ public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1 * @param mixed $probability Probability of success on each trial * @param mixed $cumulative * - * @return float|string + * @return array|float|string */ public static function BINOMDIST($value, $trials, $probability, $cumulative) { @@ -199,7 +199,7 @@ public static function BINOMDIST($value, $trials, $probability, $cumulative) * @param float $value Value for the function * @param float $degrees degrees of freedom * - * @return float|string + * @return array|float|string */ public static function CHIDIST($value, $degrees) { @@ -219,7 +219,7 @@ public static function CHIDIST($value, $degrees) * @param float $probability Probability for the function * @param float $degrees degrees of freedom * - * @return float|string + * @return array|float|string */ public static function CHIINV($probability, $degrees) { @@ -240,7 +240,7 @@ public static function CHIINV($probability, $degrees) * @param float $stdDev Standard Deviation * @param float $size * - * @return float|string + * @return array|float|string */ public static function CONFIDENCE($alpha, $stdDev, $size) { @@ -415,7 +415,7 @@ public static function COVAR($yValues, $xValues) * @param float $probability probability of a success on each trial * @param float $alpha criterion value * - * @return int|string + * @return array|int|string */ public static function CRITBINOM($trials, $probability, $alpha) { @@ -460,7 +460,7 @@ public static function DEVSQ(...$args) * @param float $lambda The parameter value * @param bool $cumulative * - * @return float|string + * @return array|float|string */ public static function EXPONDIST($value, $lambda, $cumulative) { @@ -486,7 +486,7 @@ public static function EXPONDIST($value, $lambda, $cumulative) * @param bool $cumulative If cumulative is TRUE, F.DIST returns the cumulative distribution function; * if FALSE, it returns the probability density function. * - * @return float|string + * @return array|float|string */ public static function FDIST2($value, $u, $v, $cumulative) { @@ -507,7 +507,7 @@ public static function FDIST2($value, $u, $v, $cumulative) * * @param float $value * - * @return float|string + * @return array|float|string */ public static function FISHER($value) { @@ -528,7 +528,7 @@ public static function FISHER($value) * * @param float $value * - * @return float|string + * @return array|float|string */ public static function FISHERINV($value) { @@ -549,7 +549,7 @@ public static function FISHERINV($value) * @param mixed $yValues array of mixed Data Series Y * @param mixed $xValues of mixed Data Series X * - * @return bool|float|string + * @return array|bool|float|string */ public static function FORECAST($xValue, $yValues, $xValues) { @@ -568,7 +568,7 @@ public static function FORECAST($xValue, $yValues, $xValues) * * @param float $value * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function GAMMAFunction($value) { @@ -590,7 +590,7 @@ public static function GAMMAFunction($value) * @param float $b Parameter to the distribution * @param bool $cumulative * - * @return float|string + * @return array|float|string */ public static function GAMMADIST($value, $a, $b, $cumulative) { @@ -611,7 +611,7 @@ public static function GAMMADIST($value, $a, $b, $cumulative) * @param float $alpha Parameter to the distribution * @param float $beta Parameter to the distribution * - * @return float|string + * @return array|float|string */ public static function GAMMAINV($probability, $alpha, $beta) { @@ -630,7 +630,7 @@ public static function GAMMAINV($probability, $alpha, $beta) * * @param float $value * - * @return float|string + * @return array|float|string */ public static function GAMMALN($value) { @@ -650,7 +650,7 @@ public static function GAMMALN($value) * * @param float $value * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function GAUSS($value) { @@ -742,7 +742,7 @@ public static function HARMEAN(...$args) * @param mixed $populationSuccesses Number of successes in the population * @param mixed $populationNumber Population size * - * @return float|string + * @return array|float|string */ public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) { @@ -879,7 +879,7 @@ public static function LOGEST($yValues, $xValues = null, $const = true, $stats = * @param float $mean * @param float $stdDev * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error * * @TODO Try implementing P J Acklam's refinement algorithm for greater * accuracy if I can get my head round the mathematics @@ -905,7 +905,7 @@ public static function LOGINV($probability, $mean, $stdDev) * @param float $mean * @param float $stdDev * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function LOGNORMDIST($value, $mean, $stdDev) { @@ -928,7 +928,7 @@ public static function LOGNORMDIST($value, $mean, $stdDev) * @param float $stdDev * @param bool $cumulative * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function LOGNORMDIST2($value, $mean, $stdDev, $cumulative = false) { @@ -1131,7 +1131,7 @@ public static function MODE(...$args) * @param mixed $successes Threshold number of Successes * @param mixed $probability Probability of success on each trial * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NEGBINOMDIST($failures, $successes, $probability) { @@ -1155,7 +1155,7 @@ public static function NEGBINOMDIST($failures, $successes, $probability) * @param mixed $stdDev Standard Deviation * @param mixed $cumulative * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NORMDIST($value, $mean, $stdDev, $cumulative) { @@ -1176,7 +1176,7 @@ public static function NORMDIST($value, $mean, $stdDev, $cumulative) * @param mixed $mean Mean Value * @param mixed $stdDev Standard Deviation * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NORMINV($probability, $mean, $stdDev) { @@ -1197,7 +1197,7 @@ public static function NORMINV($probability, $mean, $stdDev) * * @param mixed $value * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NORMSDIST($value) { @@ -1219,7 +1219,7 @@ public static function NORMSDIST($value) * @param mixed $value * @param mixed $cumulative * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NORMSDIST2($value, $cumulative) { @@ -1238,7 +1238,7 @@ public static function NORMSDIST2($value, $cumulative) * * @param mixed $value * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function NORMSINV($value) { @@ -1308,7 +1308,7 @@ public static function PERCENTRANK($valueSet, $value, $significance = 3) * @param int $numObjs Number of different objects * @param int $numInSet Number of objects in each permutation * - * @return float|int|string Number of permutations, or a string containing an error + * @return array|float|int|string Number of permutations, or a string containing an error */ public static function PERMUT($numObjs, $numInSet) { @@ -1331,7 +1331,7 @@ public static function PERMUT($numObjs, $numInSet) * @param mixed $mean Mean Value * @param mixed $cumulative * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function POISSON($value, $mean, $cumulative) { @@ -1480,7 +1480,7 @@ public static function SMALL(...$args) * @param float $mean Mean Value * @param float $stdDev Standard Deviation * - * @return float|string Standardized value, or a string containing an error + * @return array|float|string Standardized value, or a string containing an error */ public static function STANDARDIZE($value, $mean, $stdDev) { @@ -1610,7 +1610,7 @@ public static function STEYX($yValues, $xValues) * @param float $degrees degrees of freedom * @param float $tails number of tails (1 or 2) * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function TDIST($value, $degrees, $tails) { @@ -1630,7 +1630,7 @@ public static function TDIST($value, $degrees, $tails) * @param float $probability Probability for the function * @param float $degrees degrees of freedom * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error */ public static function TINV($probability, $degrees) { @@ -1787,7 +1787,7 @@ public static function VARPA(...$args) * @param float $beta Beta Parameter * @param bool $cumulative * - * @return float|string (string if result is an error) + * @return array|float|string (string if result is an error) */ public static function WEIBULL($value, $alpha, $beta, $cumulative) { @@ -1811,7 +1811,7 @@ public static function WEIBULL($value, $alpha, $beta, $cumulative) * @param float $m0 Alpha Parameter * @param float $sigma Beta Parameter * - * @return float|string (string if result is an error) + * @return array|float|string (string if result is an error) */ public static function ZTEST($dataSet, $m0, $sigma = null) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages.php index 1a627e9..41b011a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Averages extends AggregateBase { @@ -24,13 +25,13 @@ public static function averageDeviations(...$args) $aArgs = Functions::flattenArrayIndexed($args); // Return value - $returnValue = 0; + $returnValue = 0.0; $aMean = self::average(...$args); - if ($aMean === Functions::DIV0()) { - return Functions::NAN(); - } elseif ($aMean === Functions::VALUE()) { - return Functions::VALUE(); + if ($aMean === ExcelError::DIV0()) { + return ExcelError::NAN(); + } elseif ($aMean === ExcelError::VALUE()) { + return ExcelError::VALUE(); } $aCount = 0; @@ -40,7 +41,7 @@ public static function averageDeviations(...$args) // Strings containing numeric values are only counted if they are string literals (not cell values) // and then only in MS Excel and in Open Office, not in Gnumeric if ((is_string($arg)) && (!is_numeric($arg)) && (!Functions::isCellValue($k))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } if (self::isAcceptedCountable($arg, $k)) { $returnValue += abs($arg - $aMean); @@ -50,7 +51,7 @@ public static function averageDeviations(...$args) // Return if ($aCount === 0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } return $returnValue / $aCount; @@ -79,7 +80,7 @@ public static function average(...$args) // Strings containing numeric values are only counted if they are string literals (not cell values) // and then only in MS Excel and in Open Office, not in Gnumeric if ((is_string($arg)) && (!is_numeric($arg)) && (!Functions::isCellValue($k))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } if (self::isAcceptedCountable($arg, $k)) { $returnValue += $arg; @@ -92,7 +93,7 @@ public static function average(...$args) return $returnValue / $aCount; } - return Functions::DIV0(); + return ExcelError::DIV0(); } /** @@ -132,7 +133,7 @@ public static function averageA(...$args) return $returnValue / $aCount; } - return Functions::DIV0(); + return ExcelError::DIV0(); } /** @@ -151,7 +152,7 @@ public static function median(...$args) { $aArgs = Functions::flattenArray($args); - $returnValue = Functions::NAN(); + $returnValue = ExcelError::NAN(); $aArgs = self::filterArguments($aArgs); $valueCount = count($aArgs); @@ -183,7 +184,7 @@ public static function median(...$args) */ public static function mode(...$args) { - $returnValue = Functions::NA(); + $returnValue = ExcelError::NA(); // Loop through arguments $aArgs = Functions::flattenArray($args); @@ -251,7 +252,7 @@ private static function modeCalc($data) } if ($maxfreq <= 1) { - return Functions::NA(); + return ExcelError::NA(); } return $maxfreqdatum; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages/Mean.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages/Mean.php index d4d0c7e..001c91e 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages/Mean.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Averages/Mean.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages; use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Counts; @@ -36,7 +37,7 @@ public static function geometric(...$args) } } - return Functions::NAN(); + return ExcelError::NAN(); } /** @@ -57,7 +58,7 @@ public static function harmonic(...$args) // Loop through arguments $aArgs = Functions::flattenArray($args); if (Minimum::min($aArgs) < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $returnValue = 0; @@ -66,7 +67,7 @@ public static function harmonic(...$args) // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { if ($arg <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $returnValue += (1 / $arg); ++$aCount; @@ -78,7 +79,7 @@ public static function harmonic(...$args) return 1 / ($returnValue / $aCount); } - return Functions::NA(); + return ExcelError::NA(); } /** @@ -104,7 +105,7 @@ public static function trim(...$args) if ((is_numeric($percent)) && (!is_string($percent))) { if (($percent < 0) || ($percent > 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } $mArgs = []; @@ -126,6 +127,6 @@ public static function trim(...$args) return Averages::average($mArgs); } - return Functions::VALUE(); + return ExcelError::VALUE(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Confidence.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Confidence.php index c59c3a9..ec2ce34 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Confidence.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Confidence.php @@ -2,27 +2,36 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Confidence { + use ArrayEnabled; + /** * CONFIDENCE. * * Returns the confidence interval for a population mean * * @param mixed $alpha As a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * @param mixed $size As an integer + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function CONFIDENCE($alpha, $stdDev, $size) { - $alpha = Functions::flattenSingleValue($alpha); - $stdDev = Functions::flattenSingleValue($stdDev); - $size = Functions::flattenSingleValue($size); + if (is_array($alpha) || is_array($stdDev) || is_array($size)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $alpha, $stdDev, $size); + } try { $alpha = StatisticalValidations::validateFloat($alpha); @@ -33,9 +42,11 @@ public static function CONFIDENCE($alpha, $stdDev, $size) } if (($alpha <= 0) || ($alpha >= 1) || ($stdDev <= 0) || ($size < 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } + /** @var float */ + $temp = Distributions\StandardNormal::inverse(1 - $alpha / 2); - return Distributions\StandardNormal::inverse(1 - $alpha / 2) * $stdDev / sqrt($size); + return Functions::scalar($temp * $stdDev / sqrt($size)); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Deviations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Deviations.php index 55da9f1..6b1db3a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Deviations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Deviations.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Deviations { @@ -24,7 +25,7 @@ public static function sumSquares(...$args) $aMean = Averages::average($aArgs); if (!is_numeric($aMean)) { - return Functions::NAN(); + return ExcelError::NAN(); } // Return value @@ -45,7 +46,7 @@ public static function sumSquares(...$args) } } - return $aCount === 0 ? Functions::VALUE() : $returnValue; + return $aCount === 0 ? ExcelError::VALUE() : $returnValue; } /** @@ -65,7 +66,7 @@ public static function kurtosis(...$args) $aArgs = Functions::flattenArrayIndexed($args); $mean = Averages::average($aArgs); if (!is_numeric($mean)) { - return Functions::DIV0(); + return ExcelError::DIV0(); } $stdDev = StandardDeviations::STDEV($aArgs); @@ -90,7 +91,7 @@ public static function kurtosis(...$args) } } - return Functions::DIV0(); + return ExcelError::DIV0(); } /** @@ -110,11 +111,11 @@ public static function skew(...$args) $aArgs = Functions::flattenArrayIndexed($args); $mean = Averages::average($aArgs); if (!is_numeric($mean)) { - return Functions::DIV0(); + return ExcelError::DIV0(); } $stdDev = StandardDeviations::STDEV($aArgs); if ($stdDev === 0.0 || is_string($stdDev)) { - return Functions::DIV0(); + return ExcelError::DIV0(); } $count = $summer = 0; @@ -122,7 +123,7 @@ public static function skew(...$args) foreach ($aArgs as $k => $arg) { if ((is_bool($arg)) && (!Functions::isMatrixValue($k))) { } elseif (!is_numeric($arg)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } else { // Is it a numeric value? if ((is_numeric($arg)) && (!is_string($arg))) { @@ -136,6 +137,6 @@ public static function skew(...$args) return $summer * ($count / (($count - 1) * ($count - 2))); } - return Functions::DIV0(); + return ExcelError::DIV0(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php index 63e6eb4..224872b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Beta { + use ArrayEnabled; + private const MAX_ITERATIONS = 256; private const LOG_GAMMA_X_MAX_VALUE = 2.55e305; @@ -19,20 +23,28 @@ class Beta * Returns the beta distribution. * * @param mixed $value Float value at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $alpha Parameter to the distribution as a float + * Or can be an array of values * @param mixed $beta Parameter to the distribution as a float + * Or can be an array of values * @param mixed $rMin as an float + * Or can be an array of values * @param mixed $rMax as an float + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $alpha, $beta, $rMin = 0.0, $rMax = 1.0) { - $value = Functions::flattenSingleValue($value); - $alpha = Functions::flattenSingleValue($alpha); - $beta = Functions::flattenSingleValue($beta); - $rMin = ($rMin === null) ? 0.0 : Functions::flattenSingleValue($rMin); - $rMax = ($rMax === null) ? 1.0 : Functions::flattenSingleValue($rMax); + if (is_array($value) || is_array($alpha) || is_array($beta) || is_array($rMin) || is_array($rMax)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $alpha, $beta, $rMin, $rMax); + } + + $rMin = $rMin ?? 0.0; + $rMax = $rMax ?? 1.0; try { $value = DistributionValidations::validateFloat($value); @@ -50,7 +62,7 @@ public static function distribution($value, $alpha, $beta, $rMin = 0.0, $rMax = $rMax = $tmp; } if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) { - return Functions::NAN(); + return ExcelError::NAN(); } $value -= $rMin; @@ -65,20 +77,28 @@ public static function distribution($value, $alpha, $beta, $rMin = 0.0, $rMax = * Returns the inverse of the Beta distribution. * * @param mixed $probability Float probability at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $alpha Parameter to the distribution as a float + * Or can be an array of values * @param mixed $beta Parameter to the distribution as a float + * Or can be an array of values * @param mixed $rMin Minimum value as a float + * Or can be an array of values * @param mixed $rMax Maximum value as a float + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($probability, $alpha, $beta, $rMin = 0.0, $rMax = 1.0) { - $probability = Functions::flattenSingleValue($probability); - $alpha = Functions::flattenSingleValue($alpha); - $beta = Functions::flattenSingleValue($beta); - $rMin = ($rMin === null) ? 0.0 : Functions::flattenSingleValue($rMin); - $rMax = ($rMax === null) ? 1.0 : Functions::flattenSingleValue($rMax); + if (is_array($probability) || is_array($alpha) || is_array($beta) || is_array($rMin) || is_array($rMax)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $alpha, $beta, $rMin, $rMax); + } + + $rMin = $rMin ?? 0.0; + $rMax = $rMax ?? 1.0; try { $probability = DistributionValidations::validateProbability($probability); @@ -96,7 +116,7 @@ public static function inverse($probability, $alpha, $beta, $rMin = 0.0, $rMax = $rMax = $tmp; } if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0.0)) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculateInverse($probability, $alpha, $beta, $rMin, $rMax); @@ -124,7 +144,7 @@ private static function calculateInverse(float $probability, float $alpha, float } if ($i === self::MAX_ITERATIONS) { - return Functions::NA(); + return ExcelError::NA(); } return round($rMin + $guess * ($rMax - $rMin), 12); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php index 9631236..02b53e8 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php @@ -2,12 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Combinations; class Binomial { + use ArrayEnabled; + /** * BINOMDIST. * @@ -18,17 +22,23 @@ class Binomial * babies born are male. * * @param mixed $value Integer number of successes in trials + * Or can be an array of values * @param mixed $trials Integer umber of trials + * Or can be an array of values * @param mixed $probability Probability of success on each trial as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $trials, $probability, $cumulative) { - $value = Functions::flattenSingleValue($value); - $trials = Functions::flattenSingleValue($trials); - $probability = Functions::flattenSingleValue($probability); + if (is_array($value) || is_array($trials) || is_array($probability) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $trials, $probability, $cumulative); + } try { $value = DistributionValidations::validateInt($value); @@ -40,14 +50,16 @@ public static function distribution($value, $trials, $probability, $cumulative) } if (($value < 0) || ($value > $trials)) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative) { return self::calculateCumulativeBinomial($value, $trials, $probability); } + /** @var float */ + $comb = Combinations::withoutRepetition($trials, $value); - return Combinations::withoutRepetition($trials, $value) * $probability ** $value + return $comb * $probability ** $value * (1 - $probability) ** ($trials - $value); } @@ -58,19 +70,26 @@ public static function distribution($value, $trials, $probability, $cumulative) * of trials falling into a specified range. * * @param mixed $trials Integer number of trials + * Or can be an array of values * @param mixed $probability Probability of success on each trial as a float + * Or can be an array of values * @param mixed $successes The integer number of successes in trials + * Or can be an array of values * @param mixed $limit Upper limit for successes in trials as null, or an integer * If null, then this will indicate the same as the number of Successes + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function range($trials, $probability, $successes, $limit = null) { - $trials = Functions::flattenSingleValue($trials); - $probability = Functions::flattenSingleValue($probability); - $successes = Functions::flattenSingleValue($successes); - $limit = ($limit === null) ? $successes : Functions::flattenSingleValue($limit); + if (is_array($trials) || is_array($probability) || is_array($successes) || is_array($limit)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $trials, $probability, $successes, $limit); + } + + $limit = $limit ?? $successes; try { $trials = DistributionValidations::validateInt($trials); @@ -82,15 +101,17 @@ public static function range($trials, $probability, $successes, $limit = null) } if (($successes < 0) || ($successes > $trials)) { - return Functions::NAN(); + return ExcelError::NAN(); } if (($limit < 0) || ($limit > $trials) || $limit < $successes) { - return Functions::NAN(); + return ExcelError::NAN(); } $summer = 0; for ($i = $successes; $i <= $limit; ++$i) { - $summer += Combinations::withoutRepetition($trials, $i) * $probability ** $i + /** @var float */ + $comb = Combinations::withoutRepetition($trials, $i); + $summer += $comb * $probability ** $i * (1 - $probability) ** ($trials - $i); } @@ -107,19 +128,24 @@ public static function range($trials, $probability, $successes, $limit = null) * variable. Like the binomial, trials are assumed to be independent. * * @param mixed $failures Number of Failures as an integer + * Or can be an array of values * @param mixed $successes Threshold number of Successes as an integer + * Or can be an array of values * @param mixed $probability Probability of success on each trial as a float + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions * * TODO Add support for the cumulative flag not present for NEGBINOMDIST, but introduced for NEGBINOM.DIST * The cumulative default should be false to reflect the behaviour of NEGBINOMDIST */ public static function negative($failures, $successes, $probability) { - $failures = Functions::flattenSingleValue($failures); - $successes = Functions::flattenSingleValue($successes); - $probability = Functions::flattenSingleValue($probability); + if (is_array($failures) || is_array($successes) || is_array($probability)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $failures, $successes, $probability); + } try { $failures = DistributionValidations::validateInt($failures); @@ -130,35 +156,42 @@ public static function negative($failures, $successes, $probability) } if (($failures < 0) || ($successes < 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { if (($failures + $successes - 1) <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } } + /** @var float */ + $comb = Combinations::withoutRepetition($failures + $successes - 1, $successes - 1); - return (Combinations::withoutRepetition($failures + $successes - 1, $successes - 1)) + return $comb * ($probability ** $successes) * ((1 - $probability) ** $failures); } /** - * CRITBINOM. + * BINOM.INV. * * Returns the smallest value for which the cumulative binomial distribution is greater * than or equal to a criterion value * * @param mixed $trials number of Bernoulli trials as an integer + * Or can be an array of values * @param mixed $probability probability of a success on each trial as a float + * Or can be an array of values * @param mixed $alpha criterion value as a float + * Or can be an array of values * - * @return int|string + * @return array|int|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($trials, $probability, $alpha) { - $trials = Functions::flattenSingleValue($trials); - $probability = Functions::flattenSingleValue($probability); - $alpha = Functions::flattenSingleValue($alpha); + if (is_array($trials) || is_array($probability) || is_array($alpha)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $trials, $probability, $alpha); + } try { $trials = DistributionValidations::validateInt($trials); @@ -169,9 +202,9 @@ public static function inverse($trials, $probability, $alpha) } if ($trials < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } elseif (($alpha < 0.0) || ($alpha > 1.0)) { - return Functions::NAN(); + return ExcelError::NAN(); } $successes = 0; @@ -193,7 +226,9 @@ private static function calculateCumulativeBinomial(int $value, int $trials, flo { $summer = 0; for ($i = 0; $i <= $value; ++$i) { - $summer += Combinations::withoutRepetition($trials, $i) * $probability ** $i + /** @var float */ + $comb = Combinations::withoutRepetition($trials, $i); + $summer += $comb * $probability ** $i * (1 - $probability) ** ($trials - $i); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php index 5165d63..8574d58 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class ChiSquared { + use ArrayEnabled; + private const MAX_ITERATIONS = 256; private const EPS = 2.22e-16; @@ -17,14 +21,19 @@ class ChiSquared * Returns the one-tailed probability of the chi-squared distribution. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $degrees Integer degrees of freedom + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distributionRightTail($value, $degrees) { - $value = Functions::flattenSingleValue($value); - $degrees = Functions::flattenSingleValue($degrees); + if (is_array($value) || is_array($degrees)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $degrees); + } try { $value = DistributionValidations::validateFloat($value); @@ -34,14 +43,14 @@ public static function distributionRightTail($value, $degrees) } if ($degrees < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($value < 0) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { return 1; } - return Functions::NAN(); + return ExcelError::NAN(); } return 1 - (Gamma::incompleteGamma($degrees / 2, $value / 2) / Gamma::gammaValue($degrees / 2)); @@ -53,16 +62,21 @@ public static function distributionRightTail($value, $degrees) * Returns the one-tailed probability of the chi-squared distribution. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $degrees Integer degrees of freedom + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distributionLeftTail($value, $degrees, $cumulative) { - $value = Functions::flattenSingleValue($value); - $degrees = Functions::flattenSingleValue($degrees); - $cumulative = Functions::flattenSingleValue($cumulative); + if (is_array($value) || is_array($degrees) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $degrees, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -73,14 +87,14 @@ public static function distributionLeftTail($value, $degrees, $cumulative) } if ($degrees < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($value < 0) { if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { return 1; } - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative === true) { @@ -97,14 +111,19 @@ public static function distributionLeftTail($value, $degrees, $cumulative) * Returns the inverse of the right-tailed probability of the chi-squared distribution. * * @param mixed $probability Float probability at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $degrees Integer degrees of freedom + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverseRightTail($probability, $degrees) { - $probability = Functions::flattenSingleValue($probability); - $degrees = Functions::flattenSingleValue($degrees); + if (is_array($probability) || is_array($degrees)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $degrees); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -114,7 +133,7 @@ public static function inverseRightTail($probability, $degrees) } if ($degrees < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } $callback = function ($value) use ($degrees) { @@ -133,14 +152,19 @@ public static function inverseRightTail($probability, $degrees) * Returns the inverse of the left-tailed probability of the chi-squared distribution. * * @param mixed $probability Float probability at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $degrees Integer degrees of freedom + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverseLeftTail($probability, $degrees) { - $probability = Functions::flattenSingleValue($probability); - $degrees = Functions::flattenSingleValue($degrees); + if (is_array($probability) || is_array($degrees)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $degrees); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -150,7 +174,7 @@ public static function inverseLeftTail($probability, $degrees) } if ($degrees < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::inverseLeftTailCalculation($probability, $degrees); @@ -178,22 +202,22 @@ public static function test($actual, $expected) $countActuals = count($actual); $countExpected = count($expected); if ($countActuals !== $countExpected || $countActuals === 1) { - return Functions::NAN(); + return ExcelError::NAN(); } $result = 0.0; for ($i = 0; $i < $countActuals; ++$i) { if ($expected[$i] == 0.0) { - return Functions::DIV0(); + return ExcelError::DIV0(); } elseif ($expected[$i] < 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } $result += (($actual[$i] - $expected[$i]) ** 2) / $expected[$i]; } $degrees = self::degrees($rows, $columns); - $result = self::distributionRightTail($result, $degrees); + $result = Functions::scalar(self::distributionRightTail($result, $degrees)); return $result; } @@ -257,6 +281,7 @@ private static function gammp($n, $x) // Relative error controlled by the eps parameter private static function gser($n, $x) { + /** @var float */ $gln = Gamma::ln($n / 2); $a = 0.5 * $n; $ap = $a; @@ -280,6 +305,7 @@ private static function gser($n, $x) // Relative error controlled by the eps parameter private static function gcf($n, $x) { + /** @var float */ $gln = Gamma::ln($n / 2); $a = 0.5 * $n; $b = $x + 1 - $a; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/DistributionValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/DistributionValidations.php index 57ef00a..bd45a22 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/DistributionValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/DistributionValidations.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\Statistical\StatisticalValidations; class DistributionValidations extends StatisticalValidations @@ -16,7 +16,7 @@ public static function validateProbability($probability): float $probability = self::validateFloat($probability); if ($probability < 0.0 || $probability > 1.0) { - throw new Exception(Functions::NAN()); + throw new Exception(ExcelError::NAN()); } return $probability; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php index b3fd946..a03671c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Exponential { + use ArrayEnabled; + /** * EXPONDIST. * @@ -15,16 +18,21 @@ class Exponential * use EXPONDIST to determine the probability that the process takes at most 1 minute. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $lambda The parameter value as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $lambda, $cumulative) { - $value = Functions::flattenSingleValue($value); - $lambda = Functions::flattenSingleValue($lambda); - $cumulative = Functions::flattenSingleValue($cumulative); + if (is_array($value) || is_array($lambda) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $lambda, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -35,7 +43,7 @@ public static function distribution($value, $lambda, $cumulative) } if (($value < 0) || ($lambda < 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative === true) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php index 54b1950..ff413b6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class F { + use ArrayEnabled; + /** * F.DIST. * @@ -16,18 +19,23 @@ class F * if the variability in the females is different from that found in the males. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $u The numerator degrees of freedom as an integer + * Or can be an array of values * @param mixed $v The denominator degrees of freedom as an integer + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $u, $v, $cumulative) { - $value = Functions::flattenSingleValue($value); - $u = Functions::flattenSingleValue($u); - $v = Functions::flattenSingleValue($v); - $cumulative = Functions::flattenSingleValue($cumulative); + if (is_array($value) || is_array($u) || is_array($v) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $u, $v, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -39,7 +47,7 @@ public static function distribution($value, $u, $v, $cumulative) } if ($value < 0 || $u < 1 || $v < 1) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php index 923bf02..df9906e 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Fisher { + use ArrayEnabled; + /** * FISHER. * @@ -15,12 +18,17 @@ class Fisher * testing on the correlation coefficient. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value) { - $value = Functions::flattenSingleValue($value); + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } try { DistributionValidations::validateFloat($value); @@ -29,7 +37,7 @@ public static function distribution($value) } if (($value <= -1) || ($value >= 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } return 0.5 * log((1 + $value) / (1 - $value)); @@ -43,12 +51,17 @@ public static function distribution($value) * FISHERINV(y) = x. * * @param mixed $probability Float probability at which you want to evaluate the distribution + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($probability) { - $probability = Functions::flattenSingleValue($probability); + if (is_array($probability)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $probability); + } try { DistributionValidations::validateFloat($probability); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php index 2c6ed67..216f234 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php @@ -2,23 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Gamma extends GammaBase { + use ArrayEnabled; + /** * GAMMA. * * Return the gamma function value. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function gamma($value) { - $value = Functions::flattenSingleValue($value); + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } try { $value = DistributionValidations::validateFloat($value); @@ -27,7 +35,7 @@ public static function gamma($value) } if ((((int) $value) == ((float) $value)) && $value <= 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::gammaValue($value); @@ -39,17 +47,23 @@ public static function gamma($value) * Returns the gamma distribution. * * @param mixed $value Float Value at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $a Parameter to the distribution as a float + * Or can be an array of values * @param mixed $b Parameter to the distribution as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $a, $b, $cumulative) { - $value = Functions::flattenSingleValue($value); - $a = Functions::flattenSingleValue($a); - $b = Functions::flattenSingleValue($b); + if (is_array($value) || is_array($a) || is_array($b) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $a, $b, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -61,7 +75,7 @@ public static function distribution($value, $a, $b, $cumulative) } if (($value < 0) || ($a <= 0) || ($b <= 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculateDistribution($value, $a, $b, $cumulative); @@ -73,16 +87,21 @@ public static function distribution($value, $a, $b, $cumulative) * Returns the inverse of the Gamma distribution. * * @param mixed $probability Float probability at which you want to evaluate the distribution + * Or can be an array of values * @param mixed $alpha Parameter to the distribution as a float + * Or can be an array of values * @param mixed $beta Parameter to the distribution as a float + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($probability, $alpha, $beta) { - $probability = Functions::flattenSingleValue($probability); - $alpha = Functions::flattenSingleValue($alpha); - $beta = Functions::flattenSingleValue($beta); + if (is_array($probability) || is_array($alpha) || is_array($beta)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $alpha, $beta); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -93,7 +112,7 @@ public static function inverse($probability, $alpha, $beta) } if (($alpha <= 0.0) || ($beta <= 0.0)) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculateInverse($probability, $alpha, $beta); @@ -105,12 +124,17 @@ public static function inverse($probability, $alpha, $beta) * Returns the natural logarithm of the gamma function. * * @param mixed $value Float Value at which you want to evaluate the distribution + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function ln($value) { - $value = Functions::flattenSingleValue($value); + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } try { $value = DistributionValidations::validateFloat($value); @@ -119,7 +143,7 @@ public static function ln($value) } if ($value <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return log(self::gammaValue($value)); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php index 89170f7..404230b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/GammaBase.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; abstract class GammaBase { @@ -65,7 +66,7 @@ protected static function calculateInverse(float $probability, float $alpha, flo } if ($i === self::MAX_ITERATIONS) { - return Functions::NA(); + return ExcelError::NA(); } return $x; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php index fe30c08..b3ad69d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Combinations; class HyperGeometric { + use ArrayEnabled; + /** * HYPGEOMDIST. * @@ -15,18 +18,32 @@ class HyperGeometric * sample successes, given the sample size, population successes, and population size. * * @param mixed $sampleSuccesses Integer number of successes in the sample + * Or can be an array of values * @param mixed $sampleNumber Integer size of the sample + * Or can be an array of values * @param mixed $populationSuccesses Integer number of successes in the population + * Or can be an array of values * @param mixed $populationNumber Integer population size + * Or can be an array of values * - * @return float|string + * @return array|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) { - $sampleSuccesses = Functions::flattenSingleValue($sampleSuccesses); - $sampleNumber = Functions::flattenSingleValue($sampleNumber); - $populationSuccesses = Functions::flattenSingleValue($populationSuccesses); - $populationNumber = Functions::flattenSingleValue($populationNumber); + if ( + is_array($sampleSuccesses) || is_array($sampleNumber) || + is_array($populationSuccesses) || is_array($populationNumber) + ) { + return self::evaluateArrayArguments( + [self::class, __FUNCTION__], + $sampleSuccesses, + $sampleNumber, + $populationSuccesses, + $populationNumber + ); + } try { $sampleSuccesses = DistributionValidations::validateInt($sampleSuccesses); @@ -38,13 +55,13 @@ public static function distribution($sampleSuccesses, $sampleNumber, $population } if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) { - return Functions::NAN(); + return ExcelError::NAN(); } if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) { - return Functions::NAN(); + return ExcelError::NAN(); } if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) { - return Functions::NAN(); + return ExcelError::NAN(); } $successesPopulationAndSample = (float) Combinations::withoutRepetition($populationSuccesses, $sampleSuccesses); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php index e152377..d572d23 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class LogNormal { + use ArrayEnabled; + /** * LOGNORMDIST. * @@ -14,16 +17,21 @@ class LogNormal * with parameters mean and standard_dev. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $mean Mean value as a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function cumulative($value, $mean, $stdDev) { - $value = Functions::flattenSingleValue($value); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); + if (is_array($value) || is_array($mean) || is_array($stdDev)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $mean, $stdDev); + } try { $value = DistributionValidations::validateFloat($value); @@ -34,7 +42,7 @@ public static function cumulative($value, $mean, $stdDev) } if (($value <= 0) || ($stdDev <= 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } return StandardNormal::cumulative((log($value) - $mean) / $stdDev); @@ -47,18 +55,23 @@ public static function cumulative($value, $mean, $stdDev) * with parameters mean and standard_dev. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $mean Mean value as a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $mean, $stdDev, $cumulative = false) { - $value = Functions::flattenSingleValue($value); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); - $cumulative = Functions::flattenSingleValue($cumulative); + if (is_array($value) || is_array($mean) || is_array($stdDev) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $mean, $stdDev, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -70,7 +83,7 @@ public static function distribution($value, $mean, $stdDev, $cumulative = false) } if (($value <= 0) || ($stdDev <= 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative === true) { @@ -87,10 +100,15 @@ public static function distribution($value, $mean, $stdDev, $cumulative = false) * Returns the inverse of the lognormal cumulative distribution * * @param mixed $probability Float probability for which we want the value + * Or can be an array of values * @param mixed $mean Mean Value as a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions * * @TODO Try implementing P J Acklam's refinement algorithm for greater * accuracy if I can get my head round the mathematics @@ -98,9 +116,9 @@ public static function distribution($value, $mean, $stdDev, $cumulative = false) */ public static function inverse($probability, $mean, $stdDev) { - $probability = Functions::flattenSingleValue($probability); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); + if (is_array($probability) || is_array($mean) || is_array($stdDev)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $mean, $stdDev); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -111,9 +129,11 @@ public static function inverse($probability, $mean, $stdDev) } if ($stdDev <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } + /** @var float */ + $inverse = StandardNormal::inverse($probability); - return exp($mean + $stdDev * StandardNormal::inverse($probability)); + return exp($mean + $stdDev * $inverse); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php index 2621167..b994864 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/NewtonRaphson.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class NewtonRaphson { @@ -54,7 +55,7 @@ public function execute(float $probability) } if ($i == self::MAX_ITERATIONS) { - return Functions::NA(); + return ExcelError::NA(); } return $x; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php index 4d158b8..67533c4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Normal { + use ArrayEnabled; + public const SQRT2PI = 2.5066282746310005024157652848110452530069867406099; /** @@ -18,17 +21,23 @@ class Normal * testing. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $mean Mean value as a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $mean, $stdDev, $cumulative) { - $value = Functions::flattenSingleValue($value); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); + if (is_array($value) || is_array($mean) || is_array($stdDev) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $mean, $stdDev, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -40,7 +49,7 @@ public static function distribution($value, $mean, $stdDev, $cumulative) } if ($stdDev < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative) { @@ -56,16 +65,21 @@ public static function distribution($value, $mean, $stdDev, $cumulative) * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. * * @param mixed $probability Float probability for which we want the value + * Or can be an array of values * @param mixed $mean Mean Value as a float + * Or can be an array of values * @param mixed $stdDev Standard Deviation as a float + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($probability, $mean, $stdDev) { - $probability = Functions::flattenSingleValue($probability); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); + if (is_array($probability) || is_array($mean) || is_array($stdDev)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $mean, $stdDev); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -76,7 +90,7 @@ public static function inverse($probability, $mean, $stdDev) } if ($stdDev < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return (self::inverseNcdf($probability) * $stdDev) + $mean; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php index e7252e0..041c34a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php @@ -2,12 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; class Poisson { + use ArrayEnabled; + /** * POISSON. * @@ -16,15 +19,21 @@ class Poisson * cars arriving at a toll plaza in 1 minute. * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $mean Mean value as a float + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $mean, $cumulative) { - $value = Functions::flattenSingleValue($value); - $mean = Functions::flattenSingleValue($mean); + if (is_array($value) || is_array($mean) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $mean, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -35,19 +44,23 @@ public static function distribution($value, $mean, $cumulative) } if (($value < 0) || ($mean < 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative) { $summer = 0; $floor = floor($value); for ($i = 0; $i <= $floor; ++$i) { - $summer += $mean ** $i / MathTrig\Factorial::fact($i); + /** @var float */ + $fact = MathTrig\Factorial::fact($i); + $summer += $mean ** $i / $fact; } return exp(0 - $mean) * $summer; } + /** @var float */ + $fact = MathTrig\Factorial::fact($value); - return (exp(0 - $mean) * $mean ** $value) / MathTrig\Factorial::fact($value); + return (exp(0 - $mean) * $mean ** $value) / $fact; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php index d10f02a..a655fa7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php @@ -2,12 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Averages; use PhpOffice\PhpSpreadsheet\Calculation\Statistical\StandardDeviations; class StandardNormal { + use ArrayEnabled; + /** * NORMSDIST. * @@ -15,9 +19,16 @@ class StandardNormal * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a * table of standard normal curve areas. * + * NOTE: We don't need to check for arrays to array-enable this function, because that is already + * handled by the logic in Normal::distribution() + * All we need to do is pass the value through as scalar or as array. + * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function cumulative($value) { @@ -31,10 +42,18 @@ public static function cumulative($value) * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a * table of standard normal curve areas. * + * NOTE: We don't need to check for arrays to array-enable this function, because that is already + * handled by the logic in Normal::distribution() + * All we need to do is pass the value and cumulative through as scalar or as array. + * * @param mixed $value Float value for which we want the probability + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $cumulative) { @@ -46,9 +65,16 @@ public static function distribution($value, $cumulative) * * Returns the inverse of the standard normal cumulative distribution * - * @param mixed $value Float probability for which we want the value + * @param mixed $value float probability for which we want the value + * Or can be an array of values + * + * NOTE: We don't need to check for arrays to array-enable this function, because that is already + * handled by the logic in Normal::inverse() + * All we need to do is pass the value through as scalar or as array * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($value) { @@ -62,17 +88,25 @@ public static function inverse($value) * the mean and z standard deviations from the mean. * * @param mixed $value + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function gauss($value) { - $value = Functions::flattenSingleValue($value); + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + if (!is_numeric($value)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } + /** @var float */ + $dist = self::distribution($value, true); - return self::distribution($value, true) - 0.5; + return $dist - 0.5; } /** @@ -85,22 +119,29 @@ public static function gauss($value) * * @param mixed $dataSet The dataset should be an array of float values for the observations * @param mixed $m0 Alpha Parameter + * Or can be an array of values * @param mixed $sigma A null or float value for the Beta (Standard Deviation) Parameter; * if null, we use the standard deviation of the dataset + * Or can be an array of values * - * @return float|string (string if result is an error) + * @return array|float|string (string if result is an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function zTest($dataSet, $m0, $sigma = null) { + if (is_array($m0) || is_array($sigma)) { + return self::evaluateArrayArgumentsSubsetFrom([self::class, __FUNCTION__], 1, $dataSet, $m0, $sigma); + } + $dataSet = Functions::flattenArrayIndexed($dataSet); - $m0 = Functions::flattenSingleValue($m0); - $sigma = Functions::flattenSingleValue($sigma); if (!is_numeric($m0) || ($sigma !== null && !is_numeric($sigma))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } if ($sigma === null) { + /** @var float */ $sigma = StandardDeviations::STDEV($dataSet); } $n = count($dataSet); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php index 45d590d..8afc5c4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php @@ -2,11 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class StudentT { + use ArrayEnabled; + private const MAX_ITERATIONS = 256; /** @@ -15,16 +19,21 @@ class StudentT * Returns the probability of Student's T distribution. * * @param mixed $value Float value for the distribution + * Or can be an array of values * @param mixed $degrees Integer value for degrees of freedom + * Or can be an array of values * @param mixed $tails Integer value for the number of tails (1 or 2) + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $degrees, $tails) { - $value = Functions::flattenSingleValue($value); - $degrees = Functions::flattenSingleValue($degrees); - $tails = Functions::flattenSingleValue($tails); + if (is_array($value) || is_array($degrees) || is_array($tails)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $degrees, $tails); + } try { $value = DistributionValidations::validateFloat($value); @@ -35,7 +44,7 @@ public static function distribution($value, $degrees, $tails) } if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::calculateDistribution($value, $degrees, $tails); @@ -47,14 +56,19 @@ public static function distribution($value, $degrees, $tails) * Returns the one-tailed probability of the chi-squared distribution. * * @param mixed $probability Float probability for the function + * Or can be an array of values * @param mixed $degrees Integer value for degrees of freedom + * Or can be an array of values * - * @return float|string The result, or a string containing an error + * @return array|float|string The result, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function inverse($probability, $degrees) { - $probability = Functions::flattenSingleValue($probability); - $degrees = Functions::flattenSingleValue($degrees); + if (is_array($probability) || is_array($degrees)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $probability, $degrees); + } try { $probability = DistributionValidations::validateProbability($probability); @@ -64,7 +78,7 @@ public static function inverse($probability, $degrees) } if ($degrees <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $callback = function ($value) use ($degrees) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php index ecec8a8..51392c4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php @@ -2,11 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Weibull { + use ArrayEnabled; + /** * WEIBULL. * @@ -14,18 +17,23 @@ class Weibull * analysis, such as calculating a device's mean time to failure. * * @param mixed $value Float value for the distribution + * Or can be an array of values * @param mixed $alpha Float alpha Parameter + * Or can be an array of values * @param mixed $beta Float beta Parameter + * Or can be an array of values * @param mixed $cumulative Boolean value indicating if we want the cdf (true) or the pdf (false) + * Or can be an array of values * - * @return float|string (string if result is an error) + * @return array|float|string (string if result is an error) + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function distribution($value, $alpha, $beta, $cumulative) { - $value = Functions::flattenSingleValue($value); - $alpha = Functions::flattenSingleValue($alpha); - $beta = Functions::flattenSingleValue($beta); - $cumulative = Functions::flattenSingleValue($cumulative); + if (is_array($value) || is_array($alpha) || is_array($beta) || is_array($cumulative)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $alpha, $beta, $cumulative); + } try { $value = DistributionValidations::validateFloat($value); @@ -37,7 +45,7 @@ public static function distribution($value, $alpha, $beta, $cumulative) } if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) { - return Functions::NAN(); + return ExcelError::NAN(); } if ($cumulative) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php index 16cb06e..9973823 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php @@ -4,6 +4,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Percentiles { @@ -37,7 +38,7 @@ public static function PERCENTILE(...$args) } if (($entry < 0) || ($entry > 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } $mArgs = self::percentileFilterValues($aArgs); @@ -56,7 +57,7 @@ public static function PERCENTILE(...$args) return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); } - return Functions::NAN(); + return ExcelError::NAN(); } /** @@ -89,13 +90,13 @@ public static function PERCENTRANK($valueSet, $value, $significance = 3) $valueSet = self::rankFilterValues($valueSet); $valueCount = count($valueSet); if ($valueCount == 0) { - return Functions::NA(); + return ExcelError::NA(); } sort($valueSet, SORT_NUMERIC); $valueAdjustor = $valueCount - 1; if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) { - return Functions::NA(); + return ExcelError::NA(); } $pos = array_search($value, $valueSet); @@ -138,7 +139,7 @@ public static function QUARTILE(...$args) $entry = floor($entry); $entry /= 4; if (($entry < 0) || ($entry > 1)) { - return Functions::NAN(); + return ExcelError::NAN(); } return self::PERCENTILE($aArgs, $entry); @@ -177,7 +178,7 @@ public static function RANK($value, $valueSet, $order = self::RANK_SORT_DESCENDI $pos = array_search($value, $valueSet); if ($pos === false) { - return Functions::NA(); + return ExcelError::NA(); } return ++$pos; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php index 272a8a5..5d9d304 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php @@ -2,13 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Shared\IntOrFloat; class Permutations { + use ArrayEnabled; + /** * PERMUT. * @@ -19,14 +22,19 @@ class Permutations * for lottery-style probability calculations. * * @param mixed $numObjs Integer number of different objects + * Or can be an array of values * @param mixed $numInSet Integer number of objects in each permutation + * Or can be an array of values * - * @return float|int|string Number of permutations, or a string containing an error + * @return array|float|int|string Number of permutations, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function PERMUT($numObjs, $numInSet) { - $numObjs = Functions::flattenSingleValue($numObjs); - $numInSet = Functions::flattenSingleValue($numInSet); + if (is_array($numObjs) || is_array($numInSet)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $numObjs, $numInSet); + } try { $numObjs = StatisticalValidations::validateInt($numObjs); @@ -36,7 +44,7 @@ public static function PERMUT($numObjs, $numInSet) } if ($numObjs < $numInSet) { - return Functions::NAN(); + return ExcelError::NAN(); } $result = round(MathTrig\Factorial::fact($numObjs) / MathTrig\Factorial::fact($numObjs - $numInSet)); @@ -50,14 +58,19 @@ public static function PERMUT($numObjs, $numInSet) * that can be selected from the total objects. * * @param mixed $numObjs Integer number of different objects + * Or can be an array of values * @param mixed $numInSet Integer number of objects in each permutation + * Or can be an array of values * - * @return float|int|string Number of permutations, or a string containing an error + * @return array|float|int|string Number of permutations, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function PERMUTATIONA($numObjs, $numInSet) { - $numObjs = Functions::flattenSingleValue($numObjs); - $numInSet = Functions::flattenSingleValue($numInSet); + if (is_array($numObjs) || is_array($numInSet)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $numObjs, $numInSet); + } try { $numObjs = StatisticalValidations::validateInt($numObjs); @@ -67,7 +80,7 @@ public static function PERMUTATIONA($numObjs, $numInSet) } if ($numObjs < 0 || $numInSet < 0) { - return Functions::NAN(); + return ExcelError::NAN(); } $result = $numObjs ** $numInSet; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Size.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Size.php index de4b6d6..2eef5fc 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Size.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Size.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Size { @@ -30,15 +31,15 @@ public static function large(...$args) $mArgs = self::filter($aArgs); $count = Counts::COUNT($mArgs); --$entry; - if (($entry < 0) || ($entry >= $count) || ($count == 0)) { - return Functions::NAN(); + if ($count === 0 || $entry < 0 || $entry >= $count) { + return ExcelError::NAN(); } rsort($mArgs); return $mArgs[$entry]; } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** @@ -66,15 +67,15 @@ public static function small(...$args) $mArgs = self::filter($aArgs); $count = Counts::COUNT($mArgs); --$entry; - if (($entry < 0) || ($entry >= $count) || ($count == 0)) { - return Functions::NAN(); + if ($count === 0 || $entry < 0 || $entry >= $count) { + return ExcelError::NAN(); } sort($mArgs); return $mArgs[$entry]; } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Standardize.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Standardize.php index 2f3c58e..51b0a51 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Standardize.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Standardize.php @@ -2,27 +2,35 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Standardize extends StatisticalValidations { + use ArrayEnabled; + /** * STANDARDIZE. * * Returns a normalized value from a distribution characterized by mean and standard_dev. * - * @param float $value Value to normalize - * @param float $mean Mean Value - * @param float $stdDev Standard Deviation + * @param array|float $value Value to normalize + * Or can be an array of values + * @param array|float $mean Mean Value + * Or can be an array of values + * @param array|float $stdDev Standard Deviation + * Or can be an array of values * - * @return float|string Standardized value, or a string containing an error + * @return array|float|string Standardized value, or a string containing an error + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function execute($value, $mean, $stdDev) { - $value = Functions::flattenSingleValue($value); - $mean = Functions::flattenSingleValue($mean); - $stdDev = Functions::flattenSingleValue($stdDev); + if (is_array($value) || is_array($mean) || is_array($stdDev)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $mean, $stdDev); + } try { $value = self::validateFloat($value); @@ -33,7 +41,7 @@ public static function execute($value, $mean, $stdDev) } if ($stdDev <= 0) { - return Functions::NAN(); + return ExcelError::NAN(); } return ($value - $mean) / $stdDev; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/StatisticalValidations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/StatisticalValidations.php index 5b315da..e23a52c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/StatisticalValidations.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/StatisticalValidations.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Exception; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class StatisticalValidations { @@ -13,7 +13,7 @@ class StatisticalValidations public static function validateFloat($value): float { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (float) $value; @@ -25,7 +25,7 @@ public static function validateFloat($value): float public static function validateInt($value): int { if (!is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (int) floor((float) $value); @@ -37,7 +37,7 @@ public static function validateInt($value): int public static function validateBool($value): bool { if (!is_bool($value) && !is_numeric($value)) { - throw new Exception(Functions::VALUE()); + throw new Exception(ExcelError::VALUE()); } return (bool) $value; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Trends.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Trends.php index 93724a8..af73519 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Trends.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Trends.php @@ -2,12 +2,16 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\Trend\Trend; class Trends { + use ArrayEnabled; + private static function filterTrendValues(array &$array1, array &$array2): void { foreach ($array1 as $key => $value) { @@ -43,9 +47,9 @@ protected static function validateTrendArrays(array $yValues, array $xValues): v $xValueCount = count($xValues); if (($yValueCount === 0) || ($yValueCount !== $xValueCount)) { - throw new Exception(Functions::NA()); + throw new Exception(ExcelError::NA()); } elseif ($yValueCount === 1) { - throw new Exception(Functions::DIV0()); + throw new Exception(ExcelError::DIV0()); } } @@ -62,7 +66,7 @@ protected static function validateTrendArrays(array $yValues, array $xValues): v public static function CORREL($yValues, $xValues = null) { if (($xValues === null) || (!is_array($yValues)) || (!is_array($xValues))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } try { @@ -108,14 +112,19 @@ public static function COVAR($yValues, $xValues) * The predicted value is a y-value for a given x-value. * * @param mixed $xValue Float value of X for which we want to find Y + * Or can be an array of values * @param mixed $yValues array of mixed Data Series Y * @param mixed $xValues of mixed Data Series X * - * @return bool|float|string + * @return array|bool|float|string + * If an array of numbers is passed as an argument, then the returned result will also be an array + * with the same dimensions */ public static function FORECAST($xValue, $yValues, $xValues) { - $xValue = Functions::flattenSingleValue($xValue); + if (is_array($xValue)) { + return self::evaluateArrayArgumentsSubset([self::class, __FUNCTION__], 1, $xValue, $yValues, $xValues); + } try { $xValue = StatisticalValidations::validateFloat($xValue); @@ -224,7 +233,7 @@ public static function LINEST($yValues, $xValues = null, $const = true, $stats = ], [ $bestFitLinear->getSlopeSE(), - ($const === false) ? Functions::NA() : $bestFitLinear->getIntersectSE(), + ($const === false) ? ExcelError::NA() : $bestFitLinear->getIntersectSE(), ], [ $bestFitLinear->getGoodnessOfFit(), @@ -277,7 +286,7 @@ public static function LOGEST($yValues, $xValues = null, $const = true, $stats = foreach ($yValues as $value) { if ($value < 0.0) { - return Functions::NAN(); + return ExcelError::NAN(); } } @@ -291,7 +300,7 @@ public static function LOGEST($yValues, $xValues = null, $const = true, $stats = ], [ $bestFitExponential->getSlopeSE(), - ($const === false) ? Functions::NA() : $bestFitExponential->getIntersectSE(), + ($const === false) ? ExcelError::NA() : $bestFitExponential->getIntersectSE(), ], [ $bestFitExponential->getGoodnessOfFit(), diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Variances.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Variances.php index ac9c332..35d01d1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Variances.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical/Variances.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Variances extends VarianceBase { @@ -20,7 +21,7 @@ class Variances extends VarianceBase */ public static function VAR(...$args) { - $returnValue = Functions::DIV0(); + $returnValue = ExcelError::DIV0(); $summerA = $summerB = 0.0; @@ -62,7 +63,7 @@ public static function VAR(...$args) */ public static function VARA(...$args) { - $returnValue = Functions::DIV0(); + $returnValue = ExcelError::DIV0(); $summerA = $summerB = 0.0; @@ -71,7 +72,7 @@ public static function VARA(...$args) $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_string($arg)) && (Functions::isValue($k))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } elseif ((is_string($arg)) && (!Functions::isMatrixValue($k))) { } else { // Is it a numeric value? @@ -109,7 +110,7 @@ public static function VARA(...$args) public static function VARP(...$args) { // Return value - $returnValue = Functions::DIV0(); + $returnValue = ExcelError::DIV0(); $summerA = $summerB = 0.0; @@ -151,7 +152,7 @@ public static function VARP(...$args) */ public static function VARPA(...$args) { - $returnValue = Functions::DIV0(); + $returnValue = ExcelError::DIV0(); $summerA = $summerB = 0.0; @@ -160,7 +161,7 @@ public static function VARPA(...$args) $aCount = 0; foreach ($aArgs as $k => $arg) { if ((is_string($arg)) && (Functions::isValue($k))) { - return Functions::VALUE(); + return ExcelError::VALUE(); } elseif ((is_string($arg)) && (!Functions::isMatrixValue($k))) { } else { // Is it a numeric value? diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php index 0bde3b7..6757a8d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php @@ -18,7 +18,7 @@ class TextData * * @param string $character Value * - * @return string + * @return array|string */ public static function CHARACTER($character) { @@ -34,7 +34,7 @@ public static function CHARACTER($character) * * @param mixed $stringValue Value to check * - * @return string + * @return null|array|string */ public static function TRIMNONPRINTABLE($stringValue = '') { @@ -50,7 +50,7 @@ public static function TRIMNONPRINTABLE($stringValue = '') * * @param mixed $stringValue Value to check * - * @return string + * @return array|string */ public static function TRIMSPACES($stringValue = '') { @@ -64,9 +64,9 @@ public static function TRIMSPACES($stringValue = '') * * @see Use the code() method in the TextData\CharacterConvert class instead * - * @param string $characters Value + * @param array|string $characters Value * - * @return int|string A string if arguments are invalid + * @return array|int|string A string if arguments are invalid */ public static function ASCIICODE($characters) { @@ -102,7 +102,7 @@ public static function CONCATENATE(...$args) * If decimals is negative, number is rounded to the left of the decimal point. * If you omit decimals, it is assumed to be 2 * - * @return string + * @return array|string */ public static function DOLLAR($value = 0, $decimals = 2) { @@ -110,17 +110,17 @@ public static function DOLLAR($value = 0, $decimals = 2) } /** - * SEARCHSENSITIVE. + * FIND. * * @Deprecated 1.18.0 * * @see Use the sensitive() method in the TextData\Search class instead * - * @param string $needle The string to look for - * @param string $haystack The string in which to look - * @param int $offset Offset within $haystack + * @param array|string $needle The string to look for + * @param array|string $haystack The string in which to look + * @param array|int $offset Offset within $haystack * - * @return string + * @return array|int|string */ public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) { @@ -128,17 +128,17 @@ public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) } /** - * SEARCHINSENSITIVE. + * SEARCH. * * @Deprecated 1.18.0 * * @see Use the insensitive() method in the TextData\Search class instead * - * @param string $needle The string to look for - * @param string $haystack The string in which to look - * @param int $offset Offset within $haystack + * @param array|string $needle The string to look for + * @param array|string $haystack The string in which to look + * @param array|int $offset Offset within $haystack * - * @return string + * @return array|int|string */ public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) { @@ -156,7 +156,7 @@ public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) * @param int $decimals * @param bool $no_commas * - * @return string + * @return array|string */ public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false) { @@ -170,10 +170,10 @@ public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false) * * @see Use the left() method in the TextData\Extract class instead * - * @param string $value Value - * @param int $chars Number of characters + * @param array|string $value Value + * @param array|int $chars Number of characters * - * @return string + * @return array|string */ public static function LEFT($value = '', $chars = 1) { @@ -187,11 +187,11 @@ public static function LEFT($value = '', $chars = 1) * * @see Use the mid() method in the TextData\Extract class instead * - * @param string $value Value - * @param int $start Start character - * @param int $chars Number of characters + * @param array|string $value Value + * @param array|int $start Start character + * @param array|int $chars Number of characters * - * @return string + * @return array|string */ public static function MID($value = '', $start = 1, $chars = null) { @@ -205,10 +205,10 @@ public static function MID($value = '', $start = 1, $chars = null) * * @see Use the right() method in the TextData\Extract class instead * - * @param string $value Value - * @param int $chars Number of characters + * @param array|string $value Value + * @param array|int $chars Number of characters * - * @return string + * @return array|string */ public static function RIGHT($value = '', $chars = 1) { @@ -224,7 +224,7 @@ public static function RIGHT($value = '', $chars = 1) * * @param string $value Value * - * @return int + * @return array|int */ public static function STRINGLENGTH($value = '') { @@ -234,15 +234,15 @@ public static function STRINGLENGTH($value = '') /** * LOWERCASE. * - * Converts a string value to upper case. + * Converts a string value to lower case. * * @Deprecated 1.18.0 * * @see Use the lower() method in the TextData\CaseConvert class instead * - * @param string $mixedCaseString + * @param array|string $mixedCaseString * - * @return string + * @return array|string */ public static function LOWERCASE($mixedCaseString) { @@ -260,7 +260,7 @@ public static function LOWERCASE($mixedCaseString) * * @param string $mixedCaseString * - * @return string + * @return array|string */ public static function UPPERCASE($mixedCaseString) { @@ -270,15 +270,15 @@ public static function UPPERCASE($mixedCaseString) /** * PROPERCASE. * - * Converts a string value to upper case. + * Converts a string value to proper/title case. * * @Deprecated 1.18.0 * * @see Use the proper() method in the TextData\CaseConvert class instead * - * @param string $mixedCaseString + * @param array|string $mixedCaseString * - * @return string + * @return array|string */ public static function PROPERCASE($mixedCaseString) { @@ -297,7 +297,7 @@ public static function PROPERCASE($mixedCaseString) * @param int $chars Number of characters * @param string $newText String to replace in defined position * - * @return string + * @return array|string */ public static function REPLACE($oldText, $start, $chars, $newText) { @@ -316,7 +316,7 @@ public static function REPLACE($oldText, $start, $chars, $newText) * @param string $toText To Value * @param int $instance Instance Number * - * @return string + * @return array|string */ public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) { @@ -332,7 +332,7 @@ public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $ins * * @param mixed $testValue Value to check * - * @return null|string + * @return null|array|string */ public static function RETURNSTRING($testValue = '') { @@ -349,7 +349,7 @@ public static function RETURNSTRING($testValue = '') * @param mixed $value Value to check * @param string $format Format mask to use * - * @return string + * @return array|string */ public static function TEXTFORMAT($value, $format) { @@ -365,7 +365,7 @@ public static function TEXTFORMAT($value, $format) * * @param mixed $value Value to check * - * @return DateTimeInterface|float|int|string A string if arguments are invalid + * @return array|DateTimeInterface|float|int|string A string if arguments are invalid */ public static function VALUE($value = '') { @@ -383,7 +383,7 @@ public static function VALUE($value = '') * @param string $decimalSeparator decimal separator, defaults to locale defined value * @param string $groupSeparator group/thosands separator, defaults to locale defined value * - * @return float|string + * @return array|float|string */ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $groupSeparator = null) { @@ -402,7 +402,7 @@ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $group * @param mixed $value1 * @param mixed $value2 * - * @return bool + * @return array|bool */ public static function EXACT($value1, $value2) { @@ -420,7 +420,7 @@ public static function EXACT($value1, $value2) * @param mixed $ignoreEmpty * @param mixed $args * - * @return string + * @return array|string */ public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args) { @@ -436,10 +436,10 @@ public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args) * * @see Use the builtinREPT() method in the TextData\Concatenate class instead * - * @param string $str Should be numeric + * @param array|string $str Should be numeric * @param mixed $number Should be int * - * @return string + * @return array|string */ public static function builtinREPT($str, $number) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php index 664cc2d..f1aea16 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php @@ -2,21 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class CaseConvert { + use ArrayEnabled; + /** * LOWERCASE. * * Converts a string value to upper case. * * @param mixed $mixedCaseValue The string value to convert to lower case + * Or can be an array of values + * + * @return array|string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ - public static function lower($mixedCaseValue): string + public static function lower($mixedCaseValue) { - $mixedCaseValue = Functions::flattenSingleValue($mixedCaseValue); + if (is_array($mixedCaseValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue); + } + $mixedCaseValue = Helpers::extractString($mixedCaseValue); return StringHelper::strToLower($mixedCaseValue); @@ -28,10 +38,18 @@ public static function lower($mixedCaseValue): string * Converts a string value to upper case. * * @param mixed $mixedCaseValue The string value to convert to upper case + * Or can be an array of values + * + * @return array|string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ - public static function upper($mixedCaseValue): string + public static function upper($mixedCaseValue) { - $mixedCaseValue = Functions::flattenSingleValue($mixedCaseValue); + if (is_array($mixedCaseValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue); + } + $mixedCaseValue = Helpers::extractString($mixedCaseValue); return StringHelper::strToUpper($mixedCaseValue); @@ -43,10 +61,18 @@ public static function upper($mixedCaseValue): string * Converts a string value to proper or title case. * * @param mixed $mixedCaseValue The string value to convert to title case + * Or can be an array of values + * + * @return array|string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ - public static function proper($mixedCaseValue): string + public static function proper($mixedCaseValue) { - $mixedCaseValue = Functions::flattenSingleValue($mixedCaseValue); + if (is_array($mixedCaseValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue); + } + $mixedCaseValue = Helpers::extractString($mixedCaseValue); return StringHelper::strToTitle($mixedCaseValue); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php index 0aca57e..83af499 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php @@ -2,21 +2,34 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class CharacterConvert { + use ArrayEnabled; + /** * CHAR. * * @param mixed $character Integer Value to convert to its character representation + * Or can be an array of values + * + * @return array|string The character string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ - public static function character($character): string + public static function character($character) { + if (is_array($character)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $character); + } + $character = Helpers::validateInt($character); $min = Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE ? 0 : 1; if ($character < $min || $character > 255) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $result = iconv('UCS-4LE', 'UTF-8', pack('V', $character)); @@ -27,14 +40,21 @@ public static function character($character): string * CODE. * * @param mixed $characters String character to convert to its ASCII value + * Or can be an array of values * - * @return int|string A string if arguments are invalid + * @return array|int|string A string if arguments are invalid + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function code($characters) { + if (is_array($characters)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $characters); + } + $characters = Helpers::extractString($characters); if ($characters === '') { - return Functions::VALUE(); + return ExcelError::VALUE(); } $character = $characters; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php index d53fc82..4413b4a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php @@ -2,10 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Concatenate { + use ArrayEnabled; + /** * CONCATENATE. * @@ -28,14 +32,28 @@ public static function CONCATENATE(...$args): string /** * TEXTJOIN. * - * @param mixed $delimiter - * @param mixed $ignoreEmpty - * @param mixed $args + * @param mixed $delimiter The delimter to use between the joined arguments + * Or can be an array of values + * @param mixed $ignoreEmpty true/false Flag indicating whether empty arguments should be skipped + * Or can be an array of values + * @param mixed $args The values to join + * + * @return array|string The joined string + * If an array of values is passed for the $delimiter or $ignoreEmpty arguments, then the returned result + * will also be an array with matching dimensions */ - public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args): string + public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args) { - $delimiter = Functions::flattenSingleValue($delimiter); - $ignoreEmpty = Functions::flattenSingleValue($ignoreEmpty); + if (is_array($delimiter) || is_array($ignoreEmpty)) { + return self::evaluateArrayArgumentsSubset( + [self::class, __FUNCTION__], + 2, + $delimiter, + $ignoreEmpty, + ...$args + ); + } + // Loop through arguments $aArgs = Functions::flattenArray($args); foreach ($aArgs as $key => &$arg) { @@ -55,15 +73,24 @@ public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args): string * Returns the result of builtin function round after validating args. * * @param mixed $stringValue The value to repeat + * Or can be an array of values * @param mixed $repeatCount The number of times the string value should be repeated + * Or can be an array of values + * + * @return array|string The repeated string + * If an array of values is passed for the $stringValue or $repeatCount arguments, then the returned result + * will also be an array with matching dimensions */ - public static function builtinREPT($stringValue, $repeatCount): string + public static function builtinREPT($stringValue, $repeatCount) { - $repeatCount = Functions::flattenSingleValue($repeatCount); + if (is_array($stringValue) || is_array($repeatCount)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $stringValue, $repeatCount); + } + $stringValue = Helpers::extractString($stringValue); if (!is_numeric($repeatCount) || $repeatCount < 0) { - return Functions::VALUE(); + return ExcelError::VALUE(); } return str_repeat($stringValue, (int) $repeatCount); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php index 7f18e0c..d29f80c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php @@ -2,18 +2,31 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp; class Extract { + use ArrayEnabled; + /** * LEFT. * * @param mixed $value String value from which to extract characters + * Or can be an array of values * @param mixed $chars The number of characters to extract (as an integer) + * Or can be an array of values + * + * @return array|string The joined string + * If an array of values is passed for the $value or $chars arguments, then the returned result + * will also be an array with matching dimensions */ - public static function left($value, $chars = 1): string + public static function left($value, $chars = 1) { + if (is_array($value) || is_array($chars)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $chars); + } + try { $value = Helpers::extractString($value); $chars = Helpers::extractInt($chars, 0, 1); @@ -28,11 +41,22 @@ public static function left($value, $chars = 1): string * MID. * * @param mixed $value String value from which to extract characters + * Or can be an array of values * @param mixed $start Integer offset of the first character that we want to extract + * Or can be an array of values * @param mixed $chars The number of characters to extract (as an integer) + * Or can be an array of values + * + * @return array|string The joined string + * If an array of values is passed for the $value, $start or $chars arguments, then the returned result + * will also be an array with matching dimensions */ - public static function mid($value, $start, $chars): string + public static function mid($value, $start, $chars) { + if (is_array($value) || is_array($start) || is_array($chars)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $start, $chars); + } + try { $value = Helpers::extractString($value); $start = Helpers::extractInt($start, 1); @@ -48,10 +72,20 @@ public static function mid($value, $start, $chars): string * RIGHT. * * @param mixed $value String value from which to extract characters + * Or can be an array of values * @param mixed $chars The number of characters to extract (as an integer) + * Or can be an array of values + * + * @return array|string The joined string + * If an array of values is passed for the $value or $chars arguments, then the returned result + * will also be an array with matching dimensions */ - public static function right($value, $chars = 1): string + public static function right($value, $chars = 1) { + if (is_array($value) || is_array($chars)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $chars); + } + try { $value = Helpers::extractString($value); $chars = Helpers::extractInt($chars, 0, 1); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php index 3286de0..bec1149 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php @@ -3,9 +3,11 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; use DateTimeInterface; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; @@ -13,6 +15,8 @@ class Format { + use ArrayEnabled; + /** * DOLLAR. * @@ -20,12 +24,22 @@ class Format * The format used is $#,##0.00_);($#,##0.00).. * * @param mixed $value The value to format + * Or can be an array of values * @param mixed $decimals The number of digits to display to the right of the decimal point (as an integer). * If decimals is negative, number is rounded to the left of the decimal point. * If you omit decimals, it is assumed to be 2 + * Or can be an array of values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function DOLLAR($value = 0, $decimals = 2): string + public static function DOLLAR($value = 0, $decimals = 2) { + if (is_array($value) || is_array($decimals)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $decimals); + } + try { $value = Helpers::extractFloat($value); $decimals = Helpers::extractInt($decimals, -100, 0, true); @@ -52,15 +66,25 @@ public static function DOLLAR($value = 0, $decimals = 2): string * FIXED. * * @param mixed $value The value to format + * Or can be an array of values * @param mixed $decimals Integer value for the number of decimal places that should be formatted + * Or can be an array of values * @param mixed $noCommas Boolean value indicating whether the value should have thousands separators or not + * Or can be an array of values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function FIXEDFORMAT($value, $decimals = 2, $noCommas = false): string + public static function FIXEDFORMAT($value, $decimals = 2, $noCommas = false) { + if (is_array($value) || is_array($decimals) || is_array($noCommas)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $decimals, $noCommas); + } + try { $value = Helpers::extractFloat($value); $decimals = Helpers::extractInt($decimals, -100, 0, true); - $noCommas = Functions::flattenSingleValue($noCommas); } catch (CalcExp $e) { return $e->getMessage(); } @@ -85,10 +109,20 @@ public static function FIXEDFORMAT($value, $decimals = 2, $noCommas = false): st * TEXT. * * @param mixed $value The value to format + * Or can be an array of values * @param mixed $format A string with the Format mask that should be used + * Or can be an array of values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function TEXTFORMAT($value, $format): string + public static function TEXTFORMAT($value, $format) { + if (is_array($value) || is_array($format)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $format); + } + $value = Helpers::extractString($value); $format = Helpers::extractString($format); @@ -106,12 +140,12 @@ public static function TEXTFORMAT($value, $format): string */ private static function convertValue($value) { - $value = ($value === null) ? 0 : Functions::flattenSingleValue($value); + $value = $value ?? 0; if (is_bool($value)) { if (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE) { $value = (int) $value; } else { - throw new CalcExp(Functions::VALUE()); + throw new CalcExp(ExcelError::VALUE()); } } @@ -122,11 +156,18 @@ private static function convertValue($value) * VALUE. * * @param mixed $value Value to check + * Or can be an array of values * - * @return DateTimeInterface|float|int|string A string if arguments are invalid + * @return array|DateTimeInterface|float|int|string A string if arguments are invalid + * If an array of values is passed for the argument, then the returned result + * will also be an array with matching dimensions */ public static function VALUE($value = '') { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + try { $value = self::convertValue($value); } catch (CalcExp $e) { @@ -146,22 +187,22 @@ public static function VALUE($value = '') Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); if (strpos($value, ':') !== false) { - $timeValue = DateTimeExcel\TimeValue::fromString($value); - if ($timeValue !== Functions::VALUE()) { + $timeValue = Functions::scalar(DateTimeExcel\TimeValue::fromString($value)); + if ($timeValue !== ExcelError::VALUE()) { Functions::setReturnDateType($dateSetting); return $timeValue; } } - $dateValue = DateTimeExcel\DateValue::fromString($value); - if ($dateValue !== Functions::VALUE()) { + $dateValue = Functions::scalar(DateTimeExcel\DateValue::fromString($value)); + if ($dateValue !== ExcelError::VALUE()) { Functions::setReturnDateType($dateSetting); return $dateValue; } Functions::setReturnDateType($dateSetting); - return Functions::VALUE(); + return ExcelError::VALUE(); } return (float) $value; @@ -172,8 +213,6 @@ public static function VALUE($value = '') */ private static function getDecimalSeparator($decimalSeparator): string { - $decimalSeparator = Functions::flattenSingleValue($decimalSeparator); - return empty($decimalSeparator) ? StringHelper::getDecimalSeparator() : (string) $decimalSeparator; } @@ -182,8 +221,6 @@ private static function getDecimalSeparator($decimalSeparator): string */ private static function getGroupSeparator($groupSeparator): string { - $groupSeparator = Functions::flattenSingleValue($groupSeparator); - return empty($groupSeparator) ? StringHelper::getThousandsSeparator() : (string) $groupSeparator; } @@ -191,13 +228,20 @@ private static function getGroupSeparator($groupSeparator): string * NUMBERVALUE. * * @param mixed $value The value to format + * Or can be an array of values * @param mixed $decimalSeparator A string with the decimal separator to use, defaults to locale defined value + * Or can be an array of values * @param mixed $groupSeparator A string with the group/thousands separator to use, defaults to locale defined value + * Or can be an array of values * - * @return float|string + * @return array|float|string */ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $groupSeparator = null) { + if (is_array($value) || is_array($decimalSeparator) || is_array($groupSeparator)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $decimalSeparator, $groupSeparator); + } + try { $value = self::convertValue($value); $decimalSeparator = self::getDecimalSeparator($decimalSeparator); @@ -209,11 +253,11 @@ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $group if (!is_numeric($value)) { $decimalPositions = preg_match_all('/' . preg_quote($decimalSeparator) . '/', $value, $matches, PREG_OFFSET_CAPTURE); if ($decimalPositions > 1) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $decimalOffset = array_pop($matches[0])[1]; if (strpos($value, $groupSeparator, $decimalOffset) !== false) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $value = str_replace([$groupSeparator, $decimalSeparator], ['', '.'], $value); @@ -221,7 +265,7 @@ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $group // Handle the special case of trailing % signs $percentageString = rtrim($value, '%'); if (!is_numeric($percentageString)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } $percentageAdjustment = strlen($value) - strlen($percentageString); @@ -231,6 +275,6 @@ public static function NUMBERVALUE($value = '', $decimalSeparator = null, $group } } - return is_array($value) ? Functions::VALUE() : (float) $value; + return is_array($value) ? ExcelError::VALUE() : (float) $value; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php index 423b6d3..0fdf6af 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php @@ -5,6 +5,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Helpers { @@ -22,7 +23,6 @@ public static function convertBooleanValue(bool $value): string */ public static function extractString($value): string { - $value = Functions::flattenSingleValue($value); if (is_bool($value)) { return self::convertBooleanValue($value); } @@ -35,7 +35,6 @@ public static function extractString($value): string */ public static function extractInt($value, int $minValue, int $gnumericNull = 0, bool $ooBoolOk = false): int { - $value = Functions::flattenSingleValue($value); if ($value === null) { // usually 0, but sometimes 1 for Gnumeric $value = (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_GNUMERIC) ? $gnumericNull : 0; @@ -44,11 +43,11 @@ public static function extractInt($value, int $minValue, int $gnumericNull = 0, $value = (int) $value; } if (!is_numeric($value)) { - throw new CalcExp(Functions::VALUE()); + throw new CalcExp(ExcelError::VALUE()); } $value = (int) $value; if ($value < $minValue) { - throw new CalcExp(Functions::VALUE()); + throw new CalcExp(ExcelError::VALUE()); } return (int) $value; @@ -59,7 +58,6 @@ public static function extractInt($value, int $minValue, int $gnumericNull = 0, */ public static function extractFloat($value): float { - $value = Functions::flattenSingleValue($value); if ($value === null) { $value = 0.0; } @@ -67,7 +65,7 @@ public static function extractFloat($value): float $value = (float) $value; } if (!is_numeric($value)) { - throw new CalcExp(Functions::VALUE()); + throw new CalcExp(ExcelError::VALUE()); } return (float) $value; @@ -78,7 +76,6 @@ public static function extractFloat($value): float */ public static function validateInt($value): int { - $value = Functions::flattenSingleValue($value); if ($value === null) { $value = 0; } elseif (is_bool($value)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php index 36c1359..a07ea10 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php @@ -2,21 +2,37 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; class Replace { + use ArrayEnabled; + /** * REPLACE. * * @param mixed $oldText The text string value to modify + * Or can be an array of values * @param mixed $start Integer offset for start character of the replacement + * Or can be an array of values * @param mixed $chars Integer number of characters to replace from the start offset + * Or can be an array of values * @param mixed $newText String to replace in the defined position + * Or can be an array of values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function replace($oldText, $start, $chars, $newText): string + public static function replace($oldText, $start, $chars, $newText) { + if (is_array($oldText) || is_array($start) || is_array($chars) || is_array($newText)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $oldText, $start, $chars, $newText); + } + try { $start = Helpers::extractInt($start, 1, 0, true); $chars = Helpers::extractInt($chars, 0, 0, true); @@ -36,23 +52,34 @@ public static function replace($oldText, $start, $chars, $newText): string * SUBSTITUTE. * * @param mixed $text The text string value to modify + * Or can be an array of values * @param mixed $fromText The string value that we want to replace in $text + * Or can be an array of values * @param mixed $toText The string value that we want to replace with in $text + * Or can be an array of values * @param mixed $instance Integer instance Number for the occurrence of frmText to change + * Or can be an array of values + * + * @return array|string + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function substitute($text = '', $fromText = '', $toText = '', $instance = null): string + public static function substitute($text = '', $fromText = '', $toText = '', $instance = null) { + if (is_array($text) || is_array($fromText) || is_array($toText) || is_array($instance)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $text, $fromText, $toText, $instance); + } + try { $text = Helpers::extractString($text); $fromText = Helpers::extractString($fromText); $toText = Helpers::extractString($toText); - $instance = Functions::flattenSingleValue($instance); if ($instance === null) { return str_replace($fromText, $toText, $text); } if (is_bool($instance)) { if ($instance === false || Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE) { - return Functions::Value(); + return ExcelError::Value(); } $instance = 1; } @@ -61,6 +88,14 @@ public static function substitute($text = '', $fromText = '', $toText = '', $ins return $e->getMessage(); } + return self::executeSubstitution($text, $fromText, $toText, $instance); + } + + /** + * @return string + */ + private static function executeSubstitution(string $text, string $fromText, string $toText, int $instance) + { $pos = -1; while ($instance > 0) { $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); @@ -71,7 +106,7 @@ public static function substitute($text = '', $fromText = '', $toText = '', $ins } if ($pos !== false) { - return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText); + return Functions::scalar(self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText)); } return $text; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php index c9eed2e..10b6a1a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php @@ -2,23 +2,35 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; class Search { + use ArrayEnabled; + /** * FIND (case sensitive search). * * @param mixed $needle The string to look for + * Or can be an array of values * @param mixed $haystack The string in which to look + * Or can be an array of values * @param mixed $offset Integer offset within $haystack to start searching from + * Or can be an array of values * - * @return int|string + * @return array|int|string The offset where the first occurrence of needle was found in the haystack + * If an array of values is passed for the $value or $chars arguments, then the returned result + * will also be an array with matching dimensions */ public static function sensitive($needle, $haystack, $offset = 1) { + if (is_array($needle) || is_array($haystack) || is_array($offset)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $needle, $haystack, $offset); + } + try { $needle = Helpers::extractString($needle); $haystack = Helpers::extractString($haystack); @@ -38,20 +50,29 @@ public static function sensitive($needle, $haystack, $offset = 1) } } - return Functions::VALUE(); + return ExcelError::VALUE(); } /** * SEARCH (case insensitive search). * * @param mixed $needle The string to look for + * Or can be an array of values * @param mixed $haystack The string in which to look + * Or can be an array of values * @param mixed $offset Integer offset within $haystack to start searching from + * Or can be an array of values * - * @return int|string + * @return array|int|string The offset where the first occurrence of needle was found in the haystack + * If an array of values is passed for the $value or $chars arguments, then the returned result + * will also be an array with matching dimensions */ public static function insensitive($needle, $haystack, $offset = 1) { + if (is_array($needle) || is_array($haystack) || is_array($offset)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $needle, $haystack, $offset); + } + try { $needle = Helpers::extractString($needle); $haystack = Helpers::extractString($haystack); @@ -71,6 +92,6 @@ public static function insensitive($needle, $haystack, $offset = 1) } } - return Functions::VALUE(); + return ExcelError::VALUE(); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php index 6f8253e..490c43c 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php @@ -2,17 +2,28 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; class Text { + use ArrayEnabled; + /** * LEN. * * @param mixed $value String Value + * Or can be an array of values + * + * @return array|int + * If an array of values is passed for the argument, then the returned result + * will also be an array with matching dimensions */ - public static function length($value = ''): int + public static function length($value = '') { + if (is_array($value)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $value); + } + $value = Helpers::extractString($value); return mb_strlen($value ?? '', 'UTF-8'); @@ -24,10 +35,20 @@ public static function length($value = ''): int * Use EXACT to test text being entered into a document. * * @param mixed $value1 String Value + * Or can be an array of values * @param mixed $value2 String Value + * Or can be an array of values + * + * @return array|bool + * If an array of values is passed for either of the arguments, then the returned result + * will also be an array with matching dimensions */ - public static function exact($value1, $value2): bool + public static function exact($value1, $value2) { + if (is_array($value1) || is_array($value2)) { + return self::evaluateArrayArguments([self::class, __FUNCTION__], $value1, $value2); + } + $value1 = Helpers::extractString($value1); $value2 = Helpers::extractString($value2); @@ -38,12 +59,17 @@ public static function exact($value1, $value2): bool * RETURNSTRING. * * @param mixed $testValue Value to check + * Or can be an array of values * - * @return null|string + * @return null|array|string + * If an array of values is passed for the argument, then the returned result + * will also be an array with matching dimensions */ public static function test($testValue = '') { - $testValue = Functions::flattenSingleValue($testValue); + if (is_array($testValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $testValue); + } if (is_string($testValue)) { return $testValue; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php index 22f4554..e52c009 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php @@ -2,17 +2,28 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; + class Trim { + use ArrayEnabled; + /** * CLEAN. * * @param mixed $stringValue String Value to check + * Or can be an array of values * - * @return null|string + * @return null|array|string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function nonPrintable($stringValue = '') { + if (is_array($stringValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue); + } + $stringValue = Helpers::extractString($stringValue); return preg_replace('/[\\x00-\\x1f]/', '', "$stringValue"); @@ -22,11 +33,18 @@ public static function nonPrintable($stringValue = '') * TRIM. * * @param mixed $stringValue String Value to check + * Or can be an array of values * - * @return string + * @return array|string + * If an array of values is passed as the argument, then the returned result will also be an array + * with the same dimensions */ public static function spaces($stringValue = '') { + if (is_array($stringValue)) { + return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue); + } + $stringValue = Helpers::extractString($stringValue); return trim(preg_replace('/ +/', ' ', trim("$stringValue", ' ')) ?? '', ' '); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php index 941e1ad..26ffc01 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php @@ -3,9 +3,15 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Token; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Engine\BranchPruner; class Stack { + /** + * @var BranchPruner + */ + private $branchPruner; + /** * The parser stack for formulae. * @@ -20,12 +26,15 @@ class Stack */ private $count = 0; + public function __construct(BranchPruner $branchPruner) + { + $this->branchPruner = $branchPruner; + } + /** * Return the number of entries on the stack. - * - * @return int */ - public function count() + public function count(): int { return $this->count; } @@ -33,25 +42,11 @@ public function count() /** * Push a new entry onto the stack. * - * @param mixed $type * @param mixed $value - * @param mixed $reference - * @param null|string $storeKey will store the result under this alias - * @param null|string $onlyIf will only run computation if the matching - * store key is true - * @param null|string $onlyIfNot will only run computation if the matching - * store key is false */ - public function push( - $type, - $value, - $reference = null, - $storeKey = null, - $onlyIf = null, - $onlyIfNot = null - ): void { - $stackItem = $this->getStackItem($type, $value, $reference, $storeKey, $onlyIf, $onlyIfNot); - + public function push(string $type, $value, ?string $reference = null): void + { + $stackItem = $this->getStackItem($type, $value, $reference); $this->stack[$this->count++] = $stackItem; if ($type == 'Function') { @@ -62,29 +57,37 @@ public function push( } } - public function getStackItem( - $type, - $value, - $reference = null, - $storeKey = null, - $onlyIf = null, - $onlyIfNot = null - ) { + public function pushStackItem(array $stackItem): void + { + $this->stack[$this->count++] = $stackItem; + } + + /** + * @param mixed $value + */ + public function getStackItem(string $type, $value, ?string $reference = null): array + { $stackItem = [ 'type' => $type, 'value' => $value, 'reference' => $reference, ]; - if (isset($storeKey)) { + // will store the result under this alias + $storeKey = $this->branchPruner->currentCondition(); + if (isset($storeKey) || $reference === 'NULL') { $stackItem['storeKey'] = $storeKey; } - if (isset($onlyIf)) { + // will only run computation if the matching store key is true + $onlyIf = $this->branchPruner->currentOnlyIf(); + if (isset($onlyIf) || $reference === 'NULL') { $stackItem['onlyIf'] = $onlyIf; } - if (isset($onlyIfNot)) { + // will only run computation if the matching store key is false + $onlyIfNot = $this->branchPruner->currentOnlyIfNot(); + if (isset($onlyIfNot) || $reference === 'NULL') { $stackItem['onlyIfNot'] = $onlyIfNot; } @@ -93,10 +96,8 @@ public function getStackItem( /** * Pop the last entry from the stack. - * - * @return mixed */ - public function pop() + public function pop(): ?array { if ($this->count > 0) { return $this->stack[--$this->count]; @@ -107,12 +108,8 @@ public function pop() /** * Return an entry from the stack without removing it. - * - * @param int $n number indicating how far back in the stack we want to look - * - * @return mixed */ - public function last($n = 1) + public function last(int $n = 1): ?array { if ($this->count - $n < 0) { return null; @@ -129,21 +126,4 @@ public function clear(): void $this->stack = []; $this->count = 0; } - - public function __toString() - { - $str = 'Stack: '; - foreach ($this->stack as $index => $item) { - if ($index > $this->count - 1) { - break; - } - $value = $item['value'] ?? 'no value'; - while (is_array($value)) { - $value = array_pop($value); - } - $str .= $value . ' |> '; - } - - return $str; - } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Web/Service.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Web/Service.php index 05e04bf..697d3a6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Web/Service.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Web/Service.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\Web; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Settings; use Psr\Http\Client\ClientExceptionInterface; @@ -22,11 +22,11 @@ public static function webService(string $url) { $url = trim($url); if (strlen($url) > 2048) { - return Functions::VALUE(); // Invalid URL length + return ExcelError::VALUE(); // Invalid URL length } if (!preg_match('/^http[s]?:\/\//', $url)) { - return Functions::VALUE(); // Invalid protocol + return ExcelError::VALUE(); // Invalid protocol } // Get results from the the webservice @@ -37,16 +37,16 @@ public static function webService(string $url) try { $response = $client->sendRequest($request); } catch (ClientExceptionInterface $e) { - return Functions::VALUE(); // cURL error + return ExcelError::VALUE(); // cURL error } if ($response->getStatusCode() != 200) { - return Functions::VALUE(); // cURL error + return ExcelError::VALUE(); // cURL error } $output = $response->getBody()->getContents(); if (strlen($output) > 32767) { - return Functions::VALUE(); // Output not a string or too long + return ExcelError::VALUE(); // Output not a string or too long } return $output; @@ -67,7 +67,7 @@ public static function webService(string $url) public static function urlEncode($text) { if (!is_string($text)) { - return Functions::VALUE(); + return ExcelError::VALUE(); } return str_replace('+', '%20', urlencode($text)); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/Translations.xlsx b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/Translations.xlsx index 518176a..6f758b9 100644 Binary files a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/Translations.xlsx and b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/Translations.xlsx differ diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions index 7f9ce78..9f05d5a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions @@ -177,6 +177,7 @@ SYD = АСЧ TBILLEQ = РАВНОКЧЕК TBILLPRICE = ЦЕНАКЧЕК TBILLYIELD = ДОХОДКЧЕК +USDOLLAR = ДОЛЛСША VDB = ПУО XIRR = ЧИСТВНДОХ XNPV = ЧИСТНЗ @@ -231,6 +232,7 @@ AREAS = ОБЛАСТИ CHOOSE = ВЫБОР COLUMN = СТОЛБЕЦ COLUMNS = ЧИСЛСТОЛБ +FILTER = ФИЛЬТР FORMULATEXT = Ф.ТЕКСТ GETPIVOTDATA = ПОЛУЧИТЬ.ДАННЫЕ.СВОДНОЙ.ТАБЛИЦЫ HLOOKUP = ГПР @@ -243,8 +245,13 @@ OFFSET = СМЕЩ ROW = СТРОКА ROWS = ЧСТРОК RTD = ДРВ +SORT = СОРТ +SORTBY = СОРТПО TRANSPOSE = ТРАНСП +UNIQUE = УНИК VLOOKUP = ВПР +XLOOKUP = ПРОСМОТРX +XMATCH = ПОИСКПОЗX ## ## Математические и тригонометрические функции (Math & Trig Functions) @@ -302,6 +309,7 @@ PRODUCT = ПРОИЗВЕД QUOTIENT = ЧАСТНОЕ RADIANS = РАДИАНЫ RAND = СЛЧИС +RANDARRAY = СЛУЧМАССИВ RANDBETWEEN = СЛУЧМЕЖДУ ROMAN = РИМСКОЕ ROUND = ОКРУГЛ @@ -312,6 +320,7 @@ ROUNDUP = ОКРУГЛВВЕРХ SEC = SEC SECH = SECH SERIESSUM = РЯД.СУММ +SEQUENCE = ПОСЛЕДОВ SIGN = ЗНАК SIN = SIN SINH = SINH @@ -447,27 +456,36 @@ Z.TEST = Z.ТЕСТ ## ## Текстовые функции (Text Functions) ## +ARRAYTOTEXT = МАССИВВТЕКСТ BAHTTEXT = БАТТЕКСТ CHAR = СИМВОЛ CLEAN = ПЕЧСИМВ CODE = КОДСИМВ CONCAT = СЦЕП +DBCS = БДЦС DOLLAR = РУБЛЬ EXACT = СОВПАД FIND = НАЙТИ +FINDB = НАЙТИБ FIXED = ФИКСИРОВАННЫЙ -ISTHAIDIGIT = TAYRAKAMIYSA +ISTHAIDIGIT = ЕТАЙЦИФРЫ LEFT = ЛЕВСИМВ +LEFTB = ЛЕВБ LEN = ДЛСТР +LENB = ДЛИНБ LOWER = СТРОЧН MID = ПСТР +MIDB = ПСТРБ NUMBERSTRING = СТРОКАЧИСЕЛ NUMBERVALUE = ЧЗНАЧ PROPER = ПРОПНАЧ REPLACE = ЗАМЕНИТЬ +REPLACEB = ЗАМЕНИТЬБ REPT = ПОВТОР RIGHT = ПРАВСИМВ +RIGHTB = ПРАВБ SEARCH = ПОИСК +SEARCHB = ПОИСКБ SUBSTITUTE = ПОДСТАВИТЬ T = Т TEXT = ТЕКСТ @@ -481,6 +499,7 @@ UNICHAR = ЮНИСИМВ UNICODE = UNICODE UPPER = ПРОПИСН VALUE = ЗНАЧЕН +VALUETOTEXT = ЗНАЧЕНИЕВТЕКСТ ## ## Веб-функции (Web Functions) diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AddressRange.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AddressRange.php new file mode 100644 index 0000000..5475231 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AddressRange.php @@ -0,0 +1,22 @@ +setValueExplicit($days, DataType::TYPE_NUMERIC); @@ -193,6 +195,9 @@ protected function setTimeHoursMinutesSeconds(string $value, Cell $cell): bool { // Convert value to number [$hours, $minutes, $seconds] = explode(':', $value); + $hours = (int) $hours; + $minutes = (int) $minutes; + $seconds = (int) $seconds; $days = ($hours / 24) + ($minutes / 1440) + ($seconds / 86400); $cell->setValueExplicit($days, DataType::TYPE_NUMERIC); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php index 5a9def3..76d5e86 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php @@ -3,9 +3,12 @@ namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Collection\Cells; use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDate; +use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\CellStyleAssessor; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; @@ -234,6 +237,11 @@ public function setValueExplicit($value, $dataType) case DataType::TYPE_BOOL: $this->value = (bool) $value; + break; + case DataType::TYPE_ISO_DATE: + $this->value = SharedDate::convertIsoDate($value); + $dataType = DataType::TYPE_NUMERIC; + break; case DataType::TYPE_ERROR: $this->value = DataType::checkErrorCode($value); @@ -260,7 +268,7 @@ public function setValueExplicit($value, $dataType) */ public function getCalculatedValue($resetLog = true) { - if ($this->dataType == DataType::TYPE_FORMULA) { + if ($this->dataType === DataType::TYPE_FORMULA) { try { $index = $this->getWorksheet()->getParent()->getActiveSheetIndex(); $selected = $this->getWorksheet()->getSelectedCells(); @@ -279,7 +287,7 @@ public function getCalculatedValue($resetLog = true) if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) { return $this->calculatedValue; // Fallback for calculations referencing external files. } elseif (preg_match('/[Uu]ndefined (name|offset: 2|array key 2)/', $ex->getMessage()) === 1) { - return \PhpOffice\PhpSpreadsheet\Calculation\Functions::NAME(); + return ExcelError::NAME(); } throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception( @@ -359,20 +367,16 @@ public function setDataType($dataType) /** * Identify if the cell contains a formula. - * - * @return bool */ - public function isFormula() + public function isFormula(): bool { - return $this->dataType == DataType::TYPE_FORMULA; + return $this->dataType === DataType::TYPE_FORMULA && $this->getStyle()->getQuotePrefix() === false; } /** * Does this cell contain Data validation rules? - * - * @return bool */ - public function hasDataValidation() + public function hasDataValidation(): bool { if (!isset($this->parent)) { throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); @@ -541,14 +545,30 @@ public function getMergeRange() /** * Get cell style. - * - * @return Style */ - public function getStyle() + public function getStyle(): Style { return $this->getWorksheet()->getStyle($this->getCoordinate()); } + /** + * Get cell style. + */ + public function getAppliedStyle(): Style + { + if ($this->getWorksheet()->conditionalStylesExists($this->getCoordinate()) === false) { + return $this->getStyle(); + } + $range = $this->getWorksheet()->getConditionalRange($this->getCoordinate()); + if ($range === null) { + return $this->getStyle(); + } + + $matcher = new CellStyleAssessor($this, $range); + + return $matcher->matchConditions($this->getWorksheet()->getConditionalStyles($this->getCoordinate())); + } + /** * Re-bind parent. * diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellAddress.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellAddress.php new file mode 100644 index 0000000..d587dcd --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellAddress.php @@ -0,0 +1,174 @@ +cellAddress = str_replace('$', '', $cellAddress); + [$this->columnName, $rowId] = Coordinate::coordinateFromString($cellAddress); + $this->rowId = (int) $rowId; + $this->columnId = Coordinate::columnIndexFromString($this->columnName); + $this->worksheet = $worksheet; + } + + /** + * @param mixed $columnId + * @param mixed $rowId + */ + private static function validateColumnAndRow($columnId, $rowId): void + { + $array = [$columnId, $rowId]; + array_walk( + $array, + function ($value): void { + if (!is_numeric($value) || $value <= 0) { + throw new Exception('Row and Column Ids must be positive integer values'); + } + } + ); + } + + /** + * @param mixed $columnId + * @param mixed $rowId + */ + public static function fromColumnAndRow($columnId, $rowId, ?Worksheet $worksheet = null): self + { + self::validateColumnAndRow($columnId, $rowId); + + /** @phpstan-ignore-next-line */ + return new static(Coordinate::stringFromColumnIndex($columnId) . ((string) $rowId), $worksheet); + } + + public static function fromColumnRowArray(array $array, ?Worksheet $worksheet = null): self + { + [$columnId, $rowId] = $array; + + return static::fromColumnAndRow($columnId, $rowId, $worksheet); + } + + /** + * @param mixed $cellAddress + */ + public static function fromCellAddress($cellAddress, ?Worksheet $worksheet = null): self + { + /** @phpstan-ignore-next-line */ + return new static($cellAddress, $worksheet); + } + + /** + * The returned address string will contain the worksheet name as well, if available, + * (ie. if a Worksheet was provided to the constructor). + * e.g. "'Mark''s Worksheet'!C5". + */ + public function fullCellAddress(): string + { + if ($this->worksheet !== null) { + $title = str_replace("'", "''", $this->worksheet->getTitle()); + + return "'{$title}'!{$this->cellAddress}"; + } + + return $this->cellAddress; + } + + public function worksheet(): ?Worksheet + { + return $this->worksheet; + } + + /** + * The returned address string will contain just the column/row address, + * (even if a Worksheet was provided to the constructor). + * e.g. "C5". + */ + public function cellAddress(): string + { + return $this->cellAddress; + } + + public function rowId(): int + { + return $this->rowId; + } + + public function columnId(): int + { + return $this->columnId; + } + + public function columnName(): string + { + return $this->columnName; + } + + public function nextRow(int $offset = 1): self + { + $newRowId = $this->rowId + $offset; + if ($newRowId < 1) { + $newRowId = 1; + } + + return static::fromColumnAndRow($this->columnId, $newRowId); + } + + public function previousRow(int $offset = 1): self + { + return $this->nextRow(0 - $offset); + } + + public function nextColumn(int $offset = 1): self + { + $newColumnId = $this->columnId + $offset; + if ($newColumnId < 1) { + $newColumnId = 1; + } + + return static::fromColumnAndRow($newColumnId, $this->rowId); + } + + public function previousColumn(int $offset = 1): self + { + return $this->nextColumn(0 - $offset); + } + + /** + * The returned address string will contain the worksheet name as well, if available, + * (ie. if a Worksheet was provided to the constructor). + * e.g. "'Mark''s Worksheet'!C5". + */ + public function __toString() + { + return $this->fullCellAddress(); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellRange.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellRange.php new file mode 100644 index 0000000..908a0d0 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/CellRange.php @@ -0,0 +1,136 @@ +validateFromTo($from, $to); + } + + private function validateFromTo(CellAddress $from, CellAddress $to): void + { + // Identify actual top-left and bottom-right values (in case we've been given top-right and bottom-left) + $firstColumn = min($from->columnId(), $to->columnId()); + $firstRow = min($from->rowId(), $to->rowId()); + $lastColumn = max($from->columnId(), $to->columnId()); + $lastRow = max($from->rowId(), $to->rowId()); + + $fromWorksheet = $from->worksheet(); + $toWorksheet = $to->worksheet(); + $this->validateWorksheets($fromWorksheet, $toWorksheet); + + $this->from = $this->cellAddressWrapper($firstColumn, $firstRow, $fromWorksheet); + $this->to = $this->cellAddressWrapper($lastColumn, $lastRow, $toWorksheet); + } + + private function validateWorksheets(?Worksheet $fromWorksheet, ?Worksheet $toWorksheet): void + { + if ($fromWorksheet !== null && $toWorksheet !== null) { + // We could simply compare worksheets rather than worksheet titles; but at some point we may introduce + // support for 3d ranges; and at that point we drop this check and let the validation fall through + // to the check for same workbook; but unless we check on titles, this test will also detect if the + // worksheets are in different spreadsheets, and the next check will never execute or throw its + // own exception. + if ($fromWorksheet->getTitle() !== $toWorksheet->getTitle()) { + throw new Exception('3d Cell Ranges are not supported'); + } elseif ($fromWorksheet->getParent() !== $toWorksheet->getParent()) { + throw new Exception('Worksheets must be in the same spreadsheet'); + } + } + } + + private function cellAddressWrapper(int $column, int $row, ?Worksheet $worksheet = null): CellAddress + { + $cellAddress = Coordinate::stringFromColumnIndex($column) . (string) $row; + + return new class ($cellAddress, $worksheet) extends CellAddress { + public function nextRow(int $offset = 1): CellAddress + { + /** @var CellAddress $result */ + $result = parent::nextRow($offset); + $this->rowId = $result->rowId; + $this->cellAddress = $result->cellAddress; + + return $this; + } + + public function previousRow(int $offset = 1): CellAddress + { + /** @var CellAddress $result */ + $result = parent::previousRow($offset); + $this->rowId = $result->rowId; + $this->cellAddress = $result->cellAddress; + + return $this; + } + + public function nextColumn(int $offset = 1): CellAddress + { + /** @var CellAddress $result */ + $result = parent::nextColumn($offset); + $this->columnId = $result->columnId; + $this->columnName = $result->columnName; + $this->cellAddress = $result->cellAddress; + + return $this; + } + + public function previousColumn(int $offset = 1): CellAddress + { + /** @var CellAddress $result */ + $result = parent::previousColumn($offset); + $this->columnId = $result->columnId; + $this->columnName = $result->columnName; + $this->cellAddress = $result->cellAddress; + + return $this; + } + }; + } + + public function from(): CellAddress + { + // Re-order from/to in case the cell addresses have been modified + $this->validateFromTo($this->from, $this->to); + + return $this->from; + } + + public function to(): CellAddress + { + // Re-order from/to in case the cell addresses have been modified + $this->validateFromTo($this->from, $this->to); + + return $this->to; + } + + public function __toString(): string + { + // Re-order from/to in case the cell addresses have been modified + $this->validateFromTo($this->from, $this->to); + + if ($this->from->cellAddress() === $this->to->cellAddress()) { + return "{$this->from->fullCellAddress()}"; + } + + $fromAddress = $this->from->fullCellAddress(); + $toAddress = $this->to->cellAddress(); + + return "{$fromAddress}:{$toAddress}"; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/ColumnRange.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/ColumnRange.php new file mode 100644 index 0000000..1e521a1 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/ColumnRange.php @@ -0,0 +1,125 @@ +validateFromTo( + Coordinate::columnIndexFromString($from), + Coordinate::columnIndexFromString($to ?? $from) + ); + $this->worksheet = $worksheet; + } + + public static function fromColumnIndexes(int $from, int $to, ?Worksheet $worksheet = null): self + { + return new self(Coordinate::stringFromColumnIndex($from), Coordinate::stringFromColumnIndex($to), $worksheet); + } + + /** + * @param array $array + */ + public static function fromArray(array $array, ?Worksheet $worksheet = null): self + { + array_walk( + $array, + function (&$column): void { + $column = is_numeric($column) ? Coordinate::stringFromColumnIndex((int) $column) : $column; + } + ); + /** @var string $from */ + /** @var string $to */ + [$from, $to] = $array; + + return new self($from, $to, $worksheet); + } + + private function validateFromTo(int $from, int $to): void + { + // Identify actual top and bottom values (in case we've been given bottom and top) + $this->from = min($from, $to); + $this->to = max($from, $to); + } + + public function columnCount(): int + { + return $this->to - $this->from + 1; + } + + public function shiftDown(int $offset = 1): self + { + $newFrom = $this->from + $offset; + $newFrom = ($newFrom < 1) ? 1 : $newFrom; + + $newTo = $this->to + $offset; + $newTo = ($newTo < 1) ? 1 : $newTo; + + return self::fromColumnIndexes($newFrom, $newTo, $this->worksheet); + } + + public function shiftUp(int $offset = 1): self + { + return $this->shiftDown(0 - $offset); + } + + public function from(): string + { + return Coordinate::stringFromColumnIndex($this->from); + } + + public function to(): string + { + return Coordinate::stringFromColumnIndex($this->to); + } + + public function fromIndex(): int + { + return $this->from; + } + + public function toIndex(): int + { + return $this->to; + } + + public function toCellRange(): CellRange + { + return new CellRange( + CellAddress::fromColumnAndRow($this->from, 1, $this->worksheet), + CellAddress::fromColumnAndRow($this->to, AddressRange::MAX_ROW) + ); + } + + public function __toString(): string + { + $from = $this->from(); + $to = $this->to(); + + if ($this->worksheet !== null) { + $title = str_replace("'", "''", $this->worksheet->getTitle()); + + return "'{$title}'!{$from}:{$to}"; + } + + return "{$from}:{$to}"; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php index b4b76c5..ea53919 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php @@ -92,6 +92,7 @@ public static function absoluteReference($cellAddress) } // Create absolute coordinate + $cellAddress = "$cellAddress"; if (ctype_digit($cellAddress)) { return $worksheet . '$' . $cellAddress; } elseif (ctype_alpha($cellAddress)) { @@ -147,6 +148,7 @@ public static function splitRange($range) $exploded = explode(',', $range); $counter = count($exploded); for ($i = 0; $i < $counter; ++$i) { + // @phpstan-ignore-next-line $exploded[$i] = explode(':', $exploded[$i]); } @@ -381,7 +383,7 @@ private static function sortCellReferenceArray(array $cellList): array // Sort the result by column and row $sortKeys = []; foreach ($cellList as $coord) { - [$column, $row] = sscanf($coord, '%[A-Z]%d'); + sscanf($coord, '%[A-Z]%d', $column, $row); $sortKeys[sprintf('%3s%09d', $column, $row)] = $coord; } ksort($sortKeys); @@ -543,7 +545,7 @@ private static function getCellBlocksFromRangeString($rangeString) // split range sets on intersection (space) or union (,) operators $tokens = preg_split('/([ ,])/', $rangeString, -1, PREG_SPLIT_DELIM_CAPTURE); - // separate the range sets and the operators into arrays + /** @phpstan-ignore-next-line */ $split = array_chunk($tokens, 2); $ranges = array_column($split, 0); $operators = array_column($split, 1); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php index cee3e1e..0f7efe2 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php @@ -16,6 +16,7 @@ class DataType const TYPE_NULL = 'null'; const TYPE_INLINE = 'inlineStr'; const TYPE_ERROR = 'e'; + const TYPE_ISO_DATE = 'd'; /** * List of error codes. diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php index 430d81b..0e395a7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Exception; /** @@ -64,8 +64,11 @@ private function isValueInList(Cell $cell) try { $result = $calculation->calculateFormula($matchFormula, $cell->getCoordinate(), $cell); + while (is_array($result)) { + $result = array_pop($result); + } - return $result !== Functions::NA(); + return $result !== ExcelError::NA(); } catch (Exception $ex) { return false; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/RowRange.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/RowRange.php new file mode 100644 index 0000000..38e6c14 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/RowRange.php @@ -0,0 +1,93 @@ +validateFromTo($from, $to ?? $from); + $this->worksheet = $worksheet; + } + + public static function fromArray(array $array, ?Worksheet $worksheet = null): self + { + [$from, $to] = $array; + + return new self($from, $to, $worksheet); + } + + private function validateFromTo(int $from, int $to): void + { + // Identify actual top and bottom values (in case we've been given bottom and top) + $this->from = min($from, $to); + $this->to = max($from, $to); + } + + public function from(): int + { + return $this->from; + } + + public function to(): int + { + return $this->to; + } + + public function rowCount(): int + { + return $this->to - $this->from + 1; + } + + public function shiftRight(int $offset = 1): self + { + $newFrom = $this->from + $offset; + $newFrom = ($newFrom < 1) ? 1 : $newFrom; + + $newTo = $this->to + $offset; + $newTo = ($newTo < 1) ? 1 : $newTo; + + return new self($newFrom, $newTo, $this->worksheet); + } + + public function shiftLeft(int $offset = 1): self + { + return $this->shiftRight(0 - $offset); + } + + public function toCellRange(): CellRange + { + return new CellRange( + CellAddress::fromColumnAndRow(Coordinate::columnIndexFromString('A'), $this->from, $this->worksheet), + CellAddress::fromColumnAndRow(Coordinate::columnIndexFromString(AddressRange::MAX_COLUMN), $this->to) + ); + } + + public function __toString(): string + { + if ($this->worksheet !== null) { + $title = str_replace("'", "''", $this->worksheet->getTitle()); + + return "'{$title}'!{$this->from}:{$this->to}"; + } + + return "{$this->from}:{$this->to}"; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/CellReferenceHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/CellReferenceHelper.php new file mode 100644 index 0000000..0f079d6 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/CellReferenceHelper.php @@ -0,0 +1,119 @@ +beforeCellAddress = str_replace('$', '', $beforeCellAddress); + $this->numberOfColumns = $numberOfColumns; + $this->numberOfRows = $numberOfRows; + + // Get coordinate of $beforeCellAddress + [$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($beforeCellAddress); + $this->beforeColumn = (int) Coordinate::columnIndexFromString($beforeColumn); + $this->beforeRow = (int) $beforeRow; + } + + public function beforeCellAddress(): string + { + return $this->beforeCellAddress; + } + + public function refreshRequired(string $beforeCellAddress, int $numberOfColumns, int $numberOfRows): bool + { + return $this->beforeCellAddress !== $beforeCellAddress || + $this->numberOfColumns !== $numberOfColumns || + $this->numberOfRows !== $numberOfRows; + } + + public function updateCellReference(string $cellReference = 'A1', bool $includeAbsoluteReferences = false): string + { + if (Coordinate::coordinateIsRange($cellReference)) { + throw new Exception('Only single cell references may be passed to this method.'); + } + + // Get coordinate of $cellReference + [$newColumn, $newRow] = Coordinate::coordinateFromString($cellReference); + $newColumnIndex = (int) Coordinate::columnIndexFromString(str_replace('$', '', $newColumn)); + $newRowIndex = (int) str_replace('$', '', $newRow); + + $absoluteColumn = $newColumn[0] === '$' ? '$' : ''; + $absoluteRow = $newRow[0] === '$' ? '$' : ''; + // Verify which parts should be updated + if ($includeAbsoluteReferences === false) { + $updateColumn = (($absoluteColumn !== '$') && $newColumnIndex >= $this->beforeColumn); + $updateRow = (($absoluteRow !== '$') && $newRowIndex >= $this->beforeRow); + } else { + $updateColumn = ($newColumnIndex >= $this->beforeColumn); + $updateRow = ($newRowIndex >= $this->beforeRow); + } + + // Create new column reference + if ($updateColumn) { + $newColumn = ($includeAbsoluteReferences === false) + ? Coordinate::stringFromColumnIndex($newColumnIndex + $this->numberOfColumns) + : $absoluteColumn . Coordinate::stringFromColumnIndex($newColumnIndex + $this->numberOfColumns); + } + + // Create new row reference + if ($updateRow) { + $newRow = ($includeAbsoluteReferences === false) + ? $newRowIndex + $this->numberOfRows + : $absoluteRow . (string) ($newRowIndex + $this->numberOfRows); + } + + // Return new reference + return "{$newColumn}{$newRow}"; + } + + public function cellAddressInDeleteRange(string $cellAddress): bool + { + [$cellColumn, $cellRow] = Coordinate::coordinateFromString($cellAddress); + $cellColumnIndex = Coordinate::columnIndexFromString($cellColumn); + // Is cell within the range of rows/columns if we're deleting + if ( + $this->numberOfRows < 0 && + ($cellRow >= ($this->beforeRow + $this->numberOfRows)) && + ($cellRow < $this->beforeRow) + ) { + return true; + } elseif ( + $this->numberOfColumns < 0 && + ($cellColumnIndex >= ($this->beforeColumn + $this->numberOfColumns)) && + ($cellColumnIndex < $this->beforeColumn) + ) { + return true; + } + + return false; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php index e3d81cb..d49f545 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php @@ -4,8 +4,8 @@ use Generator; use PhpOffice\PhpSpreadsheet\Cell\Cell; -use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; +use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use Psr\SimpleCache\CacheInterface; @@ -151,8 +151,6 @@ public function getSortedCoordinates() { $sortKeys = []; foreach ($this->getCoordinates() as $coord) { - $column = ''; - $row = 0; sscanf($coord, '%[A-Z]%d', $column, $row); $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord; } @@ -172,8 +170,6 @@ public function getHighestRowAndColumn() $col = ['A' => '1A']; $row = [1]; foreach ($this->getCoordinates() as $coord) { - $c = ''; - $r = 0; sscanf($coord, '%[A-Z]%d', $c, $r); $row[$r] = $r; $col[$c] = strlen($c) . $c; @@ -206,9 +202,6 @@ public function getCurrentCoordinate() */ public function getCurrentColumn() { - $column = ''; - $row = 0; - sscanf($this->currentCoordinate ?? '', '%[A-Z]%d', $column, $row); return $column; @@ -221,9 +214,6 @@ public function getCurrentColumn() */ public function getCurrentRow() { - $column = ''; - $row = 0; - sscanf($this->currentCoordinate ?? '', '%[A-Z]%d', $column, $row); return (int) $row; @@ -240,24 +230,19 @@ public function getCurrentRow() public function getHighestColumn($row = null) { if ($row === null) { - $colRow = $this->getHighestRowAndColumn(); - - return $colRow['column']; + return $this->getHighestRowAndColumn()['column']; } - $columnList = [1]; + $maxColumn = '1A'; foreach ($this->getCoordinates() as $coord) { - $c = ''; - $r = 0; - sscanf($coord, '%[A-Z]%d', $c, $r); if ($r != $row) { continue; } - $columnList[] = Coordinate::columnIndexFromString($c); + $maxColumn = max($maxColumn, strlen($c) . $c); } - return Coordinate::stringFromColumnIndex((int) @max($columnList)); + return substr($maxColumn, 1); } /** @@ -271,24 +256,19 @@ public function getHighestColumn($row = null) public function getHighestRow($column = null) { if ($column === null) { - $colRow = $this->getHighestRowAndColumn(); - - return $colRow['row']; + return $this->getHighestRowAndColumn()['row']; } - $rowList = [0]; + $maxRow = 1; foreach ($this->getCoordinates() as $coord) { - $c = ''; - $r = 0; - sscanf($coord, '%[A-Z]%d', $c, $r); if ($c != $column) { continue; } - $rowList[] = $r; + $maxRow = max($maxRow, $r); } - return max($rowList); + return $maxRow; } /** @@ -298,7 +278,9 @@ public function getHighestRow($column = null) */ private function getUniqueID() { - return uniqid('phpspreadsheet.', true) . '.'; + return Settings::getCache() instanceof Memory + ? random_bytes(7) . ':' + : uniqid('phpspreadsheet.', true) . '.'; } /** @@ -345,9 +327,6 @@ public function cloneCellCollection(Worksheet $worksheet) public function removeRow($row): void { foreach ($this->getCoordinates() as $coord) { - $c = ''; - $r = 0; - sscanf($coord, '%[A-Z]%d', $c, $r); if ($r == $row) { $this->delete($coord); @@ -363,9 +342,6 @@ public function removeRow($row): void public function removeColumn($column): void { foreach ($this->getCoordinates() as $coord) { - $c = ''; - $r = 0; - sscanf($coord, '%[A-Z]%d', $c, $r); if ($c == $column) { $this->delete($coord); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php index a32551b..2690ab7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Collection; +use DateInterval; use Psr\SimpleCache\CacheInterface; /** @@ -14,6 +15,9 @@ class Memory implements CacheInterface { private $cache = []; + /** + * @return bool + */ public function clear() { $this->cache = []; @@ -21,6 +25,11 @@ public function clear() return true; } + /** + * @param string $key + * + * @return bool + */ public function delete($key) { unset($this->cache[$key]); @@ -28,6 +37,11 @@ public function delete($key) return true; } + /** + * @param iterable $keys + * + * @return bool + */ public function deleteMultiple($keys) { foreach ($keys as $key) { @@ -37,6 +51,12 @@ public function deleteMultiple($keys) return true; } + /** + * @param string $key + * @param mixed $default + * + * @return mixed + */ public function get($key, $default = null) { if ($this->has($key)) { @@ -46,6 +66,12 @@ public function get($key, $default = null) return $default; } + /** + * @param iterable $keys + * @param mixed $default + * + * @return iterable + */ public function getMultiple($keys, $default = null) { $results = []; @@ -56,11 +82,23 @@ public function getMultiple($keys, $default = null) return $results; } + /** + * @param string $key + * + * @return bool + */ public function has($key) { return array_key_exists($key, $this->cache); } + /** + * @param string $key + * @param mixed $value + * @param null|DateInterval|int $ttl + * + * @return bool + */ public function set($key, $value, $ttl = null) { $this->cache[$key] = $value; @@ -68,6 +106,12 @@ public function set($key, $value, $ttl = null) return true; } + /** + * @param iterable $values + * @param null|DateInterval|int $ttl + * + * @return bool + */ public function setMultiple($values, $ttl = null) { foreach ($values as $key => $value) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php index 7aaf975..abadc7d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php @@ -2,10 +2,13 @@ namespace PhpOffice\PhpSpreadsheet; +use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Helper\Size; use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Color; +use PhpOffice\PhpSpreadsheet\Worksheet\Drawing; class Comment implements IComparable { @@ -72,6 +75,13 @@ class Comment implements IComparable */ private $alignment; + /** + * Background image in comment. + * + * @var Drawing + */ + private $backgroundImage; + /** * Create a new Comment. */ @@ -82,6 +92,7 @@ public function __construct() $this->text = new RichText(); $this->fillColor = new Color('FFFFFFE1'); $this->alignment = Alignment::HORIZONTAL_GENERAL; + $this->backgroundImage = new Drawing(); } /** @@ -273,6 +284,7 @@ public function getHashCode(): string ($this->visible ? 1 : 0) . $this->fillColor->getHashCode() . $this->alignment . + ($this->hasBackgroundImage() ? $this->backgroundImage->getHashCode() : '') . __CLASS__ ); } @@ -299,4 +311,52 @@ public function __toString(): string { return $this->text->getPlainText(); } + + /** + * Check is background image exists. + */ + public function hasBackgroundImage(): bool + { + $path = $this->backgroundImage->getPath(); + + if (empty($path)) { + return false; + } + + return getimagesize($path) !== false; + } + + /** + * Returns background image. + */ + public function getBackgroundImage(): Drawing + { + return $this->backgroundImage; + } + + /** + * Sets background image. + */ + public function setBackgroundImage(Drawing $objDrawing): self + { + if (!array_key_exists($objDrawing->getType(), Drawing::IMAGE_TYPES_CONVERTION_MAP)) { + throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.'); + } + $this->backgroundImage = $objDrawing; + + return $this; + } + + /** + * Sets size of comment as size of background image. + */ + public function setSizeAsBackgroundImage(): self + { + if ($this->hasBackgroundImage()) { + $this->setWidth(SharedDrawing::pixelsToPoints($this->backgroundImage->getWidth()) . 'pt'); + $this->setHeight(SharedDrawing::pixelsToPoints($this->backgroundImage->getHeight()) . 'pt'); + } + + return $this; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php index 3be5a67..2d461c5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php @@ -115,7 +115,7 @@ public function __construct() // Initialise values $this->lastModifiedBy = $this->creator; $this->created = self::intOrFloatTimestamp(null); - $this->modified = self::intOrFloatTimestamp(null); + $this->modified = $this->created; } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Dimension.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Dimension.php index 136ffd7..4e3e668 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Dimension.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Dimension.php @@ -58,7 +58,7 @@ class Dimension public function __construct(string $dimension) { [$size, $unit] = sscanf($dimension, '%[1234567890.]%s'); - $unit = strtolower(trim($unit)); + $unit = strtolower(trim($unit ?? '')); // If a UoM is specified, then convert the size to pixels for internal storage if (isset(self::ABSOLUTE_UNITS[$unit])) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php index 73a3308..4737379 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php @@ -619,6 +619,7 @@ public function toRichTextObject($html) // Load the HTML file into the DOM object // Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup $prefix = ''; + /** @scrutinizer ignore-unhandled */ @$dom->loadHTML($prefix . $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); // Discard excess white space $dom->preserveWhiteSpace = false; @@ -794,7 +795,7 @@ protected function parseTextNode(DOMText $textNode): void $domText = preg_replace( '/\s+/u', ' ', - str_replace(["\r", "\n"], ' ', $textNode->nodeValue) + str_replace(["\r", "\n"], ' ', $textNode->nodeValue ?: '') ); $this->stringData .= $domText; $this->buildTextRun(); @@ -808,6 +809,7 @@ protected function handleCallback(DOMElement $element, $callbackTag, array $call if (isset($callbacks[$callbackTag])) { $elementHandler = $callbacks[$callbackTag]; if (method_exists($this, $elementHandler)) { + /** @phpstan-ignore-next-line */ call_user_func([$this, $elementHandler], $element); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php index 91613cb..e437a22 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php @@ -14,23 +14,39 @@ */ abstract class IOFactory { + public const READER_XLSX = 'Xlsx'; + public const READER_XLS = 'Xls'; + public const READER_XML = 'Xml'; + public const READER_ODS = 'Ods'; + public const READER_SYLK = 'Slk'; + public const READER_SLK = 'Slk'; + public const READER_GNUMERIC = 'Gnumeric'; + public const READER_HTML = 'Html'; + public const READER_CSV = 'Csv'; + + public const WRITER_XLSX = 'Xlsx'; + public const WRITER_XLS = 'Xls'; + public const WRITER_ODS = 'Ods'; + public const WRITER_CSV = 'Csv'; + public const WRITER_HTML = 'Html'; + private static $readers = [ - 'Xlsx' => Reader\Xlsx::class, - 'Xls' => Reader\Xls::class, - 'Xml' => Reader\Xml::class, - 'Ods' => Reader\Ods::class, - 'Slk' => Reader\Slk::class, - 'Gnumeric' => Reader\Gnumeric::class, - 'Html' => Reader\Html::class, - 'Csv' => Reader\Csv::class, + self::READER_XLSX => Reader\Xlsx::class, + self::READER_XLS => Reader\Xls::class, + self::READER_XML => Reader\Xml::class, + self::READER_ODS => Reader\Ods::class, + self::READER_SLK => Reader\Slk::class, + self::READER_GNUMERIC => Reader\Gnumeric::class, + self::READER_HTML => Reader\Html::class, + self::READER_CSV => Reader\Csv::class, ]; private static $writers = [ - 'Xls' => Writer\Xls::class, - 'Xlsx' => Writer\Xlsx::class, - 'Ods' => Writer\Ods::class, - 'Csv' => Writer\Csv::class, - 'Html' => Writer\Html::class, + self::WRITER_XLS => Writer\Xls::class, + self::WRITER_XLSX => Writer\Xlsx::class, + self::WRITER_ODS => Writer\Ods::class, + self::WRITER_CSV => Writer\Csv::class, + self::WRITER_HTML => Writer\Html::class, 'Tcpdf' => Writer\Pdf\Tcpdf::class, 'Dompdf' => Writer\Pdf\Dompdf::class, 'Mpdf' => Writer\Pdf\Mpdf::class, @@ -70,10 +86,18 @@ public static function createReader(string $readerType): IReader * Loads Spreadsheet from file using automatic Reader\IReader resolution. * * @param string $filename The name of the spreadsheet file + * @param int $flags the optional second parameter flags may be used to identify specific elements + * that should be loaded, but which won't be loaded by default, using these values: + * IReader::LOAD_WITH_CHARTS - Include any charts that are defined in the loaded file + * @param string[] $readers An array of Readers to use to identify the file type. By default, load() will try + * all possible Readers until it finds a match; but this allows you to pass in a + * list of Readers so it will only try the subset that you specify here. + * Values in this list can be any of the constant values defined in the set + * IOFactory::READER_*. */ - public static function load(string $filename, int $flags = 0): Spreadsheet + public static function load(string $filename, int $flags = 0, ?array $readers = null): Spreadsheet { - $reader = self::createReaderForFile($filename); + $reader = self::createReaderForFile($filename, $readers); return $reader->load($filename, $flags); } @@ -81,9 +105,9 @@ public static function load(string $filename, int $flags = 0): Spreadsheet /** * Identify file type using automatic IReader resolution. */ - public static function identify(string $filename): string + public static function identify(string $filename, ?array $readers = null): string { - $reader = self::createReaderForFile($filename); + $reader = self::createReaderForFile($filename, $readers); $className = get_class($reader); $classType = explode('\\', $className); unset($reader); @@ -93,14 +117,32 @@ public static function identify(string $filename): string /** * Create Reader\IReader for file using automatic IReader resolution. + * + * @param string[] $readers An array of Readers to use to identify the file type. By default, load() will try + * all possible Readers until it finds a match; but this allows you to pass in a + * list of Readers so it will only try the subset that you specify here. + * Values in this list can be any of the constant values defined in the set + * IOFactory::READER_*. */ - public static function createReaderForFile(string $filename): IReader + public static function createReaderForFile(string $filename, ?array $readers = null): IReader { File::assertFile($filename); + $testReaders = self::$readers; + if ($readers !== null) { + $readers = array_map('strtoupper', $readers); + $testReaders = array_filter( + self::$readers, + function (string $readerType) use ($readers) { + return in_array(strtoupper($readerType), $readers, true); + }, + ARRAY_FILTER_USE_KEY + ); + } + // First, lucky guess by inspecting file extension $guessedReader = self::getReaderTypeFromExtension($filename); - if ($guessedReader !== null) { + if (($guessedReader !== null) && array_key_exists($guessedReader, $testReaders)) { $reader = self::createReader($guessedReader); // Let's see if we are lucky @@ -110,11 +152,11 @@ public static function createReaderForFile(string $filename): IReader } // If we reach here then "lucky guess" didn't give any result - // Try walking through all the options in self::$autoResolveClasses - foreach (self::$readers as $type => $class) { + // Try walking through all the options in self::$readers (or the selected subset) + foreach ($testReaders as $readerType => $class) { // Ignore our original guess, we know that won't work - if ($type !== $guessedReader) { - $reader = self::createReader($type); + if ($readerType !== $guessedReader) { + $reader = self::createReader($readerType); if ($reader->canRead($filename)) { return $reader; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php index 2ad8e6b..a137e78 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php @@ -2,9 +2,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader; +use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException; use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner; use PhpOffice\PhpSpreadsheet\Shared\File; +use PhpOffice\PhpSpreadsheet\Spreadsheet; abstract class BaseReader implements IReader { @@ -144,25 +146,45 @@ protected function processFlags(int $flags): void } } + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet + { + throw new PhpSpreadsheetException('Reader classes must implement their own loadSpreadsheetFromFile() method'); + } + /** - * Open file for reading. + * Loads Spreadsheet from file. * - * @param string $filename + * @param int $flags the optional second parameter flags may be used to identify specific elements + * that should be loaded, but which won't be loaded by default, using these values: + * IReader::LOAD_WITH_CHARTS - Include any charts that are defined in the loaded file */ - protected function openFile($filename): void + public function load(string $filename, int $flags = 0): Spreadsheet { + $this->processFlags($flags); + + try { + return $this->loadSpreadsheetFromFile($filename); + } catch (ReaderException $e) { + throw $e; + } + } + + /** + * Open file for reading. + */ + protected function openFile(string $filename): void + { + $fileHandle = false; if ($filename) { File::assertFile($filename); // Open file $fileHandle = fopen($filename, 'rb'); - } else { - $fileHandle = false; } - if ($fileHandle !== false) { - $this->fileHandle = $fileHandle; - } else { + if ($fileHandle === false) { throw new ReaderException('Could not open file ' . $filename . ' for reading.'); } + + $this->fileHandle = $fileHandle; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php index 185f064..e894e9a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php @@ -2,12 +2,14 @@ namespace PhpOffice\PhpSpreadsheet\Reader; +use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Reader\Csv\Delimiter; use PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Style\NumberFormat; class Csv extends BaseReader { @@ -84,6 +86,23 @@ class Csv extends BaseReader */ private static $constructorCallback; + /** + * Attempt autodetect line endings (deprecated after PHP8.1)? + * + * @var bool + */ + private $testAutodetect = true; + + /** + * @var bool + */ + protected $castFormattedNumberToNumeric = false; + + /** + * @var bool + */ + protected $preserveNumericFormatting = false; + /** * Create a new CSV Reader instance. */ @@ -236,13 +255,9 @@ public function listWorksheetInfo(string $filename): array /** * Loads Spreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Create new Spreadsheet $spreadsheet = new Spreadsheet(); @@ -273,10 +288,15 @@ private function openFileOrMemory(string $filename): void } } - private static function setAutoDetect(?string $value): ?string + public function setTestAutoDetect(bool $value): void + { + $this->testAutodetect = $value; + } + + private function setAutoDetect(?string $value): ?string { $retVal = null; - if ($value !== null) { + if ($value !== null && $this->testAutodetect) { $retVal2 = @ini_set('auto_detect_line_endings', $value); if (is_string($retVal2)) { $retVal = $retVal2; @@ -286,13 +306,21 @@ private static function setAutoDetect(?string $value): ?string return $retVal; } + public function castFormattedNumberToNumeric( + bool $castFormattedNumberToNumeric, + bool $preserveNumericFormatting = false + ): void { + $this->castFormattedNumberToNumeric = $castFormattedNumberToNumeric; + $this->preserveNumericFormatting = $preserveNumericFormatting; + } + /** * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. */ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Spreadsheet { // Deprecated in Php8.1 - $iniset = self::setAutoDetect('1'); + $iniset = $this->setAutoDetect('1'); // Open file $this->openFileOrMemory($filename); @@ -322,6 +350,7 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp $columnLetter = 'A'; foreach ($rowData as $rowDatum) { $this->convertBoolean($rowDatum, $preserveBooleanString); + $numberFormatMask = $this->convertFormattedNumber($rowDatum); if ($rowDatum !== '' && $this->readFilter->readCell($columnLetter, $currentRow)) { if ($this->contiguous) { if ($noOutputYet) { @@ -331,6 +360,10 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp } else { $outRow = $currentRow; } + // Set basic styling for the value (Note that this could be overloaded by styling in a value binder) + $sheet->getCell($columnLetter . $outRow)->getStyle() + ->getNumberFormat() + ->setFormatCode($numberFormatMask); // Set cell value $sheet->getCell($columnLetter . $outRow)->setValue($rowDatum); } @@ -343,7 +376,7 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp // Close file fclose($fileHandle); - self::setAutoDetect($iniset); + $this->setAutoDetect($iniset); // Return return $spreadsheet; @@ -357,9 +390,9 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp private function convertBoolean(&$rowDatum, bool $preserveBooleanString): void { if (is_string($rowDatum) && !$preserveBooleanString) { - if (strcasecmp('true', $rowDatum) === 0) { + if (strcasecmp(Calculation::getTRUE(), $rowDatum) === 0 || strcasecmp('true', $rowDatum) === 0) { $rowDatum = true; - } elseif (strcasecmp('false', $rowDatum) === 0) { + } elseif (strcasecmp(Calculation::getFALSE(), $rowDatum) === 0 || strcasecmp('false', $rowDatum) === 0) { $rowDatum = false; } } elseif ($rowDatum === null) { @@ -367,6 +400,39 @@ private function convertBoolean(&$rowDatum, bool $preserveBooleanString): void } } + /** + * Convert numeric strings to int or float values. + * + * @param mixed $rowDatum + */ + private function convertFormattedNumber(&$rowDatum): string + { + $numberFormatMask = NumberFormat::FORMAT_GENERAL; + if ($this->castFormattedNumberToNumeric === true && is_string($rowDatum)) { + $numeric = str_replace( + [StringHelper::getThousandsSeparator(), StringHelper::getDecimalSeparator()], + ['', '.'], + $rowDatum + ); + + if (is_numeric($numeric)) { + $decimalPos = strpos($rowDatum, StringHelper::getDecimalSeparator()); + if ($this->preserveNumericFormatting === true) { + $numberFormatMask = (strpos($rowDatum, StringHelper::getThousandsSeparator()) !== false) + ? '#,##0' : '0'; + if ($decimalPos !== false) { + $decimals = strlen($rowDatum) - $decimalPos - 1; + $numberFormatMask .= '.' . str_repeat('0', min($decimals, 6)); + } + } + + $rowDatum = ($decimalPos !== false) ? (float) $numeric : (int) $numeric; + } + } + + return $numberFormatMask; + } + public function getDelimiter(): ?string { return $this->delimiter; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php index 9b03cdc..ee2e8d3 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -227,13 +227,9 @@ private static function testSimpleXml($value): SimpleXMLElement /** * Loads Spreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Create new Spreadsheet $spreadsheet = new Spreadsheet(); $spreadsheet->removeSheetByIndex(0); @@ -288,12 +284,8 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp $row = (int) $cellAttributes->Row + 1; $column = (int) $cellAttributes->Col; - if ($row > $maxRow) { - $maxRow = $row; - } - if ($column > $maxCol) { - $maxCol = $column; - } + $maxRow = max($maxRow, $row); + $maxCol = max($maxCol, $column); $column = Coordinate::stringFromColumnIndex($column + 1); @@ -304,38 +296,7 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp } } - $ValueType = $cellAttributes->ValueType; - $ExprID = (string) $cellAttributes->ExprID; - $type = DataType::TYPE_FORMULA; - if ($ExprID > '') { - if (((string) $cell) > '') { - $this->expressions[$ExprID] = [ - 'column' => $cellAttributes->Col, - 'row' => $cellAttributes->Row, - 'formula' => (string) $cell, - ]; - } else { - $expression = $this->expressions[$ExprID]; - - $cell = $this->referenceHelper->updateFormulaReferences( - $expression['formula'], - 'A1', - $cellAttributes->Col - $expression['column'], - $cellAttributes->Row - $expression['row'], - $worksheetName - ); - } - $type = DataType::TYPE_FORMULA; - } else { - $vtype = (string) $ValueType; - if (array_key_exists($vtype, self::$mappings['dataType'])) { - $type = self::$mappings['dataType'][$vtype]; - } - if ($vtype === '20') { // Boolean - $cell = $cell == 'TRUE'; - } - } - $this->spreadsheet->getActiveSheet()->getCell($column . $row)->setValueExplicit((string) $cell, $type); + $this->loadCell($cell, $worksheetName, $cellAttributes, $column, $row); } if ($sheet->Styles !== null) { @@ -348,15 +309,49 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp $this->processMergedCells($sheet); $this->processAutofilter($sheet); + $this->setSelectedCells($sheet); ++$worksheetID; } $this->processDefinedNames($gnmXML); + $this->setSelectedSheet($gnmXML); + // Return return $this->spreadsheet; } + private function setSelectedSheet(SimpleXMLElement $gnmXML): void + { + if (isset($gnmXML->UIData)) { + $attributes = self::testSimpleXml($gnmXML->UIData->attributes()); + $selectedSheet = (int) $attributes['SelectedTab']; + $this->spreadsheet->setActiveSheetIndex($selectedSheet); + } + } + + private function setSelectedCells(?SimpleXMLElement $sheet): void + { + if ($sheet !== null && isset($sheet->Selections)) { + foreach ($sheet->Selections as $selection) { + $startCol = (int) ($selection->StartCol ?? 0); + $startRow = (int) ($selection->StartRow ?? 0) + 1; + $endCol = (int) ($selection->EndCol ?? $startCol); + $endRow = (int) ($selection->endRow ?? 0) + 1; + + $startColumn = Coordinate::stringFromColumnIndex($startCol + 1); + $endColumn = Coordinate::stringFromColumnIndex($endCol + 1); + + $startCell = "{$startColumn}{$startRow}"; + $endCell = "{$endColumn}{$endRow}"; + $selectedRange = $startCell . (($endCell !== $startCell) ? ':' . $endCell : ''); + $this->spreadsheet->getActiveSheet()->setSelectedCell($selectedRange); + + break; + } + } + } + private function processMergedCells(?SimpleXMLElement $sheet): void { // Handle Merged Cells in this worksheet @@ -385,7 +380,8 @@ private function processAutofilter(?SimpleXMLElement $sheet): void private function setColumnWidth(int $whichColumn, float $defaultWidth): void { - $columnDimension = $this->spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($whichColumn + 1)); + $columnDimension = $this->spreadsheet->getActiveSheet() + ->getColumnDimension(Coordinate::stringFromColumnIndex($whichColumn + 1)); if ($columnDimension !== null) { $columnDimension->setWidth($defaultWidth); } @@ -393,7 +389,8 @@ private function setColumnWidth(int $whichColumn, float $defaultWidth): void private function setColumnInvisible(int $whichColumn): void { - $columnDimension = $this->spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($whichColumn + 1)); + $columnDimension = $this->spreadsheet->getActiveSheet() + ->getColumnDimension(Coordinate::stringFromColumnIndex($whichColumn + 1)); if ($columnDimension !== null) { $columnDimension->setVisible(false); } @@ -534,4 +531,51 @@ private function parseRichText(string $is): RichText return $value; } + + private function loadCell( + SimpleXMLElement $cell, + string $worksheetName, + SimpleXMLElement $cellAttributes, + string $column, + int $row + ): void { + $ValueType = $cellAttributes->ValueType; + $ExprID = (string) $cellAttributes->ExprID; + $type = DataType::TYPE_FORMULA; + if ($ExprID > '') { + if (((string) $cell) > '') { + $this->expressions[$ExprID] = [ + 'column' => $cellAttributes->Col, + 'row' => $cellAttributes->Row, + 'formula' => (string) $cell, + ]; + } else { + $expression = $this->expressions[$ExprID]; + + $cell = $this->referenceHelper->updateFormulaReferences( + $expression['formula'], + 'A1', + $cellAttributes->Col - $expression['column'], + $cellAttributes->Row - $expression['row'], + $worksheetName + ); + } + $type = DataType::TYPE_FORMULA; + } else { + $vtype = (string) $ValueType; + if (array_key_exists($vtype, self::$mappings['dataType'])) { + $type = self::$mappings['dataType'][$vtype]; + } + if ($vtype === '20') { // Boolean + $cell = $cell == 'TRUE'; + } + } + + $this->spreadsheet->getActiveSheet()->getCell($column . $row)->setValueExplicit((string) $cell, $type); + if (isset($cellAttributes->ValueFormat)) { + $this->spreadsheet->getActiveSheet()->getCell($column . $row) + ->getStyle()->getNumberFormat() + ->setFormatCode((string) $cellAttributes->ValueFormat); + } + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php index c37f1c1..15c9f62 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php @@ -19,7 +19,6 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use Throwable; -/** PhpSpreadsheet root directory */ class Html extends BaseReader { /** @@ -201,13 +200,9 @@ private static function containsTags(string $data): bool /** * Loads Spreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Create new Spreadsheet $spreadsheet = new Spreadsheet(); @@ -624,7 +619,7 @@ protected function processDomElement(DOMNode $element, Worksheet $sheet, int &$r { foreach ($element->childNodes as $child) { if ($child instanceof DOMText) { - $domText = preg_replace('/\s+/u', ' ', trim($child->nodeValue)); + $domText = preg_replace('/\s+/u', ' ', trim($child->nodeValue ?: '')); if (is_string($cellContent)) { // simply append the text if the cell content is a plain text string $cellContent .= $domText; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php index 86b3ee3..fcafc04 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php @@ -2,16 +2,15 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use DateTime; use DOMAttr; use DOMDocument; use DOMElement; use DOMNode; -use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Reader\Ods\AutoFilter; use PhpOffice\PhpSpreadsheet\Reader\Ods\DefinedNames; +use PhpOffice\PhpSpreadsheet\Reader\Ods\FormulaTranslator; use PhpOffice\PhpSpreadsheet\Reader\Ods\PageSettings; use PhpOffice\PhpSpreadsheet\Reader\Ods\Properties as DocumentProperties; use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner; @@ -106,7 +105,7 @@ public function listWorksheetNames($filename) $xml->read(); while ($xml->read()) { // Quickly jump through to the office:body node - while ($xml->name !== 'office:body') { + while (self::getXmlName($xml) !== 'office:body') { if ($xml->isEmptyElement) { $xml->read(); } else { @@ -115,12 +114,13 @@ public function listWorksheetNames($filename) } // Now read each node until we find our first table:table node while ($xml->read()) { - if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + $xmlName = self::getXmlName($xml); + if ($xmlName == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { // Loop through each table:table node reading the table:name attribute for each worksheet name do { $worksheetNames[] = $xml->getAttribute('table:name'); $xml->next(); - } while ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT); + } while (self::getXmlName($xml) == 'table:table' && $xml->nodeType == XMLReader::ELEMENT); } } } @@ -153,7 +153,7 @@ public function listWorksheetInfo($filename) $xml->read(); while ($xml->read()) { // Quickly jump through to the office:body node - while ($xml->name !== 'office:body') { + while (self::getXmlName($xml) !== 'office:body') { if ($xml->isEmptyElement) { $xml->read(); } else { @@ -162,7 +162,7 @@ public function listWorksheetInfo($filename) } // Now read each node until we find our first table:table node while ($xml->read()) { - if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + if (self::getXmlName($xml) == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { $worksheetNames[] = $xml->getAttribute('table:name'); $tmpInfo = [ @@ -177,7 +177,7 @@ public function listWorksheetInfo($filename) $currCells = 0; do { $xml->read(); - if ($xml->name == 'table:table-row' && $xml->nodeType == XMLReader::ELEMENT) { + if (self::getXmlName($xml) == 'table:table-row' && $xml->nodeType == XMLReader::ELEMENT) { $rowspan = $xml->getAttribute('table:number-rows-repeated'); $rowspan = empty($rowspan) ? 1 : $rowspan; $tmpInfo['totalRows'] += $rowspan; @@ -187,22 +187,22 @@ public function listWorksheetInfo($filename) $xml->read(); do { $doread = true; - if ($xml->name == 'table:table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + if (self::getXmlName($xml) == 'table:table-cell' && $xml->nodeType == XMLReader::ELEMENT) { if (!$xml->isEmptyElement) { ++$currCells; $xml->next(); $doread = false; } - } elseif ($xml->name == 'table:covered-table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + } elseif (self::getXmlName($xml) == 'table:covered-table-cell' && $xml->nodeType == XMLReader::ELEMENT) { $mergeSize = $xml->getAttribute('table:number-columns-repeated'); $currCells += (int) $mergeSize; } if ($doread) { $xml->read(); } - } while ($xml->name != 'table:table-row'); + } while (self::getXmlName($xml) != 'table:table-row'); } - } while ($xml->name != 'table:table'); + } while (self::getXmlName($xml) != 'table:table'); $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells); $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; @@ -216,14 +216,20 @@ public function listWorksheetInfo($filename) } /** - * Loads PhpSpreadsheet from file. + * Counteract Phpstan caching. * - * @return Spreadsheet + * @phpstan-impure */ - public function load(string $filename, int $flags = 0) + private static function getXmlName(XMLReader $xml): string { - $this->processFlags($flags); + return $xml->name; + } + /** + * Loads PhpSpreadsheet from file. + */ + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet + { // Create new Spreadsheet $spreadsheet = new Spreadsheet(); @@ -482,21 +488,7 @@ public function loadIntoExisting($filename, Spreadsheet $spreadsheet) case 'date': $type = DataType::TYPE_NUMERIC; $value = $cellData->getAttributeNS($officeNs, 'date-value'); - - $dateObj = new DateTime($value); - [$year, $month, $day, $hour, $minute, $second] = explode( - ' ', - $dateObj->format('Y m d H i s') - ); - - $dataValue = Date::formattedPHPToExcel( - (int) $year, - (int) $month, - (int) $day, - (int) $hour, - (int) $minute, - (int) $second - ); + $dataValue = Date::convertIsoDate($value); if ($dataValue != floor($dataValue)) { $formatting = NumberFormat::FORMAT_DATE_XLSX15 @@ -531,7 +523,7 @@ public function loadIntoExisting($filename, Spreadsheet $spreadsheet) if ($hasCalculatedValue) { $type = DataType::TYPE_FORMULA; $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=') + 1); - $cellDataFormula = $this->convertToExcelFormulaValue($cellDataFormula); + $cellDataFormula = FormulaTranslator::convertToExcelFormulaValue($cellDataFormula); } if ($cellData->hasAttributeNS($tableNs, 'number-columns-repeated')) { @@ -587,31 +579,7 @@ public function loadIntoExisting($filename, Spreadsheet $spreadsheet) } // Merged cells - if ( - $cellData->hasAttributeNS($tableNs, 'number-columns-spanned') - || $cellData->hasAttributeNS($tableNs, 'number-rows-spanned') - ) { - if (($type !== DataType::TYPE_NULL) || (!$this->readDataOnly)) { - $columnTo = $columnID; - - if ($cellData->hasAttributeNS($tableNs, 'number-columns-spanned')) { - $columnIndex = Coordinate::columnIndexFromString($columnID); - $columnIndex += (int) $cellData->getAttributeNS($tableNs, 'number-columns-spanned'); - $columnIndex -= 2; - - $columnTo = Coordinate::stringFromColumnIndex($columnIndex + 1); - } - - $rowTo = $rowID; - - if ($cellData->hasAttributeNS($tableNs, 'number-rows-spanned')) { - $rowTo = $rowTo + (int) $cellData->getAttributeNS($tableNs, 'number-rows-spanned') - 1; - } - - $cellRange = $columnID . $rowID . ':' . $columnTo . $rowTo; - $spreadsheet->getActiveSheet()->mergeCells($cellRange); - } - } + $this->processMergedCells($cellData, $tableNs, $type, $columnID, $rowID, $spreadsheet); ++$columnID; } @@ -660,7 +628,7 @@ private function lookForActiveSheet(DOMElement $settings, Spreadsheet $spreadshe foreach ($settings->getElementsByTagNameNS($configNs, 'config-item') as $t) { if ($t->getAttributeNs($configNs, 'name') === 'ActiveTable') { try { - $spreadsheet->setActiveSheetIndexByName($t->nodeValue); + $spreadsheet->setActiveSheetIndexByName($t->nodeValue ?: ''); } catch (Throwable $e) { // do nothing } @@ -687,7 +655,7 @@ private function lookForSelectedCells(DOMElement $settings, Spreadsheet $spreads $setRow = $configItem->nodeValue; } } - $this->setSelected($spreadsheet, $wsname, $setCol, $setRow); + $this->setSelected($spreadsheet, $wsname, "$setCol", "$setRow"); } break; @@ -724,12 +692,7 @@ protected function scanElementForText(DOMNode $element) // Multiple spaces? /** @var DOMAttr $cAttr */ $cAttr = $child->attributes->getNamedItem('c'); - if ($cAttr) { - $multiplier = (int) $cAttr->nodeValue; - } else { - $multiplier = 1; - } - + $multiplier = self::getMultiplier($cAttr); $str .= str_repeat(' ', $multiplier); } @@ -741,6 +704,17 @@ protected function scanElementForText(DOMNode $element) return $str; } + private static function getMultiplier(?DOMAttr $cAttr): int + { + if ($cAttr) { + $multiplier = (int) $cAttr->nodeValue; + } else { + $multiplier = 1; + } + + return $multiplier; + } + /** * @param string $is * @@ -754,31 +728,38 @@ private function parseRichText($is) return $value; } - private function convertToExcelFormulaValue(string $openOfficeFormula): string - { - $temp = explode('"', $openOfficeFormula); - $tKey = false; - foreach ($temp as &$value) { - // Only replace in alternate array entries (i.e. non-quoted blocks) - if ($tKey = !$tKey) { - // Cell range reference in another sheet - $value = preg_replace('/\[\$?([^\.]+)\.([^\.]+):\.([^\.]+)\]/miu', '$1!$2:$3', $value); - // Cell reference in another sheet - $value = preg_replace('/\[\$?([^\.]+)\.([^\.]+)\]/miu', '$1!$2', $value ?? ''); - // Cell range reference - $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/miu', '$1:$2', $value ?? ''); - // Simple cell reference - $value = preg_replace('/\[\.([^\.]+)\]/miu', '$1', $value ?? ''); - // Convert references to defined names/formulae - $value = str_replace('$$', '', $value ?? ''); - - $value = Calculation::translateSeparator(';', ',', $value, $inBraces); - } - } + private function processMergedCells( + DOMElement $cellData, + string $tableNs, + string $type, + string $columnID, + int $rowID, + Spreadsheet $spreadsheet + ): void { + if ( + $cellData->hasAttributeNS($tableNs, 'number-columns-spanned') + || $cellData->hasAttributeNS($tableNs, 'number-rows-spanned') + ) { + if (($type !== DataType::TYPE_NULL) || ($this->readDataOnly === false)) { + $columnTo = $columnID; + + if ($cellData->hasAttributeNS($tableNs, 'number-columns-spanned')) { + $columnIndex = Coordinate::columnIndexFromString($columnID); + $columnIndex += (int) $cellData->getAttributeNS($tableNs, 'number-columns-spanned'); + $columnIndex -= 2; + + $columnTo = Coordinate::stringFromColumnIndex($columnIndex + 1); + } - // Then rebuild the formula string - $excelFormula = implode('"', $temp); + $rowTo = $rowID; - return $excelFormula; + if ($cellData->hasAttributeNS($tableNs, 'number-rows-spanned')) { + $rowTo = $rowTo + (int) $cellData->getAttributeNS($tableNs, 'number-rows-spanned') - 1; + } + + $cellRange = $columnID . $rowID . ':' . $columnTo . $rowTo; + $spreadsheet->getActiveSheet()->mergeCells($cellRange); + } + } } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/AutoFilter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/AutoFilter.php index bdc8b3f..1f5f975 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/AutoFilter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/AutoFilter.php @@ -5,7 +5,7 @@ use DOMElement; use DOMNode; -class AutoFilter extends BaseReader +class AutoFilter extends BaseLoader { public function read(DOMElement $workbookData): void { @@ -20,7 +20,7 @@ protected function readAutoFilters(DOMElement $workbookData): void foreach ($autofilters->childNodes as $autofilter) { $autofilterRange = $this->getAttributeValue($autofilter, 'target-range-address'); if ($autofilterRange !== null) { - $baseAddress = $this->convertToExcelAddressValue($autofilterRange); + $baseAddress = FormulaTranslator::convertToExcelAddressValue($autofilterRange); $this->spreadsheet->getActiveSheet()->setAutoFilter($baseAddress); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseLoader.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseLoader.php new file mode 100644 index 0000000..b06691f --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseLoader.php @@ -0,0 +1,27 @@ +spreadsheet = $spreadsheet; + $this->tableNs = $tableNs; + } + + abstract public function read(DOMElement $workbookData): void; +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/DefinedNames.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/DefinedNames.php index 6810a3c..e0ab890 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/DefinedNames.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/DefinedNames.php @@ -6,7 +6,7 @@ use PhpOffice\PhpSpreadsheet\DefinedName; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; -class DefinedNames extends BaseReader +class DefinedNames extends BaseLoader { public function read(DOMElement $workbookData): void { @@ -25,8 +25,8 @@ protected function readDefinedRanges(DOMElement $workbookData): void $baseAddress = $definedNameElement->getAttributeNS($this->tableNs, 'base-cell-address'); $range = $definedNameElement->getAttributeNS($this->tableNs, 'cell-range-address'); - $baseAddress = $this->convertToExcelAddressValue($baseAddress); - $range = $this->convertToExcelAddressValue($range); + $baseAddress = FormulaTranslator::convertToExcelAddressValue($baseAddress); + $range = FormulaTranslator::convertToExcelAddressValue($range); $this->addDefinedName($baseAddress, $definedName, $range); } @@ -43,9 +43,9 @@ protected function readDefinedExpressions(DOMElement $workbookData): void $baseAddress = $definedNameElement->getAttributeNS($this->tableNs, 'base-cell-address'); $expression = $definedNameElement->getAttributeNS($this->tableNs, 'expression'); - $baseAddress = $this->convertToExcelAddressValue($baseAddress); + $baseAddress = FormulaTranslator::convertToExcelAddressValue($baseAddress); $expression = substr($expression, strpos($expression, ':=') + 1); - $expression = $this->convertToExcelFormulaValue($expression); + $expression = FormulaTranslator::convertToExcelFormulaValue($expression); $this->addDefinedName($baseAddress, $definedName, $expression); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseReader.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/FormulaTranslator.php similarity index 62% rename from vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseReader.php rename to vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/FormulaTranslator.php index 17e2d4d..f2ad1a3 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/BaseReader.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/FormulaTranslator.php @@ -2,31 +2,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Ods; -use DOMElement; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Spreadsheet; -abstract class BaseReader +class FormulaTranslator { - /** - * @var Spreadsheet - */ - protected $spreadsheet; - - /** - * @var string - */ - protected $tableNs; - - public function __construct(Spreadsheet $spreadsheet, string $tableNs) - { - $this->spreadsheet = $spreadsheet; - $this->tableNs = $tableNs; - } - - abstract public function read(DOMElement $workbookData): void; - - protected function convertToExcelAddressValue(string $openOfficeAddress): string + public static function convertToExcelAddressValue(string $openOfficeAddress): string { $excelAddress = $openOfficeAddress; @@ -46,13 +26,16 @@ protected function convertToExcelAddressValue(string $openOfficeAddress): string return $excelAddress ?? ''; } - protected function convertToExcelFormulaValue(string $openOfficeFormula): string + public static function convertToExcelFormulaValue(string $openOfficeFormula): string { - $temp = explode('"', $openOfficeFormula); + $temp = explode(Calculation::FORMULA_STRING_QUOTE, $openOfficeFormula); $tKey = false; + $inMatrixBracesLevel = 0; + $inFunctionBracesLevel = 0; foreach ($temp as &$value) { // @var string $value // Only replace in alternate array entries (i.e. non-quoted blocks) + // so that conversion isn't done in string values if ($tKey = !$tKey) { // Cell range reference in another sheet $value = preg_replace('/\[\$?([^\.]+)\.([^\.]+):\.([^\.]+)\]/miu', '$1!$2:$3', $value); @@ -65,7 +48,28 @@ protected function convertToExcelFormulaValue(string $openOfficeFormula): string // Convert references to defined names/formulae $value = str_replace('$$', '', $value ?? ''); - $value = Calculation::translateSeparator(';', ',', $value, $inBraces); + // Convert ODS function argument separators to Excel function argument separators + $value = Calculation::translateSeparator(';', ',', $value, $inFunctionBracesLevel); + + // Convert ODS matrix separators to Excel matrix separators + $value = Calculation::translateSeparator( + ';', + ',', + $value, + $inMatrixBracesLevel, + Calculation::FORMULA_OPEN_MATRIX_BRACE, + Calculation::FORMULA_CLOSE_MATRIX_BRACE + ); + $value = Calculation::translateSeparator( + '|', + ';', + $value, + $inMatrixBracesLevel, + Calculation::FORMULA_OPEN_MATRIX_BRACE, + Calculation::FORMULA_CLOSE_MATRIX_BRACE + ); + + $value = preg_replace('/COM\.MICROSOFT\./ui', '', $value); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php index de3c6ce..c33f020 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php @@ -191,13 +191,9 @@ public function listWorksheetInfo($filename) /** * Loads PhpSpreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Create new Spreadsheet $spreadsheet = new Spreadsheet(); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php index 11d5874..d1f14ae 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php @@ -7,7 +7,9 @@ use PhpOffice\PhpSpreadsheet\Cell\DataValidation; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\NamedRange; +use PhpOffice\PhpSpreadsheet\Reader\Xls\ConditionalFormatting; use PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellFont; +use PhpOffice\PhpSpreadsheet\Reader\Xls\Style\FillPattern; use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Shared\CodePage; use PhpOffice\PhpSpreadsheet\Shared\Date; @@ -21,6 +23,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Borders; +use PhpOffice\PhpSpreadsheet\Style\Conditional; +use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\Protection; @@ -142,6 +146,8 @@ class Xls extends BaseReader const XLS_TYPE_SHEETLAYOUT = 0x0862; const XLS_TYPE_XFEXT = 0x087d; const XLS_TYPE_PAGELAYOUTVIEW = 0x088b; + const XLS_TYPE_CFHEADER = 0x01b0; + const XLS_TYPE_CFRULE = 0x01b1; const XLS_TYPE_UNKNOWN = 0xffff; // Encryption type @@ -620,13 +626,9 @@ public function listWorksheetInfo($filename) /** * Loads PhpSpreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Read the OLE file $this->loadOLE($filename); @@ -1035,6 +1037,14 @@ public function load(string $filename, int $flags = 0) case self::XLS_TYPE_DATAVALIDATION: $this->readDataValidation(); + break; + case self::XLS_TYPE_CFHEADER: + $cellRangeAddresses = $this->readCFHeader(); + + break; + case self::XLS_TYPE_CFRULE: + $this->readCFRule($cellRangeAddresses ?? []); + break; case self::XLS_TYPE_SHEETLAYOUT: $this->readSheetLayout(); @@ -1105,8 +1115,8 @@ public function load(string $filename, int $flags = 0) $height = SharedXls::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); // calculate offsetX and offsetY of the shape - $offsetX = $startOffsetX * SharedXls::sizeCol($this->phpSheet, $startColumn) / 1024; - $offsetY = $startOffsetY * SharedXls::sizeRow($this->phpSheet, $startRow) / 256; + $offsetX = (int) ($startOffsetX * SharedXls::sizeCol($this->phpSheet, $startColumn) / 1024); + $offsetY = (int) ($startOffsetY * SharedXls::sizeRow($this->phpSheet, $startRow) / 256); switch ($obj['otObjType']) { case 0x19: @@ -3749,8 +3759,13 @@ private function readLabelSst(): void } else { $textRun = $richText->createTextRun($text); if (isset($fmtRuns[$i - 1])) { - $fontIndex = $fmtRuns[$i - 1]['fontIndex']; - + if ($fmtRuns[$i - 1]['fontIndex'] < 4) { + $fontIndex = $fmtRuns[$i - 1]['fontIndex']; + } else { + // this has to do with that index 4 is omitted in all BIFF versions for some stra nge reason + // check the OpenOffice documentation of the FONT record + $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1; + } if (array_key_exists($fontIndex, $this->objFonts) === false) { $fontIndex = count($this->objFonts) - 1; } @@ -4780,57 +4795,11 @@ private function readDataValidation(): void // bit: 0-3; mask: 0x0000000F; type $type = (0x0000000F & $options) >> 0; - switch ($type) { - case 0x00: - $type = DataValidation::TYPE_NONE; - - break; - case 0x01: - $type = DataValidation::TYPE_WHOLE; - - break; - case 0x02: - $type = DataValidation::TYPE_DECIMAL; - - break; - case 0x03: - $type = DataValidation::TYPE_LIST; - - break; - case 0x04: - $type = DataValidation::TYPE_DATE; - - break; - case 0x05: - $type = DataValidation::TYPE_TIME; - - break; - case 0x06: - $type = DataValidation::TYPE_TEXTLENGTH; - - break; - case 0x07: - $type = DataValidation::TYPE_CUSTOM; - - break; - } + $type = Xls\DataValidationHelper::type($type); // bit: 4-6; mask: 0x00000070; error type $errorStyle = (0x00000070 & $options) >> 4; - switch ($errorStyle) { - case 0x00: - $errorStyle = DataValidation::STYLE_STOP; - - break; - case 0x01: - $errorStyle = DataValidation::STYLE_WARNING; - - break; - case 0x02: - $errorStyle = DataValidation::STYLE_INFORMATION; - - break; - } + $errorStyle = Xls\DataValidationHelper::errorStyle($errorStyle); // bit: 7; mask: 0x00000080; 1= formula is explicit (only applies to list) // I have only seen cases where this is 1 @@ -4850,39 +4819,10 @@ private function readDataValidation(): void // bit: 20-23; mask: 0x00F00000; condition operator $operator = (0x00F00000 & $options) >> 20; - switch ($operator) { - case 0x00: - $operator = DataValidation::OPERATOR_BETWEEN; - - break; - case 0x01: - $operator = DataValidation::OPERATOR_NOTBETWEEN; + $operator = Xls\DataValidationHelper::operator($operator); - break; - case 0x02: - $operator = DataValidation::OPERATOR_EQUAL; - - break; - case 0x03: - $operator = DataValidation::OPERATOR_NOTEQUAL; - - break; - case 0x04: - $operator = DataValidation::OPERATOR_GREATERTHAN; - - break; - case 0x05: - $operator = DataValidation::OPERATOR_LESSTHAN; - - break; - case 0x06: - $operator = DataValidation::OPERATOR_GREATERTHANOREQUAL; - - break; - case 0x07: - $operator = DataValidation::OPERATOR_LESSTHANOREQUAL; - - break; + if ($type === null || $errorStyle === null || $operator === null) { + return; } // offset: 4; size: var; title of the prompt box @@ -6941,7 +6881,7 @@ private function getNextToken($formulaData, $baseCell = 'A1') // offset: 1; size: 2; one-based index to definedname record $definedNameIndex = self::getUInt2d($formulaData, 1) - 1; // offset: 2; size: 2; not used - $data = $this->definedname[$definedNameIndex]['name']; + $data = $this->definedname[$definedNameIndex]['name'] ?? ''; break; case 0x24: // single cell reference e.g. A5 @@ -7912,4 +7852,243 @@ private function parseRichText($is) return $value; } + + /** + * Phpstan 1.4.4 complains that this property is never read. + * So, we might be able to get rid of it altogether. + * For now, however, this function makes it readable, + * which satisfies Phpstan. + * + * @codeCoverageIgnore + */ + public function getMapCellStyleXfIndex(): array + { + return $this->mapCellStyleXfIndex; + } + + private function readCFHeader(): array + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer forward to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return []; + } + + // offset: 0; size: 2; Rule Count +// $ruleCount = self::getUInt2d($recordData, 0); + + // offset: var; size: var; cell range address list with + $cellRangeAddressList = ($this->version == self::XLS_BIFF8) + ? $this->readBIFF8CellRangeAddressList(substr($recordData, 12)) + : $this->readBIFF5CellRangeAddressList(substr($recordData, 12)); + $cellRangeAddresses = $cellRangeAddressList['cellRangeAddresses']; + + return $cellRangeAddresses; + } + + private function readCFRule(array $cellRangeAddresses): void + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer forward to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 2; Options + $cfRule = self::getUInt2d($recordData, 0); + + // bit: 8-15; mask: 0x00FF; type + $type = (0x00FF & $cfRule) >> 0; + $type = ConditionalFormatting::type($type); + + // bit: 0-7; mask: 0xFF00; type + $operator = (0xFF00 & $cfRule) >> 8; + $operator = ConditionalFormatting::operator($operator); + + if ($type === null || $operator === null) { + return; + } + + // offset: 2; size: 2; Size1 + $size1 = self::getUInt2d($recordData, 2); + + // offset: 4; size: 2; Size2 + $size2 = self::getUInt2d($recordData, 4); + + // offset: 6; size: 4; Options + $options = self::getInt4d($recordData, 6); + + $style = new Style(); + $this->getCFStyleOptions($options, $style); + + $hasFontRecord = (bool) ((0x04000000 & $options) >> 26); + $hasAlignmentRecord = (bool) ((0x08000000 & $options) >> 27); + $hasBorderRecord = (bool) ((0x10000000 & $options) >> 28); + $hasFillRecord = (bool) ((0x20000000 & $options) >> 29); + $hasProtectionRecord = (bool) ((0x40000000 & $options) >> 30); + + $offset = 12; + + if ($hasFontRecord === true) { + $fontStyle = substr($recordData, $offset, 118); + $this->getCFFontStyle($fontStyle, $style); + $offset += 118; + } + + if ($hasAlignmentRecord === true) { + $alignmentStyle = substr($recordData, $offset, 8); + $this->getCFAlignmentStyle($alignmentStyle, $style); + $offset += 8; + } + + if ($hasBorderRecord === true) { + $borderStyle = substr($recordData, $offset, 8); + $this->getCFBorderStyle($borderStyle, $style); + $offset += 8; + } + + if ($hasFillRecord === true) { + $fillStyle = substr($recordData, $offset, 4); + $this->getCFFillStyle($fillStyle, $style); + $offset += 4; + } + + if ($hasProtectionRecord === true) { + $protectionStyle = substr($recordData, $offset, 4); + $this->getCFProtectionStyle($protectionStyle, $style); + $offset += 2; + } + + $formula1 = $formula2 = null; + if ($size1 > 0) { + $formula1 = $this->readCFFormula($recordData, $offset, $size1); + if ($formula1 === null) { + return; + } + + $offset += $size1; + } + + if ($size2 > 0) { + $formula2 = $this->readCFFormula($recordData, $offset, $size2); + if ($formula2 === null) { + return; + } + + $offset += $size2; + } + + $this->setCFRules($cellRangeAddresses, $type, $operator, $formula1, $formula2, $style); + } + + private function getCFStyleOptions(int $options, Style $style): void + { + } + + private function getCFFontStyle(string $options, Style $style): void + { + $fontSize = self::getInt4d($options, 64); + if ($fontSize !== -1) { + $style->getFont()->setSize($fontSize / 20); // Convert twips to points + } + + $bold = self::getUInt2d($options, 72) === 700; // 400 = normal, 700 = bold + $style->getFont()->setBold($bold); + + $color = self::getInt4d($options, 80); + + if ($color !== -1) { + $style->getFont()->getColor()->setRGB(Xls\Color::map($color, $this->palette, $this->version)['rgb']); + } + } + + private function getCFAlignmentStyle(string $options, Style $style): void + { + } + + private function getCFBorderStyle(string $options, Style $style): void + { + } + + private function getCFFillStyle(string $options, Style $style): void + { + $fillPattern = self::getUInt2d($options, 0); + // bit: 10-15; mask: 0xFC00; type + $fillPattern = (0xFC00 & $fillPattern) >> 10; + $fillPattern = FillPattern::lookup($fillPattern); + $fillPattern = $fillPattern === Fill::FILL_NONE ? Fill::FILL_SOLID : $fillPattern; + + if ($fillPattern !== Fill::FILL_NONE) { + $style->getFill()->setFillType($fillPattern); + + $fillColors = self::getUInt2d($options, 2); + + // bit: 0-6; mask: 0x007F; type + $color1 = (0x007F & $fillColors) >> 0; + $style->getFill()->getStartColor()->setRGB(Xls\Color::map($color1, $this->palette, $this->version)['rgb']); + + // bit: 7-13; mask: 0x3F80; type + $color2 = (0x3F80 & $fillColors) >> 7; + $style->getFill()->getEndColor()->setRGB(Xls\Color::map($color2, $this->palette, $this->version)['rgb']); + } + } + + private function getCFProtectionStyle(string $options, Style $style): void + { + } + + /** + * @return null|float|int|string + */ + private function readCFFormula(string $recordData, int $offset, int $size) + { + try { + $formula = substr($recordData, $offset, $size); + $formula = pack('v', $size) . $formula; // prepend the length + + $formula = $this->getFormulaFromStructure($formula); + if (is_numeric($formula)) { + return (strpos($formula, '.') !== false) ? (float) $formula : (int) $formula; + } + + return $formula; + } catch (PhpSpreadsheetException $e) { + } + + return null; + } + + /** + * @param null|float|int|string $formula1 + * @param null|float|int|string $formula2 + */ + private function setCFRules(array $cellRanges, string $type, string $operator, $formula1, $formula2, Style $style): void + { + foreach ($cellRanges as $cellRange) { + $conditional = new Conditional(); + $conditional->setConditionType($type); + $conditional->setOperatorType($operator); + if ($formula1 !== null) { + $conditional->addCondition($formula1); + } + if ($formula2 !== null) { + $conditional->addCondition($formula2); + } + $conditional->setStyle($style); + + $conditionalStyles = $this->phpSheet->getStyle($cellRange)->getConditionalStyles(); + $conditionalStyles[] = $conditional; + + $this->phpSheet->getStyle($cellRange)->setConditionalStyles($conditionalStyles); + $this->phpSheet->getStyle($cellRange)->setConditionalStyles($conditionalStyles); + } + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ConditionalFormatting.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ConditionalFormatting.php new file mode 100644 index 0000000..8400efb --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ConditionalFormatting.php @@ -0,0 +1,49 @@ + + */ + private static $types = [ + 0x01 => Conditional::CONDITION_CELLIS, + 0x02 => Conditional::CONDITION_EXPRESSION, + ]; + + /** + * @var array + */ + private static $operators = [ + 0x00 => Conditional::OPERATOR_NONE, + 0x01 => Conditional::OPERATOR_BETWEEN, + 0x02 => Conditional::OPERATOR_NOTBETWEEN, + 0x03 => Conditional::OPERATOR_EQUAL, + 0x04 => Conditional::OPERATOR_NOTEQUAL, + 0x05 => Conditional::OPERATOR_GREATERTHAN, + 0x06 => Conditional::OPERATOR_LESSTHAN, + 0x07 => Conditional::OPERATOR_GREATERTHANOREQUAL, + 0x08 => Conditional::OPERATOR_LESSTHANOREQUAL, + ]; + + public static function type(int $type): ?string + { + if (isset(self::$types[$type])) { + return self::$types[$type]; + } + + return null; + } + + public static function operator(int $operator): ?string + { + if (isset(self::$operators[$operator])) { + return self::$operators[$operator]; + } + + return null; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/DataValidationHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/DataValidationHelper.php new file mode 100644 index 0000000..02f844e --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/DataValidationHelper.php @@ -0,0 +1,72 @@ + + */ + private static $types = [ + 0x00 => DataValidation::TYPE_NONE, + 0x01 => DataValidation::TYPE_WHOLE, + 0x02 => DataValidation::TYPE_DECIMAL, + 0x03 => DataValidation::TYPE_LIST, + 0x04 => DataValidation::TYPE_DATE, + 0x05 => DataValidation::TYPE_TIME, + 0x06 => DataValidation::TYPE_TEXTLENGTH, + 0x07 => DataValidation::TYPE_CUSTOM, + ]; + + /** + * @var array + */ + private static $errorStyles = [ + 0x00 => DataValidation::STYLE_STOP, + 0x01 => DataValidation::STYLE_WARNING, + 0x02 => DataValidation::STYLE_INFORMATION, + ]; + + /** + * @var array + */ + private static $operators = [ + 0x00 => DataValidation::OPERATOR_BETWEEN, + 0x01 => DataValidation::OPERATOR_NOTBETWEEN, + 0x02 => DataValidation::OPERATOR_EQUAL, + 0x03 => DataValidation::OPERATOR_NOTEQUAL, + 0x04 => DataValidation::OPERATOR_GREATERTHAN, + 0x05 => DataValidation::OPERATOR_LESSTHAN, + 0x06 => DataValidation::OPERATOR_GREATERTHANOREQUAL, + 0x07 => DataValidation::OPERATOR_LESSTHANOREQUAL, + ]; + + public static function type(int $type): ?string + { + if (isset(self::$types[$type])) { + return self::$types[$type]; + } + + return null; + } + + public static function errorStyle(int $errorStyle): ?string + { + if (isset(self::$errorStyles[$errorStyle])) { + return self::$errorStyles[$errorStyle]; + } + + return null; + } + + public static function operator(int $operator): ?string + { + if (isset(self::$operators[$operator])) { + return self::$operators[$operator]; + } + + return null; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php index 3e15f64..14b6bc5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -71,6 +71,7 @@ public function getContext() */ public function add(string $data): void { + // @phpstan-ignore-next-line $words = array_values(unpack('V16', $data)); $A = $this->a; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php index c8b9126..a6e7fe0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php @@ -19,6 +19,8 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx\SheetViewOptions; use PhpOffice\PhpSpreadsheet\Reader\Xlsx\SheetViews; use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Theme; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx\WorkbookView; use PhpOffice\PhpSpreadsheet\ReferenceHelper; use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\Settings; @@ -34,7 +36,6 @@ use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use SimpleXMLElement; -use stdClass; use Throwable; use XMLReader; use ZipArchive; @@ -50,18 +51,14 @@ class Xlsx extends BaseReader */ private $referenceHelper; - /** - * Xlsx\Theme instance. - * - * @var Xlsx\Theme - */ - private static $theme; - /** * @var ZipArchive */ private $zip; + /** @var Styles */ + private $styleReader; + /** * Create a new Xlsx Reader instance. */ @@ -153,6 +150,7 @@ private function loadZipNonamespace(string $filename, string $ns): SimpleXMLElem private const REL_TO_MAIN = [ Namespaces::PURL_OFFICE_DOCUMENT => Namespaces::PURL_MAIN, + Namespaces::THUMBNAIL => '', ]; private const REL_TO_DRAWING = [ @@ -370,6 +368,9 @@ private function getFromZipArchive(ZipArchive $archive, $fileName = '') if (strpos($fileName, '//') !== false) { $fileName = substr($fileName, strpos($fileName, '//') + 1); } + // Relative paths generated by dirname($filename) when $filename + // has no path (i.e.files in root of the zip archive) + $fileName = (string) preg_replace('/^\.\//', '', $fileName); $fileName = File::realpath($fileName); // Sadly, some 3rd party xlsx generators don't use consistent case for filenaming @@ -387,10 +388,9 @@ private function getFromZipArchive(ZipArchive $archive, $fileName = '') /** * Loads Spreadsheet from file. */ - public function load(string $filename, int $flags = 0): Spreadsheet + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { File::assertFile($filename, self::INITIAL_FILE); - $this->processFlags($flags); // Initialisations $excel = new Spreadsheet(); @@ -406,6 +406,8 @@ public function load(string $filename, int $flags = 0): Spreadsheet // Read the theme first, because we need the colour scheme when reading the styles [$workbookBasename, $xmlNamespaceBase] = $this->getWorkbookBaseName(); $wbRels = $this->loadZip("xl/_rels/${workbookBasename}.rels", Namespaces::RELATIONSHIPS); + $theme = null; + $this->styleReader = new Styles(); foreach ($wbRels->Relationship as $relx) { $rel = self::getAttributes($relx); $relTarget = (string) $rel['Target']; @@ -438,7 +440,8 @@ public function load(string $filename, int $flags = 0): Spreadsheet $themeColours[$themePos] = (string) $xmlColourData['val']; } } - self::$theme = new Xlsx\Theme($themeName, $colourSchemeName, $themeColours); + $theme = new Theme($themeName, $colourSchemeName, $themeColours); + $this->styleReader->setTheme($theme); break; } @@ -539,16 +542,16 @@ public function load(string $filename, int $flags = 0): Spreadsheet if ($xpath === null) { $xmlStyles = self::testSimpleXml(null); } else { - // I think Nonamespace is okay because I'm using xpath. - $xmlStyles = $this->loadZipNonamespace("$dir/$xpath[Target]", $mainNS); + $xmlStyles = $this->loadZip("$dir/$xpath[Target]", $mainNS); } - $xmlStyles->registerXPathNamespace('smm', Namespaces::MAIN); - $fills = self::xpathNoFalse($xmlStyles, 'smm:fills/smm:fill'); - $fonts = self::xpathNoFalse($xmlStyles, 'smm:fonts/smm:font'); - $borders = self::xpathNoFalse($xmlStyles, 'smm:borders/smm:border'); - $xfTags = self::xpathNoFalse($xmlStyles, 'smm:cellXfs/smm:xf'); - $cellXfTags = self::xpathNoFalse($xmlStyles, 'smm:cellStyleXfs/smm:xf'); + $palette = self::extractPalette($xmlStyles); + $this->styleReader->setWorkbookPalette($palette); + $fills = self::extractStyles($xmlStyles, 'fills', 'fill'); + $fonts = self::extractStyles($xmlStyles, 'fonts', 'font'); + $borders = self::extractStyles($xmlStyles, 'borders', 'border'); + $xfTags = self::extractStyles($xmlStyles, 'cellXfs', 'xf'); + $cellXfTags = self::extractStyles($xmlStyles, 'cellStyleXfs', 'xf'); $styles = []; $cellStyles = []; @@ -559,6 +562,7 @@ public function load(string $filename, int $flags = 0): Spreadsheet if (isset($numFmts) && ($numFmts !== null)) { $numFmts->registerXPathNamespace('sml', $mainNS); } + $this->styleReader->setNamespace($mainNS); if (!$this->readDataOnly/* && $xmlStyles*/) { foreach ($xfTags as $xfTag) { $xf = self::getAttributes($xfTag); @@ -599,7 +603,7 @@ public function load(string $filename, int $flags = 0): Spreadsheet // add style to cellXf collection $objStyle = new Style(); - self::readStyle($objStyle, $style); + $this->styleReader->readStyle($objStyle, $style); if ($addingFirstCellXf) { $excel->removeCellXfByIndex(0); // remove the default style $addingFirstCellXf = false; @@ -634,7 +638,7 @@ public function load(string $filename, int $flags = 0): Spreadsheet // add style to cellStyleXf collection $objStyle = new Style(); - self::readStyle($objStyle, $cellStyle); + $this->styleReader->readStyle($objStyle, $cellStyle); if ($addingFirstCellStyleXf) { $excel->removeCellStyleXfByIndex(0); // remove the default style $addingFirstCellStyleXf = false; @@ -642,10 +646,11 @@ public function load(string $filename, int $flags = 0): Spreadsheet $excel->addCellStyleXf($objStyle); } } - $styleReader = new Styles($xmlStyles); - $styleReader->setStyleBaseData(self::$theme, $styles, $cellStyles); - $dxfs = $styleReader->dxfs($this->readDataOnly); - $styles = $styleReader->styles(); + $this->styleReader->setStyleXml($xmlStyles); + $this->styleReader->setNamespace($mainNS); + $this->styleReader->setStyleBaseData($theme, $styles, $cellStyles); + $dxfs = $this->styleReader->dxfs($this->readDataOnly); + $styles = $this->styleReader->styles(); $xmlWorkbook = $this->loadZipNoNamespace($relTarget, $mainNS); $xmlWorkbookNS = $this->loadZip($relTarget, $mainNS); @@ -709,16 +714,19 @@ public function load(string $filename, int $flags = 0): Spreadsheet $xmlSheetMain = $xmlSheetNS->children($mainNS); // Setting Conditional Styles adjusts selected cells, so we need to execute this // before reading the sheet view data to get the actual selected cells - if (!$this->readDataOnly && $xmlSheet->conditionalFormatting) { + if (!$this->readDataOnly && ($xmlSheet->conditionalFormatting)) { (new ConditionalStyles($docSheet, $xmlSheet, $dxfs))->load(); } + if (!$this->readDataOnly && $xmlSheet->extLst) { + (new ConditionalStyles($docSheet, $xmlSheet, $dxfs))->loadFromExt($this->styleReader); + } if (isset($xmlSheetMain->sheetViews, $xmlSheetMain->sheetViews->sheetView)) { $sheetViews = new SheetViews($xmlSheetMain->sheetViews->sheetView, $docSheet); $sheetViews->load(); } $sheetViewOptions = new SheetViewOptions($docSheet, $xmlSheet); - $sheetViewOptions->load($this->getReadDataOnly()); + $sheetViewOptions->load($this->getReadDataOnly(), $this->styleReader); (new ColumnAndRowAttributes($docSheet, $xmlSheet)) ->load($this->getReadFilter(), $this->getReadDataOnly()); @@ -768,7 +776,12 @@ public function load(string $filename, int $flags = 0): Spreadsheet break; case 'b': if (!isset($c->f)) { - $value = self::castToBoolean($c); + if (isset($c->v)) { + $value = self::castToBoolean($c); + } else { + $value = null; + $cellDataType = DATATYPE::TYPE_NULL; + } } else { // Formula $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToBoolean'); @@ -822,10 +835,12 @@ public function load(string $filename, int $flags = 0): Spreadsheet // Assign value if ($cellDataType != '') { // it is possible, that datatype is numeric but with an empty string, which result in an error - if ($cellDataType === DataType::TYPE_NUMERIC && $value === '') { - $cellDataType = DataType::TYPE_STRING; + if ($cellDataType === DataType::TYPE_NUMERIC && ($value === '' || $value === null)) { + $cellDataType = DataType::TYPE_NULL; + } + if ($cellDataType !== DataType::TYPE_NULL) { + $cell->setValueExplicit($value, $cellDataType); } - $cell->setValueExplicit($value, $cellDataType); } else { $cell->setValue($value); } @@ -882,7 +897,7 @@ public function load(string $filename, int $flags = 0): Spreadsheet } foreach ($xmlSheet->extLst->ext->children('x14', true)->dataValidations->dataValidation as $item) { - $node = $xmlSheet->dataValidations->addChild('dataValidation'); + $node = self::testSimpleXml($xmlSheet->dataValidations)->addChild('dataValidation'); foreach ($item->attributes() ?? [] as $attr) { $node->addAttribute($attr->getName(), $attr); } @@ -985,6 +1000,19 @@ public function load(string $filename, int $flags = 0): Spreadsheet continue; } + // Locate VML drawings image relations + $drowingImages = []; + $VMLDrawingsRelations = dirname($relPath) . '/_rels/' . basename($relPath) . '.rels'; + if ($zip->locateName($VMLDrawingsRelations)) { + $relsVMLDrawing = $this->loadZip($VMLDrawingsRelations, Namespaces::RELATIONSHIPS); + foreach ($relsVMLDrawing->Relationship as $elex) { + $ele = self::getAttributes($elex); + if ($ele['Type'] == Namespaces::IMAGE) { + $drowingImages[(string) $ele['Id']] = (string) $ele['Target']; + } + } + } + $shapes = self::xpathNoFalse($vmlCommentsFile, '//v:shape'); foreach ($shapes as $shape) { $shape->registerXPathNamespace('v', Namespaces::URN_VML); @@ -994,6 +1022,8 @@ public function load(string $filename, int $flags = 0): Spreadsheet $fillColor = strtoupper(substr((string) $shape['fillcolor'], 1)); $column = null; $row = null; + $fillImageRelId = null; + $fillImageTitle = ''; $clientData = $shape->xpath('.//x:ClientData'); if (is_array($clientData) && !empty($clientData)) { @@ -1012,10 +1042,39 @@ public function load(string $filename, int $flags = 0): Spreadsheet } } + $fillImageRelNode = $shape->xpath('.//v:fill/@o:relid'); + if (is_array($fillImageRelNode) && !empty($fillImageRelNode)) { + $fillImageRelNode = $fillImageRelNode[0]; + + if (isset($fillImageRelNode['relid'])) { + $fillImageRelId = (string) $fillImageRelNode['relid']; + } + } + + $fillImageTitleNode = $shape->xpath('.//v:fill/@o:title'); + if (is_array($fillImageTitleNode) && !empty($fillImageTitleNode)) { + $fillImageTitleNode = $fillImageTitleNode[0]; + + if (isset($fillImageTitleNode['title'])) { + $fillImageTitle = (string) $fillImageTitleNode['title']; + } + } + if (($column !== null) && ($row !== null)) { // Set comment properties $comment = $docSheet->getCommentByColumnAndRow($column + 1, $row + 1); $comment->getFillColor()->setRGB($fillColor); + if (isset($drowingImages[$fillImageRelId])) { + $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); + $objDrawing->setName($fillImageTitle); + $imagePath = str_replace('../', 'xl/', $drowingImages[$fillImageRelId]); + $objDrawing->setPath( + 'zip://' . File::realpath($filename) . '#' . $imagePath, + true, + $zip + ); + $comment->setBackgroundImage($objDrawing); + } // Parse style $styleArray = explode(';', str_replace(' ', '', $style)); @@ -1207,8 +1266,8 @@ public function load(string $filename, int $flags = 0): Spreadsheet $objDrawing->setOffsetX((int) Drawing::EMUToPixels($oneCellAnchor->from->colOff)); $objDrawing->setOffsetY(Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); $objDrawing->setResizeProportional(false); - $objDrawing->setWidth(Drawing::EMUToPixels(self::getArrayItem((int) self::getAttributes($oneCellAnchor->ext), 'cx'))); - $objDrawing->setHeight(Drawing::EMUToPixels(self::getArrayItem((int) self::getAttributes($oneCellAnchor->ext), 'cy'))); + $objDrawing->setWidth(Drawing::EMUToPixels(self::getArrayItem(self::getAttributes($oneCellAnchor->ext), 'cx'))); + $objDrawing->setHeight(Drawing::EMUToPixels(self::getArrayItem(self::getAttributes($oneCellAnchor->ext), 'cy'))); if ($xfrm) { $objDrawing->setRotation((int) Drawing::angleToDegrees(self::getArrayItem(self::getAttributes($xfrm), 'rot'))); } @@ -1259,6 +1318,11 @@ public function load(string $filename, int $flags = 0): Spreadsheet $outerShdw = $twoCellAnchor->pic->spPr->children(Namespaces::DRAWINGML)->effectLst->outerShdw; $hlinkClick = $twoCellAnchor->pic->nvPicPr->cNvPr->children(Namespaces::DRAWINGML)->hlinkClick; $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); + /** @scrutinizer ignore-call */ + $editAs = $twoCellAnchor->attributes(); + if (isset($editAs, $editAs['editAs'])) { + $objDrawing->setEditAs($editAs['editAs']); + } $objDrawing->setName((string) self::getArrayItem(self::getAttributes($twoCellAnchor->pic->nvPicPr->cNvPr), 'name')); $objDrawing->setDescription((string) self::getArrayItem(self::getAttributes($twoCellAnchor->pic->nvPicPr->cNvPr), 'descr')); $embedImageKey = (string) self::getArrayItem( @@ -1285,6 +1349,12 @@ public function load(string $filename, int $flags = 0): Spreadsheet $objDrawing->setOffsetX(Drawing::EMUToPixels($twoCellAnchor->from->colOff)); $objDrawing->setOffsetY(Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); + + $objDrawing->setCoordinates2(Coordinate::stringFromColumnIndex(((int) $twoCellAnchor->to->col) + 1) . ($twoCellAnchor->to->row + 1)); + + $objDrawing->setOffsetX2(Drawing::EMUToPixels($twoCellAnchor->to->colOff)); + $objDrawing->setOffsetY2(Drawing::EMUToPixels($twoCellAnchor->to->rowOff)); + $objDrawing->setResizeProportional(false); if ($xfrm) { @@ -1503,62 +1573,7 @@ public function load(string $filename, int $flags = 0): Spreadsheet } } - $workbookView = $xmlWorkbook->children($mainNS)->bookViews->workbookView; - if ((!$this->readDataOnly || !empty($this->loadSheetsOnly)) && !empty($workbookView)) { - $workbookViewAttributes = self::testSimpleXml(self::getAttributes($workbookView)); - // active sheet index - $activeTab = (int) $workbookViewAttributes->activeTab; // refers to old sheet index - - // keep active sheet index if sheet is still loaded, else first sheet is set as the active - if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) { - $excel->setActiveSheetIndex($mapSheetId[$activeTab]); - } else { - if ($excel->getSheetCount() == 0) { - $excel->createSheet(); - } - $excel->setActiveSheetIndex(0); - } - - if (isset($workbookViewAttributes->showHorizontalScroll)) { - $showHorizontalScroll = (string) $workbookViewAttributes->showHorizontalScroll; - $excel->setShowHorizontalScroll($this->castXsdBooleanToBool($showHorizontalScroll)); - } - - if (isset($workbookViewAttributes->showVerticalScroll)) { - $showVerticalScroll = (string) $workbookViewAttributes->showVerticalScroll; - $excel->setShowVerticalScroll($this->castXsdBooleanToBool($showVerticalScroll)); - } - - if (isset($workbookViewAttributes->showSheetTabs)) { - $showSheetTabs = (string) $workbookViewAttributes->showSheetTabs; - $excel->setShowSheetTabs($this->castXsdBooleanToBool($showSheetTabs)); - } - - if (isset($workbookViewAttributes->minimized)) { - $minimized = (string) $workbookViewAttributes->minimized; - $excel->setMinimized($this->castXsdBooleanToBool($minimized)); - } - - if (isset($workbookViewAttributes->autoFilterDateGrouping)) { - $autoFilterDateGrouping = (string) $workbookViewAttributes->autoFilterDateGrouping; - $excel->setAutoFilterDateGrouping($this->castXsdBooleanToBool($autoFilterDateGrouping)); - } - - if (isset($workbookViewAttributes->firstSheet)) { - $firstSheet = (string) $workbookViewAttributes->firstSheet; - $excel->setFirstSheetIndex((int) $firstSheet); - } - - if (isset($workbookViewAttributes->visibility)) { - $visibility = (string) $workbookViewAttributes->visibility; - $excel->setVisibility($visibility); - } - - if (isset($workbookViewAttributes->tabRatio)) { - $tabRatio = (string) $workbookViewAttributes->tabRatio; - $excel->setTabRatio((int) $tabRatio); - } - } + (new WorkbookView($excel))->viewSettings($xmlWorkbook, $mainNS, $mapSheetId, $this->readDataOnly); break; } @@ -1618,45 +1633,6 @@ public function load(string $filename, int $flags = 0): Spreadsheet return $excel; } - /** - * @param SimpleXMLElement|stdClass $style - */ - private static function readStyle(Style $docStyle, $style): void - { - $docStyle->getNumberFormat()->setFormatCode($style->numFmt); - - // font - if (isset($style->font)) { - Styles::readFontStyle($docStyle->getFont(), $style->font); - } - - // fill - if (isset($style->fill)) { - Styles::readFillStyle($docStyle->getFill(), $style->fill); - } - - // border - if (isset($style->border)) { - Styles::readBorderStyle($docStyle->getBorders(), $style->border); - } - - // alignment - if (isset($style->alignment)) { - Styles::readAlignmentStyle($docStyle->getAlignment(), $style->alignment); - } - - // protection - if (isset($style->protection)) { - Styles::readProtectionLocked($docStyle, $style); - Styles::readProtectionHidden($docStyle, $style); - } - - // top-level style settings - if (isset($style->quotePrefix)) { - $docStyle->setQuotePrefix((bool) $style->quotePrefix); - } - } - /** * @return RichText */ @@ -1676,16 +1652,20 @@ private function parseRichText(?SimpleXMLElement $is) } else { $objText = $value->createTextRun(StringHelper::controlCharacterOOXML2PHP((string) $run->t)); - $attr = $run->rPr->rFont->attributes(); - if (isset($attr['val'])) { - $objText->getFont()->setName((string) $attr['val']); + if (isset($run->rPr->rFont)) { + $attr = $run->rPr->rFont->attributes(); + if (isset($attr['val'])) { + $objText->getFont()->setName((string) $attr['val']); + } } - $attr = $run->rPr->sz->attributes(); - if (isset($attr['val'])) { - $objText->getFont()->setSize((float) $attr['val']); + if (isset($run->rPr->sz)) { + $attr = $run->rPr->sz->attributes(); + if (isset($attr['val'])) { + $objText->getFont()->setSize((float) $attr['val']); + } } if (isset($run->rPr->color)) { - $objText->getFont()->setColor(new Color(Styles::readColor($run->rPr->color))); + $objText->getFont()->setColor(new Color($this->styleReader->readColor($run->rPr->color))); } if (isset($run->rPr->b)) { $attr = $run->rPr->b->attributes(); @@ -1952,29 +1932,6 @@ private function readPrinterSettings(Spreadsheet $excel, $dir, $fileWorksheet, $ unset($unparsedPrinterSettings); } - /** - * Convert an 'xsd:boolean' XML value to a PHP boolean value. - * A valid 'xsd:boolean' XML value can be one of the following - * four values: 'true', 'false', '1', '0'. It is case sensitive. - * - * Note that just doing '(bool) $xsdBoolean' is not safe, - * since '(bool) "false"' returns true. - * - * @see https://www.w3.org/TR/xmlschema11-2/#boolean - * - * @param string $xsdBoolean An XML string value of type 'xsd:boolean' - * - * @return bool Boolean value - */ - private function castXsdBooleanToBool($xsdBoolean) - { - if ($xsdBoolean === 'false') { - return false; - } - - return (bool) $xsdBoolean; - } - private function getWorkbookBaseName(): array { $workbookBasename = ''; @@ -2073,4 +2030,33 @@ private function readAutoFilterTablesInTablesFile( } } } + + private static function extractStyles(?SimpleXMLElement $sxml, string $node1, string $node2): array + { + $array = []; + if ($sxml && $sxml->{$node1}->{$node2}) { + foreach ($sxml->{$node1}->{$node2} as $node) { + $array[] = $node; + } + } + + return $array; + } + + private static function extractPalette(?SimpleXMLElement $sxml): array + { + $array = []; + if ($sxml && $sxml->colors->indexedColors) { + foreach ($sxml->colors->indexedColors->rgbColor as $node) { + if ($node !== null) { + $attr = $node->attributes(); + if (isset($attr['rgb'])) { + $array[] = (string) $attr['rgb']; + } + } + } + } + + return (count($array) === 64) ? $array : []; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php index 155ed73..fdc56ce 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php @@ -22,7 +22,7 @@ public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml public function load(): void { // Remove all "$" in the auto filter range - $autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref']); + $autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref'] ?? ''); if (strpos($autoFilterRange, ':') !== false) { $this->readAutoFilter($autoFilterRange, $this->worksheetXml); } @@ -61,6 +61,7 @@ private function readAutoFilter($autoFilterRange, $xmlSheet): void // Check for dynamic filters $this->readTopTenAutoFilter($filterColumn, $column); } + $autoFilter->setEvaluated(true); } private function readDateRangeAutoFilter(SimpleXMLElement $filters, Column $column): void diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php index 667e367..a563512 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\Layout; @@ -414,7 +414,7 @@ private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n') $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); if ($dataType == 's') { $seriesVal[$pointVal] = (string) $seriesValue->v; - } elseif ($seriesValue->v === Functions::NA()) { + } elseif ($seriesValue->v === ExcelError::NA()) { $seriesVal[$pointVal] = null; } else { $seriesVal[$pointVal] = (float) $seriesValue->v; @@ -452,7 +452,7 @@ private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataTy $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); if ($dataType == 's') { $seriesVal[$pointVal][] = (string) $seriesValue->v; - } elseif ($seriesValue->v === Functions::NA()) { + } elseif ($seriesValue->v === ExcelError::NA()) { $seriesVal[$pointVal] = null; } else { $seriesVal[$pointVal][] = (float) $seriesValue->v; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php index dcd7ad1..c631a0f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php @@ -2,10 +2,12 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles as StyleReader; use PhpOffice\PhpSpreadsheet\Style\Conditional; use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalDataBar; use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormattingRuleExtension; use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\ConditionalFormatValueObject; +use PhpOffice\PhpSpreadsheet\Style\Style as Style; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use SimpleXMLElement; @@ -15,6 +17,11 @@ class ConditionalStyles private $worksheetXml; + /** + * @var array + */ + private $ns; + private $dxfs; public function __construct(Worksheet $workSheet, SimpleXMLElement $worksheetXml, array $dxfs = []) @@ -33,7 +40,113 @@ public function load(): void ); } - private function readConditionalStyles($xmlSheet) + public function loadFromExt(StyleReader $styleReader): void + { + $this->ns = $this->worksheetXml->getNamespaces(true); + $this->setConditionalsFromExt( + $this->readConditionalsFromExt($this->worksheetXml->extLst, $styleReader) + ); + } + + private function setConditionalsFromExt(array $conditionals): void + { + foreach ($conditionals as $conditionalRange => $cfRules) { + ksort($cfRules); + // Priority is used as the key for sorting; but may not start at 0, + // so we use array_values to reset the index after sorting. + $this->worksheet->getStyle($conditionalRange) + ->setConditionalStyles(array_values($cfRules)); + } + } + + private function readConditionalsFromExt(SimpleXMLElement $extLst, StyleReader $styleReader): array + { + $conditionals = []; + + if (isset($extLst->ext['uri']) && (string) $extLst->ext['uri'] === '{78C0D931-6437-407d-A8EE-F0AAD7539E65}') { + $conditionalFormattingRuleXml = $extLst->ext->children($this->ns['x14']); + if (!$conditionalFormattingRuleXml->conditionalFormattings) { + return []; + } + + foreach ($conditionalFormattingRuleXml->children($this->ns['x14']) as $extFormattingXml) { + $extFormattingRangeXml = $extFormattingXml->children($this->ns['xm']); + if (!$extFormattingRangeXml->sqref) { + continue; + } + + $sqref = (string) $extFormattingRangeXml->sqref; + $extCfRuleXml = $extFormattingXml->cfRule; + + $attributes = $extCfRuleXml->attributes(); + if (!$attributes) { + continue; + } + $conditionType = (string) $attributes->type; + if ( + !Conditional::isValidConditionType($conditionType) || + $conditionType === Conditional::CONDITION_DATABAR + ) { + continue; + } + + $priority = (int) $attributes->priority; + + $conditional = $this->readConditionalRuleFromExt($extCfRuleXml, $attributes); + $cfStyle = $this->readStyleFromExt($extCfRuleXml, $styleReader); + $conditional->setStyle($cfStyle); + $conditionals[$sqref][$priority] = $conditional; + } + } + + return $conditionals; + } + + private function readConditionalRuleFromExt(SimpleXMLElement $cfRuleXml, SimpleXMLElement $attributes): Conditional + { + $conditionType = (string) $attributes->type; + $operatorType = (string) $attributes->operator; + + $operands = []; + foreach ($cfRuleXml->children($this->ns['xm']) as $cfRuleOperandsXml) { + $operands[] = (string) $cfRuleOperandsXml; + } + + $conditional = new Conditional(); + $conditional->setConditionType($conditionType); + $conditional->setOperatorType($operatorType); + if ( + $conditionType === Conditional::CONDITION_CONTAINSTEXT || + $conditionType === Conditional::CONDITION_NOTCONTAINSTEXT || + $conditionType === Conditional::CONDITION_BEGINSWITH || + $conditionType === Conditional::CONDITION_ENDSWITH || + $conditionType === Conditional::CONDITION_TIMEPERIOD + ) { + $conditional->setText(array_pop($operands) ?? ''); + } + $conditional->setConditions($operands); + + return $conditional; + } + + private function readStyleFromExt(SimpleXMLElement $extCfRuleXml, StyleReader $styleReader): Style + { + $cfStyle = new Style(false, true); + if ($extCfRuleXml->dxf) { + $styleXML = $extCfRuleXml->dxf->children(); + + if ($styleXML->borders) { + $styleReader->readBorderStyle($cfStyle->getBorders(), $styleXML->borders); + } + if ($styleXML->fill) { + $styleReader->readFillStyle($cfStyle->getFill(), $styleXML->fill); + } + } + + return $cfStyle; + } + + private function readConditionalStyles($xmlSheet): array { $conditionals = []; foreach ($xmlSheet->conditionalFormatting as $conditional) { @@ -51,12 +164,12 @@ private function readConditionalStyles($xmlSheet) private function setConditionalStyles(Worksheet $worksheet, array $conditionals, $xmlExtLst): void { - foreach ($conditionals as $ref => $cfRules) { + foreach ($conditionals as $cellRangeReference => $cfRules) { ksort($cfRules); $conditionalStyles = $this->readStyleRules($cfRules, $xmlExtLst); - // Extract all cell references in $ref - $cellBlocks = explode(' ', str_replace('$', '', strtoupper($ref))); + // Extract all cell references in $cellRangeReference + $cellBlocks = explode(' ', str_replace('$', '', strtoupper($cellRangeReference))); foreach ($cellBlocks as $cellBlock) { $worksheet->getStyle($cellBlock)->setConditionalStyles($conditionalStyles); } @@ -67,6 +180,7 @@ private function readStyleRules($cfRules, $extLst) { $conditionalFormattingRuleExtensions = ConditionalFormattingRuleExtension::parseExtLstXml($extLst); $conditionalStyles = []; + foreach ($cfRules as $cfRule) { $objConditional = new Conditional(); $objConditional->setConditionType((string) $cfRule['type']); @@ -74,18 +188,27 @@ private function readStyleRules($cfRules, $extLst) if ((string) $cfRule['text'] != '') { $objConditional->setText((string) $cfRule['text']); + } elseif ((string) $cfRule['timePeriod'] != '') { + $objConditional->setText((string) $cfRule['timePeriod']); } if (isset($cfRule['stopIfTrue']) && (int) $cfRule['stopIfTrue'] === 1) { $objConditional->setStopIfTrue(true); } - if (count($cfRule->formula) > 1) { - foreach ($cfRule->formula as $formula) { - $objConditional->addCondition((string) $formula); + if (count($cfRule->formula) >= 1) { + foreach ($cfRule->formula as $formulax) { + $formula = (string) $formulax; + if ($formula === 'TRUE') { + $objConditional->addCondition(true); + } elseif ($formula === 'FALSE') { + $objConditional->addCondition(false); + } else { + $objConditional->addCondition($formula); + } } } else { - $objConditional->addCondition((string) $cfRule->formula); + $objConditional->addCondition(''); } if (isset($cfRule->dataBar)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php index 54f56d7..c0713ae 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php @@ -14,6 +14,8 @@ class Namespaces // This one used in Reader\Xlsx\Properties const CORE_PROPERTIES2 = 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties'; + const THUMBNAIL = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail'; + const THEME = 'http://schemas.openxmlformats.org/package/2006/relationships/theme'; const COMPATIBILITY = 'http://schemas.openxmlformats.org/markup-compatibility/2006'; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php index 1235881..a302cc5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php @@ -17,17 +17,14 @@ public function __construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXm $this->worksheetXml = $worksheetXml; } - /** - * @param bool $readDataOnly - */ - public function load($readDataOnly = false): void + public function load(bool $readDataOnly, Styles $styleReader): void { if ($this->worksheetXml === null) { return; } if (isset($this->worksheetXml->sheetPr)) { - $this->tabColor($this->worksheetXml->sheetPr); + $this->tabColor($this->worksheetXml->sheetPr, $styleReader); $this->codeName($this->worksheetXml->sheetPr); $this->outlines($this->worksheetXml->sheetPr); $this->pageSetup($this->worksheetXml->sheetPr); @@ -42,10 +39,10 @@ public function load($readDataOnly = false): void } } - private function tabColor(SimpleXMLElement $sheetPr): void + private function tabColor(SimpleXMLElement $sheetPr, Styles $styleReader): void { - if (isset($sheetPr->tabColor, $sheetPr->tabColor['rgb'])) { - $this->worksheet->getTabColor()->setARGB((string) $sheetPr->tabColor['rgb']); + if (isset($sheetPr->tabColor)) { + $this->worksheet->getTabColor()->setARGB($styleReader->readColor($sheetPr->tabColor)); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php index 72e66a9..2c15c51 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php @@ -13,117 +13,187 @@ use PhpOffice\PhpSpreadsheet\Style\Protection; use PhpOffice\PhpSpreadsheet\Style\Style; use SimpleXMLElement; +use stdClass; class Styles extends BaseParserClass { /** * Theme instance. * - * @var Theme + * @var ?Theme */ - private static $theme; + private $theme; + /** @var array */ + private $workbookPalette = []; + + /** @var array */ private $styles = []; + /** @var array */ private $cellStyles = []; + /** @var SimpleXMLElement */ private $styleXml; - public function __construct(SimpleXMLElement $styleXml) + /** @var string */ + private $namespace = ''; + + public function setNamespace(string $namespace): void + { + $this->namespace = $namespace; + } + + public function setWorkbookPalette(array $palette): void + { + $this->workbookPalette = $palette; + } + + /** + * Cast SimpleXMLElement to bool to overcome Scrutinizer problem. + * + * @param mixed $value + */ + private static function castBool($value): bool + { + return (bool) $value; + } + + private function getStyleAttributes(SimpleXMLElement $value): SimpleXMLElement + { + $attr = null; + if (self::castBool($value)) { + $attr = $value->attributes(''); + if ($attr === null || count($attr) === 0) { + $attr = $value->attributes($this->namespace); + } + } + + return Xlsx::testSimpleXml($attr); + } + + public function setStyleXml(SimpleXmlElement $styleXml): void { $this->styleXml = $styleXml; } - public function setStyleBaseData(?Theme $theme = null, $styles = [], $cellStyles = []): void + public function setTheme(Theme $theme): void + { + $this->theme = $theme; + } + + public function setStyleBaseData(?Theme $theme = null, array $styles = [], array $cellStyles = []): void { - self::$theme = $theme; + $this->theme = $theme; $this->styles = $styles; $this->cellStyles = $cellStyles; } - public static function readFontStyle(Font $fontStyle, SimpleXMLElement $fontStyleXml): void + public function readFontStyle(Font $fontStyle, SimpleXMLElement $fontStyleXml): void { - if (isset($fontStyleXml->name, $fontStyleXml->name['val'])) { - $fontStyle->setName((string) $fontStyleXml->name['val']); + if (isset($fontStyleXml->name)) { + $attr = $this->getStyleAttributes($fontStyleXml->name); + if (isset($attr['val'])) { + $fontStyle->setName((string) $attr['val']); + } } - if (isset($fontStyleXml->sz, $fontStyleXml->sz['val'])) { - $fontStyle->setSize((float) $fontStyleXml->sz['val']); + if (isset($fontStyleXml->sz)) { + $attr = $this->getStyleAttributes($fontStyleXml->sz); + if (isset($attr['val'])) { + $fontStyle->setSize((float) $attr['val']); + } } if (isset($fontStyleXml->b)) { - $fontStyle->setBold(!isset($fontStyleXml->b['val']) || self::boolean((string) $fontStyleXml->b['val'])); + $attr = $this->getStyleAttributes($fontStyleXml->b); + $fontStyle->setBold(!isset($attr['val']) || self::boolean((string) $attr['val'])); } if (isset($fontStyleXml->i)) { - $fontStyle->setItalic(!isset($fontStyleXml->i['val']) || self::boolean((string) $fontStyleXml->i['val'])); + $attr = $this->getStyleAttributes($fontStyleXml->i); + $fontStyle->setItalic(!isset($attr['val']) || self::boolean((string) $attr['val'])); } if (isset($fontStyleXml->strike)) { - $fontStyle->setStrikethrough( - !isset($fontStyleXml->strike['val']) || self::boolean((string) $fontStyleXml->strike['val']) - ); + $attr = $this->getStyleAttributes($fontStyleXml->strike); + $fontStyle->setStrikethrough(!isset($attr['val']) || self::boolean((string) $attr['val'])); } - $fontStyle->getColor()->setARGB(self::readColor($fontStyleXml->color)); + $fontStyle->getColor()->setARGB($this->readColor($fontStyleXml->color)); - if (isset($fontStyleXml->u) && !isset($fontStyleXml->u['val'])) { - $fontStyle->setUnderline(Font::UNDERLINE_SINGLE); - } elseif (isset($fontStyleXml->u, $fontStyleXml->u['val'])) { - $fontStyle->setUnderline((string) $fontStyleXml->u['val']); + if (isset($fontStyleXml->u)) { + $attr = $this->getStyleAttributes($fontStyleXml->u); + if (!isset($attr['val'])) { + $fontStyle->setUnderline(Font::UNDERLINE_SINGLE); + } else { + $fontStyle->setUnderline((string) $attr['val']); + } } - - if (isset($fontStyleXml->vertAlign, $fontStyleXml->vertAlign['val'])) { - $verticalAlign = strtolower((string) $fontStyleXml->vertAlign['val']); - if ($verticalAlign === 'superscript') { - $fontStyle->setSuperscript(true); - } elseif ($verticalAlign === 'subscript') { - $fontStyle->setSubscript(true); + if (isset($fontStyleXml->vertAlign)) { + $attr = $this->getStyleAttributes($fontStyleXml->vertAlign); + if (isset($attr['val'])) { + $verticalAlign = strtolower((string) $attr['val']); + if ($verticalAlign === 'superscript') { + $fontStyle->setSuperscript(true); + } elseif ($verticalAlign === 'subscript') { + $fontStyle->setSubscript(true); + } } } } - private static function readNumberFormat(NumberFormat $numfmtStyle, SimpleXMLElement $numfmtStyleXml): void + private function readNumberFormat(NumberFormat $numfmtStyle, SimpleXMLElement $numfmtStyleXml): void { - if ($numfmtStyleXml->count() === 0) { + if ((string) $numfmtStyleXml['formatCode'] !== '') { + $numfmtStyle->setFormatCode(self::formatGeneral((string) $numfmtStyleXml['formatCode'])); + return; } - $numfmt = Xlsx::getAttributes($numfmtStyleXml); - if ($numfmt->count() > 0 && isset($numfmt['formatCode'])) { - $numfmtStyle->setFormatCode((string) $numfmt['formatCode']); + $numfmt = $this->getStyleAttributes($numfmtStyleXml); + if (isset($numfmt['formatCode'])) { + $numfmtStyle->setFormatCode(self::formatGeneral((string) $numfmt['formatCode'])); } } - public static function readFillStyle(Fill $fillStyle, SimpleXMLElement $fillStyleXml): void + public function readFillStyle(Fill $fillStyle, SimpleXMLElement $fillStyleXml): void { if ($fillStyleXml->gradientFill) { /** @var SimpleXMLElement $gradientFill */ $gradientFill = $fillStyleXml->gradientFill[0]; - if (!empty($gradientFill['type'])) { - $fillStyle->setFillType((string) $gradientFill['type']); + $attr = $this->getStyleAttributes($gradientFill); + if (!empty($attr['type'])) { + $fillStyle->setFillType((string) $attr['type']); } - $fillStyle->setRotation((float) ($gradientFill['degree'])); + $fillStyle->setRotation((float) ($attr['degree'])); $gradientFill->registerXPathNamespace('sml', Namespaces::MAIN); - $fillStyle->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color)); - $fillStyle->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color)); + $fillStyle->getStartColor()->setARGB($this->readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color)); + $fillStyle->getEndColor()->setARGB($this->readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color)); } elseif ($fillStyleXml->patternFill) { $defaultFillStyle = Fill::FILL_NONE; if ($fillStyleXml->patternFill->fgColor) { - $fillStyle->getStartColor()->setARGB(self::readColor($fillStyleXml->patternFill->fgColor, true)); + $fillStyle->getStartColor()->setARGB($this->readColor($fillStyleXml->patternFill->fgColor, true)); $defaultFillStyle = Fill::FILL_SOLID; } if ($fillStyleXml->patternFill->bgColor) { - $fillStyle->getEndColor()->setARGB(self::readColor($fillStyleXml->patternFill->bgColor, true)); + $fillStyle->getEndColor()->setARGB($this->readColor($fillStyleXml->patternFill->bgColor, true)); $defaultFillStyle = Fill::FILL_SOLID; } - $patternType = (string) $fillStyleXml->patternFill['patternType'] != '' - ? (string) $fillStyleXml->patternFill['patternType'] - : $defaultFillStyle; + $type = ''; + if ((string) $fillStyleXml->patternFill['patternType'] !== '') { + $type = (string) $fillStyleXml->patternFill['patternType']; + } else { + $attr = $this->getStyleAttributes($fillStyleXml->patternFill); + $type = (string) $attr['patternType']; + } + $patternType = ($type === '') ? $defaultFillStyle : $type; $fillStyle->setFillType($patternType); } } - public static function readBorderStyle(Borders $borderStyle, SimpleXMLElement $borderStyleXml): void + public function readBorderStyle(Borders $borderStyle, SimpleXMLElement $borderStyleXml): void { - $diagonalUp = self::boolean((string) $borderStyleXml['diagonalUp']); - $diagonalDown = self::boolean((string) $borderStyleXml['diagonalDown']); + $diagonalUp = $this->getAttribute($borderStyleXml, 'diagonalUp'); + $diagonalUp = self::boolean($diagonalUp); + $diagonalDown = $this->getAttribute($borderStyleXml, 'diagonalDown'); + $diagonalDown = self::boolean($diagonalDown); if (!$diagonalUp && !$diagonalDown) { $borderStyle->setDiagonalDirection(Borders::DIAGONAL_NONE); } elseif ($diagonalUp && !$diagonalDown) { @@ -134,86 +204,128 @@ public static function readBorderStyle(Borders $borderStyle, SimpleXMLElement $b $borderStyle->setDiagonalDirection(Borders::DIAGONAL_BOTH); } - self::readBorder($borderStyle->getLeft(), $borderStyleXml->left); - self::readBorder($borderStyle->getRight(), $borderStyleXml->right); - self::readBorder($borderStyle->getTop(), $borderStyleXml->top); - self::readBorder($borderStyle->getBottom(), $borderStyleXml->bottom); - self::readBorder($borderStyle->getDiagonal(), $borderStyleXml->diagonal); + $this->readBorder($borderStyle->getLeft(), $borderStyleXml->left); + $this->readBorder($borderStyle->getRight(), $borderStyleXml->right); + $this->readBorder($borderStyle->getTop(), $borderStyleXml->top); + $this->readBorder($borderStyle->getBottom(), $borderStyleXml->bottom); + $this->readBorder($borderStyle->getDiagonal(), $borderStyleXml->diagonal); + } + + private function getAttribute(SimpleXMLElement $xml, string $attribute): string + { + $style = ''; + if ((string) $xml[$attribute] !== '') { + $style = (string) $xml[$attribute]; + } else { + $attr = $this->getStyleAttributes($xml); + if (isset($attr[$attribute])) { + $style = (string) $attr[$attribute]; + } + } + + return $style; } - private static function readBorder(Border $border, SimpleXMLElement $borderXml): void + private function readBorder(Border $border, SimpleXMLElement $borderXml): void { - if (isset($borderXml['style'])) { - $border->setBorderStyle((string) $borderXml['style']); + $style = $this->getAttribute($borderXml, 'style'); + if ($style !== '') { + $border->setBorderStyle((string) $style); } if (isset($borderXml->color)) { - $border->getColor()->setARGB(self::readColor($borderXml->color)); + $border->getColor()->setARGB($this->readColor($borderXml->color)); } } - public static function readAlignmentStyle(Alignment $alignment, SimpleXMLElement $alignmentXml): void + public function readAlignmentStyle(Alignment $alignment, SimpleXMLElement $alignmentXml): void { - $alignment->setHorizontal((string) $alignmentXml['horizontal']); - $alignment->setVertical((string) $alignmentXml['vertical']); - - $textRotation = 0; - if ((int) $alignmentXml['textRotation'] <= 90) { - $textRotation = (int) $alignmentXml['textRotation']; - } elseif ((int) $alignmentXml['textRotation'] > 90) { - $textRotation = 90 - (int) $alignmentXml['textRotation']; - } - - $alignment->setTextRotation((int) $textRotation); - $alignment->setWrapText(self::boolean((string) $alignmentXml['wrapText'])); - $alignment->setShrinkToFit(self::boolean((string) $alignmentXml['shrinkToFit'])); - $alignment->setIndent( - (int) ((string) $alignmentXml['indent']) > 0 ? (int) ((string) $alignmentXml['indent']) : 0 - ); - $alignment->setReadOrder( - (int) ((string) $alignmentXml['readingOrder']) > 0 ? (int) ((string) $alignmentXml['readingOrder']) : 0 - ); + $horizontal = $this->getAttribute($alignmentXml, 'horizontal'); + $alignment->setHorizontal($horizontal); + $vertical = $this->getAttribute($alignmentXml, 'vertical'); + $alignment->setVertical((string) $vertical); + + $textRotation = (int) $this->getAttribute($alignmentXml, 'textRotation'); + if ($textRotation > 90) { + $textRotation = 90 - $textRotation; + } + $alignment->setTextRotation($textRotation); + + $wrapText = $this->getAttribute($alignmentXml, 'wrapText'); + $alignment->setWrapText(self::boolean((string) $wrapText)); + $shrinkToFit = $this->getAttribute($alignmentXml, 'shrinkToFit'); + $alignment->setShrinkToFit(self::boolean((string) $shrinkToFit)); + $indent = (int) $this->getAttribute($alignmentXml, 'indent'); + $alignment->setIndent(max($indent, 0)); + $readingOrder = (int) $this->getAttribute($alignmentXml, 'readingOrder'); + $alignment->setReadOrder(max($readingOrder, 0)); } - private function readStyle(Style $docStyle, $style): void + private static function formatGeneral(string $formatString): string + { + if ($formatString === 'GENERAL') { + $formatString = NumberFormat::FORMAT_GENERAL; + } + + return $formatString; + } + + /** + * Read style. + * + * @param SimpleXMLElement|stdClass $style + */ + public function readStyle(Style $docStyle, $style): void { if ($style->numFmt instanceof SimpleXMLElement) { - self::readNumberFormat($docStyle->getNumberFormat(), $style->numFmt); + $this->readNumberFormat($docStyle->getNumberFormat(), $style->numFmt); } else { - $docStyle->getNumberFormat()->setFormatCode($style->numFmt); + $docStyle->getNumberFormat()->setFormatCode(self::formatGeneral((string) $style->numFmt)); } if (isset($style->font)) { - self::readFontStyle($docStyle->getFont(), $style->font); + $this->readFontStyle($docStyle->getFont(), $style->font); } if (isset($style->fill)) { - self::readFillStyle($docStyle->getFill(), $style->fill); + $this->readFillStyle($docStyle->getFill(), $style->fill); } if (isset($style->border)) { - self::readBorderStyle($docStyle->getBorders(), $style->border); + $this->readBorderStyle($docStyle->getBorders(), $style->border); } - if (isset($style->alignment->alignment)) { - self::readAlignmentStyle($docStyle->getAlignment(), $style->alignment); + if (isset($style->alignment)) { + $this->readAlignmentStyle($docStyle->getAlignment(), $style->alignment); } // protection if (isset($style->protection)) { - self::readProtectionLocked($docStyle, $style); - self::readProtectionHidden($docStyle, $style); + $this->readProtectionLocked($docStyle, $style->protection); + $this->readProtectionHidden($docStyle, $style->protection); } // top-level style settings if (isset($style->quotePrefix)) { - $docStyle->setQuotePrefix(true); + $docStyle->setQuotePrefix((bool) $style->quotePrefix); } } - public static function readProtectionLocked(Style $docStyle, $style): void + /** + * Read protection locked attribute. + */ + public function readProtectionLocked(Style $docStyle, SimpleXMLElement $style): void { - if (isset($style->protection['locked'])) { - if (self::boolean((string) $style->protection['locked'])) { + $locked = ''; + if ((string) $style['locked'] !== '') { + $locked = (string) $style['locked']; + } else { + $attr = $this->getStyleAttributes($style); + if (isset($attr['locked'])) { + $locked = (string) $attr['locked']; + } + } + if ($locked !== '') { + if (self::boolean($locked)) { $docStyle->getProtection()->setLocked(Protection::PROTECTION_PROTECTED); } else { $docStyle->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED); @@ -221,10 +333,22 @@ public static function readProtectionLocked(Style $docStyle, $style): void } } - public static function readProtectionHidden(Style $docStyle, $style): void + /** + * Read protection hidden attribute. + */ + public function readProtectionHidden(Style $docStyle, SimpleXMLElement $style): void { - if (isset($style->protection['hidden'])) { - if (self::boolean((string) $style->protection['hidden'])) { + $hidden = ''; + if ((string) $style['hidden'] !== '') { + $hidden = (string) $style['hidden']; + } else { + $attr = $this->getStyleAttributes($style); + if (isset($attr['hidden'])) { + $hidden = (string) $attr['hidden']; + } + } + if ($hidden !== '') { + if (self::boolean((string) $hidden)) { $docStyle->getProtection()->setHidden(Protection::PROTECTION_PROTECTED); } else { $docStyle->getProtection()->setHidden(Protection::PROTECTION_UNPROTECTED); @@ -232,18 +356,25 @@ public static function readProtectionHidden(Style $docStyle, $style): void } } - public static function readColor($color, $background = false) + public function readColor(SimpleXMLElement $color, bool $background = false): string { - if (isset($color['rgb'])) { - return (string) $color['rgb']; - } elseif (isset($color['indexed'])) { - return Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); - } elseif (isset($color['theme'])) { - if (self::$theme !== null) { - $returnColour = self::$theme->getColourByIndex((int) $color['theme']); - if (isset($color['tint'])) { - $tintAdjust = (float) $color['tint']; - $returnColour = Color::changeBrightness($returnColour, $tintAdjust); + $attr = $this->getStyleAttributes($color); + if (isset($attr['rgb'])) { + return (string) $attr['rgb']; + } + if (isset($attr['indexed'])) { + if (empty($this->workbookPalette)) { + return Color::indexedColor((int) ($attr['indexed'] - 7), $background)->getARGB() ?? ''; + } + + return Color::indexedColor((int) ($attr['indexed']), $background, $this->workbookPalette)->getARGB() ?? ''; + } + if (isset($attr['theme'])) { + if ($this->theme !== null) { + $returnColour = $this->theme->getColourByIndex((int) $attr['theme']); + if (isset($attr['tint'])) { + $tintAdjust = (float) $attr['tint']; + $returnColour = Color::changeBrightness($returnColour ?? '', $tintAdjust); } return 'FF' . $returnColour; @@ -253,7 +384,7 @@ public static function readColor($color, $background = false) return ($background) ? 'FFFFFFFF' : 'FF000000'; } - public function dxfs($readDataOnly = false) + public function dxfs(bool $readDataOnly = false): array { $dxfs = []; if (!$readDataOnly && $this->styleXml) { @@ -285,13 +416,20 @@ public function dxfs($readDataOnly = false) return $dxfs; } - public function styles() + public function styles(): array { return $this->styles; } - private static function getArrayItem($array, $key = 0) + /** + * Get array item. + * + * @param mixed $array (usually array, in theory can be false) + * + * @return stdClass + */ + private static function getArrayItem($array, int $key = 0) { - return $array[$key] ?? null; + return is_array($array) ? ($array[$key] ?? null) : null; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/WorkbookView.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/WorkbookView.php new file mode 100644 index 0000000..9d61e3d --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/WorkbookView.php @@ -0,0 +1,153 @@ +spreadsheet = $spreadsheet; + } + + /** + * @param mixed $mainNS + */ + public function viewSettings(SimpleXMLElement $xmlWorkbook, $mainNS, array $mapSheetId, bool $readDataOnly): void + { + if ($this->spreadsheet->getSheetCount() == 0) { + $this->spreadsheet->createSheet(); + } + // Default active sheet index to the first loaded worksheet from the file + $this->spreadsheet->setActiveSheetIndex(0); + + $workbookView = $xmlWorkbook->children($mainNS)->bookViews->workbookView; + if (($readDataOnly !== true || !empty($this->loadSheetsOnly)) && !empty($workbookView)) { + $workbookViewAttributes = self::testSimpleXml(self::getAttributes($workbookView)); + // active sheet index + $activeTab = (int) $workbookViewAttributes->activeTab; // refers to old sheet index + // keep active sheet index if sheet is still loaded, else first sheet is set as the active worksheet + if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) { + $this->spreadsheet->setActiveSheetIndex($mapSheetId[$activeTab]); + } + + $this->horizontalScroll($workbookViewAttributes); + $this->verticalScroll($workbookViewAttributes); + $this->sheetTabs($workbookViewAttributes); + $this->minimized($workbookViewAttributes); + $this->autoFilterDateGrouping($workbookViewAttributes); + $this->firstSheet($workbookViewAttributes); + $this->visibility($workbookViewAttributes); + $this->tabRatio($workbookViewAttributes); + } + } + + /** + * @param mixed $value + */ + public static function testSimpleXml($value): SimpleXMLElement + { + return ($value instanceof SimpleXMLElement) + ? $value + : new SimpleXMLElement(''); + } + + public static function getAttributes(?SimpleXMLElement $value, string $ns = ''): SimpleXMLElement + { + return self::testSimpleXml($value === null ? $value : $value->attributes($ns)); + } + + /** + * Convert an 'xsd:boolean' XML value to a PHP boolean value. + * A valid 'xsd:boolean' XML value can be one of the following + * four values: 'true', 'false', '1', '0'. It is case sensitive. + * + * Note that just doing '(bool) $xsdBoolean' is not safe, + * since '(bool) "false"' returns true. + * + * @see https://www.w3.org/TR/xmlschema11-2/#boolean + * + * @param string $xsdBoolean An XML string value of type 'xsd:boolean' + * + * @return bool Boolean value + */ + private function castXsdBooleanToBool(string $xsdBoolean): bool + { + if ($xsdBoolean === 'false') { + return false; + } + + return (bool) $xsdBoolean; + } + + private function horizontalScroll(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->showHorizontalScroll)) { + $showHorizontalScroll = (string) $workbookViewAttributes->showHorizontalScroll; + $this->spreadsheet->setShowHorizontalScroll($this->castXsdBooleanToBool($showHorizontalScroll)); + } + } + + private function verticalScroll(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->showVerticalScroll)) { + $showVerticalScroll = (string) $workbookViewAttributes->showVerticalScroll; + $this->spreadsheet->setShowVerticalScroll($this->castXsdBooleanToBool($showVerticalScroll)); + } + } + + private function sheetTabs(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->showSheetTabs)) { + $showSheetTabs = (string) $workbookViewAttributes->showSheetTabs; + $this->spreadsheet->setShowSheetTabs($this->castXsdBooleanToBool($showSheetTabs)); + } + } + + private function minimized(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->minimized)) { + $minimized = (string) $workbookViewAttributes->minimized; + $this->spreadsheet->setMinimized($this->castXsdBooleanToBool($minimized)); + } + } + + private function autoFilterDateGrouping(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->autoFilterDateGrouping)) { + $autoFilterDateGrouping = (string) $workbookViewAttributes->autoFilterDateGrouping; + $this->spreadsheet->setAutoFilterDateGrouping($this->castXsdBooleanToBool($autoFilterDateGrouping)); + } + } + + private function firstSheet(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->firstSheet)) { + $firstSheet = (string) $workbookViewAttributes->firstSheet; + $this->spreadsheet->setFirstSheetIndex((int) $firstSheet); + } + } + + private function visibility(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->visibility)) { + $visibility = (string) $workbookViewAttributes->visibility; + $this->spreadsheet->setVisibility($visibility); + } + } + + private function tabRatio(SimpleXMLElement $workbookViewAttributes): void + { + if (isset($workbookViewAttributes->tabRatio)) { + $tabRatio = (string) $workbookViewAttributes->tabRatio; + $this->spreadsheet->setTabRatio((int) $tabRatio); + } + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php index 8552509..bac4096 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php @@ -231,13 +231,9 @@ public function listWorksheetInfo($filename) /** * Loads Spreadsheet from file. - * - * @return Spreadsheet */ - public function load(string $filename, int $flags = 0) + protected function loadSpreadsheetFromFile(string $filename): Spreadsheet { - $this->processFlags($flags); - // Create new Spreadsheet $spreadsheet = new Spreadsheet(); $spreadsheet->removeSheetByIndex(0); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php index ba4eefb..4a6ee03 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php @@ -5,6 +5,9 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\DataType; +use PhpOffice\PhpSpreadsheet\Style\Conditional; +use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter; +use PhpOffice\PhpSpreadsheet\Worksheet\Table; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class ReferenceHelper @@ -19,10 +22,15 @@ class ReferenceHelper /** * Instance of this class. * - * @var ReferenceHelper + * @var ?ReferenceHelper */ private static $instance; + /** + * @var CellReferenceHelper + */ + private $cellReferenceHelper; + /** * Get an instance of this class. * @@ -30,7 +38,7 @@ class ReferenceHelper */ public static function getInstance() { - if (!isset(self::$instance) || (self::$instance === null)) { + if (self::$instance === null) { self::$instance = new self(); } @@ -83,8 +91,8 @@ public static function columnReverseSort($a, $b) */ public static function cellSort($a, $b) { - [$ac, $ar] = sscanf($a, '%[A-Z]%d'); - [$bc, $br] = sscanf($b, '%[A-Z]%d'); + sscanf($a, '%[A-Z]%d', $ac, $ar); + sscanf($b, '%[A-Z]%d', $bc, $br); if ($ar === $br) { return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); @@ -104,8 +112,8 @@ public static function cellSort($a, $b) */ public static function cellReverseSort($a, $b) { - [$ac, $ar] = sscanf($a, '%[A-Z]%d'); - [$bc, $br] = sscanf($b, '%[A-Z]%d'); + sscanf($a, '%[A-Z]%d', $ac, $ar); + sscanf($b, '%[A-Z]%d', $bc, $br); if ($ar === $br) { return -strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); @@ -114,67 +122,32 @@ public static function cellReverseSort($a, $b) return ($ar < $br) ? 1 : -1; } - /** - * Test whether a cell address falls within a defined range of cells. - * - * @param string $cellAddress Address of the cell we're testing - * @param int $beforeRow Number of the row we're inserting/deleting before - * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) - * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before - * @param int $numberOfCols Number of columns to insert/delete (negative values indicate deletion) - * - * @return bool - */ - private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $numberOfRows, $beforeColumnIndex, $numberOfCols) - { - [$cellColumn, $cellRow] = Coordinate::coordinateFromString($cellAddress); - $cellColumnIndex = Coordinate::columnIndexFromString($cellColumn); - // Is cell within the range of rows/columns if we're deleting - if ( - $numberOfRows < 0 && - ($cellRow >= ($beforeRow + $numberOfRows)) && - ($cellRow < $beforeRow) - ) { - return true; - } elseif ( - $numberOfCols < 0 && - ($cellColumnIndex >= ($beforeColumnIndex + $numberOfCols)) && - ($cellColumnIndex < $beforeColumnIndex) - ) { - return true; - } - - return false; - } - /** * Update page breaks when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') - * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) - * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustPageBreaks(Worksheet $worksheet, $beforeCellAddress, $beforeColumnIndex, $numberOfColumns, $beforeRow, $numberOfRows): void + protected function adjustPageBreaks(Worksheet $worksheet, $numberOfColumns, $numberOfRows): void { $aBreaks = $worksheet->getBreaks(); - ($numberOfColumns > 0 || $numberOfRows > 0) ? - uksort($aBreaks, ['self', 'cellReverseSort']) : uksort($aBreaks, ['self', 'cellSort']); + ($numberOfColumns > 0 || $numberOfRows > 0) + ? uksort($aBreaks, [self::class, 'cellReverseSort']) + : uksort($aBreaks, [self::class, 'cellSort']); - foreach ($aBreaks as $key => $value) { - if (self::cellAddressInDeleteRange($key, $beforeRow, $numberOfRows, $beforeColumnIndex, $numberOfColumns)) { + foreach ($aBreaks as $cellAddress => $value) { + if ($this->cellReferenceHelper->cellAddressInDeleteRange($cellAddress) === true) { // If we're deleting, then clear any defined breaks that are within the range // of rows/columns that we're deleting - $worksheet->setBreak($key, Worksheet::BREAK_NONE); + $worksheet->setBreak($cellAddress, Worksheet::BREAK_NONE); } else { // Otherwise update any affected breaks by inserting a new break at the appropriate point // and removing the old affected break - $newReference = $this->updateCellReference($key, $beforeCellAddress, $numberOfColumns, $numberOfRows); - if ($key != $newReference) { + $newReference = $this->updateCellReference($cellAddress); + if ($cellAddress !== $newReference) { $worksheet->setBreak($newReference, $value) - ->setBreak($key, Worksheet::BREAK_NONE); + ->setBreak($cellAddress, Worksheet::BREAK_NONE); } } } @@ -184,22 +157,17 @@ protected function adjustPageBreaks(Worksheet $worksheet, $beforeCellAddress, $b * Update cell comments when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') - * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before - * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) - * @param int $beforeRow Number of the row we're inserting/deleting before - * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustComments($worksheet, $beforeCellAddress, $beforeColumnIndex, $numberOfColumns, $beforeRow, $numberOfRows): void + protected function adjustComments($worksheet): void { $aComments = $worksheet->getComments(); $aNewComments = []; // the new array of all comments - foreach ($aComments as $key => &$value) { + foreach ($aComments as $cellAddress => &$value) { // Any comments inside a deleted range will be ignored - if (!self::cellAddressInDeleteRange($key, $beforeRow, $numberOfRows, $beforeColumnIndex, $numberOfColumns)) { + if ($this->cellReferenceHelper->cellAddressInDeleteRange($cellAddress) === false) { // Otherwise build a new array of comments indexed by the adjusted cell reference - $newReference = $this->updateCellReference($key, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $newReference = $this->updateCellReference($cellAddress); $aNewComments[$newReference] = $value; } } @@ -211,22 +179,63 @@ protected function adjustComments($worksheet, $beforeCellAddress, $beforeColumnI * Update hyperlinks when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustHyperlinks($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows): void + protected function adjustHyperlinks($worksheet, $numberOfColumns, $numberOfRows): void { $aHyperlinkCollection = $worksheet->getHyperlinkCollection(); - ($numberOfColumns > 0 || $numberOfRows > 0) ? - uksort($aHyperlinkCollection, ['self', 'cellReverseSort']) : uksort($aHyperlinkCollection, ['self', 'cellSort']); - - foreach ($aHyperlinkCollection as $key => $value) { - $newReference = $this->updateCellReference($key, $beforeCellAddress, $numberOfColumns, $numberOfRows); - if ($key != $newReference) { + ($numberOfColumns > 0 || $numberOfRows > 0) + ? uksort($aHyperlinkCollection, [self::class, 'cellReverseSort']) + : uksort($aHyperlinkCollection, [self::class, 'cellSort']); + + foreach ($aHyperlinkCollection as $cellAddress => $value) { + $newReference = $this->updateCellReference($cellAddress); + if ($this->cellReferenceHelper->cellAddressInDeleteRange($cellAddress) === true) { + $worksheet->setHyperlink($cellAddress, null); + } elseif ($cellAddress !== $newReference) { $worksheet->setHyperlink($newReference, $value); - $worksheet->setHyperlink($key, null); + $worksheet->setHyperlink($cellAddress, null); + } + } + } + + /** + * Update conditional formatting styles when inserting/deleting rows/columns. + * + * @param Worksheet $worksheet The worksheet that we're editing + * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) + * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustConditionalFormatting($worksheet, $numberOfColumns, $numberOfRows): void + { + $aStyles = $worksheet->getConditionalStylesCollection(); + ($numberOfColumns > 0 || $numberOfRows > 0) + ? uksort($aStyles, [self::class, 'cellReverseSort']) + : uksort($aStyles, [self::class, 'cellSort']); + + foreach ($aStyles as $cellAddress => $cfRules) { + $worksheet->removeConditionalStyles($cellAddress); + $newReference = $this->updateCellReference($cellAddress); + + foreach ($cfRules as &$cfRule) { + /** @var Conditional $cfRule */ + $conditions = $cfRule->getConditions(); + foreach ($conditions as &$condition) { + if (is_string($condition)) { + $condition = $this->updateFormulaReferences( + $condition, + $this->cellReferenceHelper->beforeCellAddress(), + $numberOfColumns, + $numberOfRows, + $worksheet->getTitle(), + true + ); + } + } + $cfRule->setConditions($conditions); } + $worksheet->setConditionalStyles($newReference, $cfRules); } } @@ -234,21 +243,21 @@ protected function adjustHyperlinks($worksheet, $beforeCellAddress, $numberOfCol * Update data validations when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $before Insert/Delete before this cell address (e.g. 'A1') * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustDataValidations(Worksheet $worksheet, $before, $numberOfColumns, $numberOfRows): void + protected function adjustDataValidations(Worksheet $worksheet, $numberOfColumns, $numberOfRows): void { $aDataValidationCollection = $worksheet->getDataValidationCollection(); - ($numberOfColumns > 0 || $numberOfRows > 0) ? - uksort($aDataValidationCollection, ['self', 'cellReverseSort']) : uksort($aDataValidationCollection, ['self', 'cellSort']); + ($numberOfColumns > 0 || $numberOfRows > 0) + ? uksort($aDataValidationCollection, [self::class, 'cellReverseSort']) + : uksort($aDataValidationCollection, [self::class, 'cellSort']); - foreach ($aDataValidationCollection as $key => $value) { - $newReference = $this->updateCellReference($key, $before, $numberOfColumns, $numberOfRows); - if ($key != $newReference) { + foreach ($aDataValidationCollection as $cellAddress => $value) { + $newReference = $this->updateCellReference($cellAddress); + if ($cellAddress !== $newReference) { $worksheet->setDataValidation($newReference, $value); - $worksheet->setDataValidation($key, null); + $worksheet->setDataValidation($cellAddress, null); } } } @@ -257,16 +266,13 @@ protected function adjustDataValidations(Worksheet $worksheet, $before, $numberO * Update merged cells when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') - * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) - * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustMergeCells(Worksheet $worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows): void + protected function adjustMergeCells(Worksheet $worksheet): void { $aMergeCells = $worksheet->getMergeCells(); $aNewMergeCells = []; // the new array of all merge cells - foreach ($aMergeCells as $key => &$value) { - $newReference = $this->updateCellReference($key, $beforeCellAddress, $numberOfColumns, $numberOfRows); + foreach ($aMergeCells as $cellAddress => &$value) { + $newReference = $this->updateCellReference($cellAddress); $aNewMergeCells[$newReference] = $newReference; } $worksheet->setMergeCells($aNewMergeCells); // replace the merge cells array @@ -276,20 +282,20 @@ protected function adjustMergeCells(Worksheet $worksheet, $beforeCellAddress, $n * Update protected cells when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustProtectedCells(Worksheet $worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows): void + protected function adjustProtectedCells(Worksheet $worksheet, $numberOfColumns, $numberOfRows): void { $aProtectedCells = $worksheet->getProtectedCells(); - ($numberOfColumns > 0 || $numberOfRows > 0) ? - uksort($aProtectedCells, ['self', 'cellReverseSort']) : uksort($aProtectedCells, ['self', 'cellSort']); - foreach ($aProtectedCells as $key => $value) { - $newReference = $this->updateCellReference($key, $beforeCellAddress, $numberOfColumns, $numberOfRows); - if ($key != $newReference) { + ($numberOfColumns > 0 || $numberOfRows > 0) + ? uksort($aProtectedCells, [self::class, 'cellReverseSort']) + : uksort($aProtectedCells, [self::class, 'cellSort']); + foreach ($aProtectedCells as $cellAddress => $value) { + $newReference = $this->updateCellReference($cellAddress); + if ($cellAddress !== $newReference) { $worksheet->protectCells($newReference, $value, true); - $worksheet->unprotectCells($key); + $worksheet->unprotectCells($cellAddress); } } } @@ -298,18 +304,15 @@ protected function adjustProtectedCells(Worksheet $worksheet, $beforeCellAddress * Update column dimensions when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') - * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) - * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustColumnDimensions(Worksheet $worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows): void + protected function adjustColumnDimensions(Worksheet $worksheet): void { $aColumnDimensions = array_reverse($worksheet->getColumnDimensions(), true); if (!empty($aColumnDimensions)) { foreach ($aColumnDimensions as $objColumnDimension) { - $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $beforeCellAddress, $numberOfColumns, $numberOfRows); + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1'); [$newReference] = Coordinate::coordinateFromString($newReference); - if ($objColumnDimension->getColumnIndex() != $newReference) { + if ($objColumnDimension->getColumnIndex() !== $newReference) { $objColumnDimension->setColumnIndex($newReference); } } @@ -321,20 +324,19 @@ protected function adjustColumnDimensions(Worksheet $worksheet, $beforeCellAddre * Update row dimensions when inserting/deleting rows/columns. * * @param Worksheet $worksheet The worksheet that we're editing - * @param string $beforeCellAddress Insert/Delete before this cell address (e.g. 'A1') - * @param int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion) * @param int $beforeRow Number of the row we're inserting/deleting before * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) */ - protected function adjustRowDimensions(Worksheet $worksheet, $beforeCellAddress, $numberOfColumns, $beforeRow, $numberOfRows): void + protected function adjustRowDimensions(Worksheet $worksheet, $beforeRow, $numberOfRows): void { $aRowDimensions = array_reverse($worksheet->getRowDimensions(), true); if (!empty($aRowDimensions)) { foreach ($aRowDimensions as $objRowDimension) { - $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $beforeCellAddress, $numberOfColumns, $numberOfRows); + $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex()); [, $newReference] = Coordinate::coordinateFromString($newReference); - if ($objRowDimension->getRowIndex() != $newReference) { - $objRowDimension->setRowIndex($newReference); + $newRoweference = (int) $newReference; + if ($objRowDimension->getRowIndex() !== $newRoweference) { + $objRowDimension->setRowIndex($newRoweference); } } $worksheet->refreshRowDimensions(); @@ -358,11 +360,22 @@ protected function adjustRowDimensions(Worksheet $worksheet, $beforeCellAddress, * @param int $numberOfRows Number of rows to insert/delete (negative values indicate deletion) * @param Worksheet $worksheet The worksheet that we're editing */ - public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfRows, Worksheet $worksheet): void - { + public function insertNewBefore( + string $beforeCellAddress, + int $numberOfColumns, + int $numberOfRows, + Worksheet $worksheet + ): void { $remove = ($numberOfColumns < 0 || $numberOfRows < 0); $allCoordinates = $worksheet->getCoordinates(); + if ( + $this->cellReferenceHelper === null || + $this->cellReferenceHelper->refreshRequired($beforeCellAddress, $numberOfColumns, $numberOfRows) + ) { + $this->cellReferenceHelper = new CellReferenceHelper($beforeCellAddress, $numberOfColumns, $numberOfRows); + } + // Get coordinate of $beforeCellAddress [$beforeColumn, $beforeRow] = Coordinate::indexesFromString($beforeCellAddress); @@ -372,30 +385,32 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR // 1. Clear column strips if we are removing columns if ($numberOfColumns < 0 && $beforeColumn - 2 + $numberOfColumns > 0) { - for ($i = 1; $i <= $highestRow - 1; ++$i) { - for ($j = $beforeColumn - 1 + $numberOfColumns; $j <= $beforeColumn - 2; ++$j) { - $coordinate = Coordinate::stringFromColumnIndex($j + 1) . $i; - $worksheet->removeConditionalStyles($coordinate); - if ($worksheet->cellExists($coordinate)) { - $worksheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); - $worksheet->getCell($coordinate)->setXfIndex(0); - } - } - } + $this->clearColumnStrips($highestRow, $beforeColumn, $numberOfColumns, $worksheet); } // 2. Clear row strips if we are removing rows if ($numberOfRows < 0 && $beforeRow - 1 + $numberOfRows > 0) { - for ($i = $beforeColumn - 1; $i <= Coordinate::columnIndexFromString($highestColumn) - 1; ++$i) { - for ($j = $beforeRow + $numberOfRows; $j <= $beforeRow - 1; ++$j) { - $coordinate = Coordinate::stringFromColumnIndex($i + 1) . $j; - $worksheet->removeConditionalStyles($coordinate); - if ($worksheet->cellExists($coordinate)) { - $worksheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); - $worksheet->getCell($coordinate)->setXfIndex(0); - } - } + $this->clearRowStrips($highestColumn, $beforeColumn, $beforeRow, $numberOfRows, $worksheet); + } + + // Find missing coordinates. This is important when inserting column before the last column + $missingCoordinates = array_filter( + array_map(function ($row) use ($highestColumn) { + return $highestColumn . $row; + }, range(1, $highestRow)), + function ($coordinate) use ($allCoordinates) { + return !in_array($coordinate, $allCoordinates); } + ); + + // Create missing cells with null values + if (!empty($missingCoordinates)) { + foreach ($missingCoordinates as $coordinate) { + $worksheet->createNewCell($coordinate); + } + + // Refresh all coordinates + $allCoordinates = $worksheet->getCoordinates(); } // Loop through cells, bottom-up, and change cell coordinate @@ -420,13 +435,13 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR $worksheet->getCell($newCoordinate)->setXfIndex($cell->getXfIndex()); // Insert this cell at its new location - if ($cell->getDataType() == DataType::TYPE_FORMULA) { + if ($cell->getDataType() === DataType::TYPE_FORMULA) { // Formula should be adjusted $worksheet->getCell($newCoordinate) ->setValue($this->updateFormulaReferences($cell->getValue(), $beforeCellAddress, $numberOfColumns, $numberOfRows, $worksheet->getTitle())); } else { // Formula should not be adjusted - $worksheet->getCell($newCoordinate)->setValue($cell->getValue()); + $worksheet->getCell($newCoordinate)->setValueExplicit($cell->getValue(), $cell->getDataType()); } // Clear the original cell @@ -434,7 +449,7 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR } else { /* We don't need to update styles for rows/columns before our insertion position, but we do still need to adjust any formulae in those cells */ - if ($cell->getDataType() == DataType::TYPE_FORMULA) { + if ($cell->getDataType() === DataType::TYPE_FORMULA) { // Formula should be adjusted $cell->setValue($this->updateFormulaReferences($cell->getValue(), $beforeCellAddress, $numberOfColumns, $numberOfRows, $worksheet->getTitle())); } @@ -446,148 +461,68 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR $highestRow = $worksheet->getHighestRow(); if ($numberOfColumns > 0 && $beforeColumn - 2 > 0) { - for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { - // Style - $coordinate = Coordinate::stringFromColumnIndex($beforeColumn - 1) . $i; - if ($worksheet->cellExists($coordinate)) { - $xfIndex = $worksheet->getCell($coordinate)->getXfIndex(); - $conditionalStyles = $worksheet->conditionalStylesExists($coordinate) ? - $worksheet->getConditionalStyles($coordinate) : false; - for ($j = $beforeColumn; $j <= $beforeColumn - 1 + $numberOfColumns; ++$j) { - $worksheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex); - if ($conditionalStyles) { - $cloned = []; - foreach ($conditionalStyles as $conditionalStyle) { - $cloned[] = clone $conditionalStyle; - } - $worksheet->setConditionalStyles(Coordinate::stringFromColumnIndex($j) . $i, $cloned); - } - } - } - } + $this->duplicateStylesByColumn($worksheet, $beforeColumn, $beforeRow, $highestRow, $numberOfColumns); } if ($numberOfRows > 0 && $beforeRow - 1 > 0) { - for ($i = $beforeColumn; $i <= Coordinate::columnIndexFromString($highestColumn); ++$i) { - // Style - $coordinate = Coordinate::stringFromColumnIndex($i) . ($beforeRow - 1); - if ($worksheet->cellExists($coordinate)) { - $xfIndex = $worksheet->getCell($coordinate)->getXfIndex(); - $conditionalStyles = $worksheet->conditionalStylesExists($coordinate) ? - $worksheet->getConditionalStyles($coordinate) : false; - for ($j = $beforeRow; $j <= $beforeRow - 1 + $numberOfRows; ++$j) { - $worksheet->getCell(Coordinate::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); - if ($conditionalStyles) { - $cloned = []; - foreach ($conditionalStyles as $conditionalStyle) { - $cloned[] = clone $conditionalStyle; - } - $worksheet->setConditionalStyles(Coordinate::stringFromColumnIndex($i) . $j, $cloned); - } - } - } - } + $this->duplicateStylesByRow($worksheet, $beforeColumn, $beforeRow, $highestColumn, $numberOfRows); } // Update worksheet: column dimensions - $this->adjustColumnDimensions($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $this->adjustColumnDimensions($worksheet); // Update worksheet: row dimensions - $this->adjustRowDimensions($worksheet, $beforeCellAddress, $numberOfColumns, $beforeRow, $numberOfRows); + $this->adjustRowDimensions($worksheet, $beforeRow, $numberOfRows); // Update worksheet: page breaks - $this->adjustPageBreaks($worksheet, $beforeCellAddress, $beforeColumn, $numberOfColumns, $beforeRow, $numberOfRows); + $this->adjustPageBreaks($worksheet, $numberOfColumns, $numberOfRows); // Update worksheet: comments - $this->adjustComments($worksheet, $beforeCellAddress, $beforeColumn, $numberOfColumns, $beforeRow, $numberOfRows); + $this->adjustComments($worksheet); // Update worksheet: hyperlinks - $this->adjustHyperlinks($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $this->adjustHyperlinks($worksheet, $numberOfColumns, $numberOfRows); + + // Update worksheet: conditional formatting styles + $this->adjustConditionalFormatting($worksheet, $numberOfColumns, $numberOfRows); // Update worksheet: data validations - $this->adjustDataValidations($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $this->adjustDataValidations($worksheet, $numberOfColumns, $numberOfRows); // Update worksheet: merge cells - $this->adjustMergeCells($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $this->adjustMergeCells($worksheet); // Update worksheet: protected cells - $this->adjustProtectedCells($worksheet, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $this->adjustProtectedCells($worksheet, $numberOfColumns, $numberOfRows); // Update worksheet: autofilter - $autoFilter = $worksheet->getAutoFilter(); - $autoFilterRange = $autoFilter->getRange(); - if (!empty($autoFilterRange)) { - if ($numberOfColumns != 0) { - $autoFilterColumns = $autoFilter->getColumns(); - if (count($autoFilterColumns) > 0) { - $column = ''; - $row = 0; - sscanf($beforeCellAddress, '%[A-Z]%d', $column, $row); - $columnIndex = Coordinate::columnIndexFromString($column); - [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($autoFilterRange); - if ($columnIndex <= $rangeEnd[0]) { - if ($numberOfColumns < 0) { - // If we're actually deleting any columns that fall within the autofilter range, - // then we delete any rules for those columns - $deleteColumn = $columnIndex + $numberOfColumns - 1; - $deleteCount = abs($numberOfColumns); - for ($i = 1; $i <= $deleteCount; ++$i) { - if (isset($autoFilterColumns[Coordinate::stringFromColumnIndex($deleteColumn + 1)])) { - $autoFilter->clearColumn(Coordinate::stringFromColumnIndex($deleteColumn + 1)); - } - ++$deleteColumn; - } - } - $startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0]; + $this->adjustAutoFilter($worksheet, $beforeCellAddress, $numberOfColumns); - // Shuffle columns in autofilter range - if ($numberOfColumns > 0) { - $startColRef = $startCol; - $endColRef = $rangeEnd[0]; - $toColRef = $rangeEnd[0] + $numberOfColumns; - - do { - $autoFilter->shiftColumn(Coordinate::stringFromColumnIndex($endColRef), Coordinate::stringFromColumnIndex($toColRef)); - --$endColRef; - --$toColRef; - } while ($startColRef <= $endColRef); - } else { - // For delete, we shuffle from beginning to end to avoid overwriting - $startColID = Coordinate::stringFromColumnIndex($startCol); - $toColID = Coordinate::stringFromColumnIndex($startCol + $numberOfColumns); - $endColID = Coordinate::stringFromColumnIndex($rangeEnd[0] + 1); - do { - $autoFilter->shiftColumn($startColID, $toColID); - ++$startColID; - ++$toColID; - } while ($startColID != $endColID); - } - } - } - } - $worksheet->setAutoFilter($this->updateCellReference($autoFilterRange, $beforeCellAddress, $numberOfColumns, $numberOfRows)); - } + // Update worksheet: table + $this->adjustTable($worksheet, $beforeCellAddress, $numberOfColumns); // Update worksheet: freeze pane if ($worksheet->getFreezePane()) { $splitCell = $worksheet->getFreezePane() ?? ''; $topLeftCell = $worksheet->getTopLeftCell() ?? ''; - $splitCell = $this->updateCellReference($splitCell, $beforeCellAddress, $numberOfColumns, $numberOfRows); - $topLeftCell = $this->updateCellReference($topLeftCell, $beforeCellAddress, $numberOfColumns, $numberOfRows); + $splitCell = $this->updateCellReference($splitCell); + $topLeftCell = $this->updateCellReference($topLeftCell); $worksheet->freezePane($splitCell, $topLeftCell); } // Page setup if ($worksheet->getPageSetup()->isPrintAreaSet()) { - $worksheet->getPageSetup()->setPrintArea($this->updateCellReference($worksheet->getPageSetup()->getPrintArea(), $beforeCellAddress, $numberOfColumns, $numberOfRows)); + $worksheet->getPageSetup()->setPrintArea( + $this->updateCellReference($worksheet->getPageSetup()->getPrintArea()) + ); } // Update worksheet: drawings $aDrawings = $worksheet->getDrawingCollection(); foreach ($aDrawings as $objDrawing) { - $newReference = $this->updateCellReference($objDrawing->getCoordinates(), $beforeCellAddress, $numberOfColumns, $numberOfRows); + $newReference = $this->updateCellReference($objDrawing->getCoordinates()); if ($objDrawing->getCoordinates() != $newReference) { $objDrawing->setCoordinates($newReference); } @@ -597,7 +532,7 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR if (count($worksheet->getParent()->getDefinedNames()) > 0) { foreach ($worksheet->getParent()->getDefinedNames() as $definedName) { if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $worksheet->getHashCode()) { - $definedName->setValue($this->updateCellReference($definedName->getValue(), $beforeCellAddress, $numberOfColumns, $numberOfRows)); + $definedName->setValue($this->updateCellReference($definedName->getValue())); } } } @@ -617,8 +552,21 @@ public function insertNewBefore($beforeCellAddress, $numberOfColumns, $numberOfR * * @return string Updated formula */ - public function updateFormulaReferences($formula = '', $beforeCellAddress = 'A1', $numberOfColumns = 0, $numberOfRows = 0, $worksheetName = '') - { + public function updateFormulaReferences( + $formula = '', + $beforeCellAddress = 'A1', + $numberOfColumns = 0, + $numberOfRows = 0, + $worksheetName = '', + bool $includeAbsoluteReferences = false + ) { + if ( + $this->cellReferenceHelper === null || + $this->cellReferenceHelper->refreshRequired($beforeCellAddress, $numberOfColumns, $numberOfRows) + ) { + $this->cellReferenceHelper = new CellReferenceHelper($beforeCellAddress, $numberOfColumns, $numberOfRows); + } + // Update cell references in the formula $formulaBlocks = explode('"', $formula); $i = false; @@ -628,13 +576,13 @@ public function updateFormulaReferences($formula = '', $beforeCellAddress = 'A1' $adjustCount = 0; $newCellTokens = $cellTokens = []; // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/mui', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); if ($matchCount > 0) { foreach ($matches as $match) { $fromString = ($match[2] > '') ? $match[2] . '!' : ''; $fromString .= $match[3] . ':' . $match[4]; - $modified3 = substr($this->updateCellReference('$A' . $match[3], $beforeCellAddress, $numberOfColumns, $numberOfRows), 2); - $modified4 = substr($this->updateCellReference('$A' . $match[4], $beforeCellAddress, $numberOfColumns, $numberOfRows), 2); + $modified3 = substr($this->updateCellReference('$A' . $match[3], $includeAbsoluteReferences), 2); + $modified4 = substr($this->updateCellReference('$A' . $match[4], $includeAbsoluteReferences), 2); if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { if (($match[2] == '') || (trim($match[2], "'") == $worksheetName)) { @@ -653,13 +601,13 @@ public function updateFormulaReferences($formula = '', $beforeCellAddress = 'A1' } } // Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E) - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/mui', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); if ($matchCount > 0) { foreach ($matches as $match) { $fromString = ($match[2] > '') ? $match[2] . '!' : ''; $fromString .= $match[3] . ':' . $match[4]; - $modified3 = substr($this->updateCellReference($match[3] . '$1', $beforeCellAddress, $numberOfColumns, $numberOfRows), 0, -2); - $modified4 = substr($this->updateCellReference($match[4] . '$1', $beforeCellAddress, $numberOfColumns, $numberOfRows), 0, -2); + $modified3 = substr($this->updateCellReference($match[3] . '$1', $includeAbsoluteReferences), 0, -2); + $modified4 = substr($this->updateCellReference($match[4] . '$1', $includeAbsoluteReferences), 0, -2); if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { if (($match[2] == '') || (trim($match[2], "'") == $worksheetName)) { @@ -678,13 +626,13 @@ public function updateFormulaReferences($formula = '', $beforeCellAddress = 'A1' } } // Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5) - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/mui', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); if ($matchCount > 0) { foreach ($matches as $match) { $fromString = ($match[2] > '') ? $match[2] . '!' : ''; $fromString .= $match[3] . ':' . $match[4]; - $modified3 = $this->updateCellReference($match[3], $beforeCellAddress, $numberOfColumns, $numberOfRows); - $modified4 = $this->updateCellReference($match[4], $beforeCellAddress, $numberOfColumns, $numberOfRows); + $modified3 = $this->updateCellReference($match[3], $includeAbsoluteReferences); + $modified4 = $this->updateCellReference($match[4], $includeAbsoluteReferences); if ($match[3] . $match[4] !== $modified3 . $modified4) { if (($match[2] == '') || (trim($match[2], "'") == $worksheetName)) { @@ -704,14 +652,14 @@ public function updateFormulaReferences($formula = '', $beforeCellAddress = 'A1' } } // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/mui', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); if ($matchCount > 0) { foreach ($matches as $match) { $fromString = ($match[2] > '') ? $match[2] . '!' : ''; $fromString .= $match[3]; - $modified3 = $this->updateCellReference($match[3], $beforeCellAddress, $numberOfColumns, $numberOfRows); + $modified3 = $this->updateCellReference($match[3], $includeAbsoluteReferences); if ($match[3] !== $modified3) { if (($match[2] == '') || (trim($match[2], "'") == $worksheetName)) { $toString = ($match[2] > '') ? $match[2] . '!' : ''; @@ -888,13 +836,10 @@ private function updateRowRangesAllWorksheets(string $formula, int $numberOfRows * Update cell reference. * * @param string $cellReference Cell address or range of addresses - * @param string $beforeCellAddress Insert before this one - * @param int $numberOfColumns Number of columns to increment - * @param int $numberOfRows Number of rows to increment * * @return string Updated cell range */ - public function updateCellReference($cellReference = 'A1', $beforeCellAddress = 'A1', $numberOfColumns = 0, $numberOfRows = 0) + private function updateCellReference($cellReference = 'A1', bool $includeAbsoluteReferences = false) { // Is it in another worksheet? Will not have to update anything. if (strpos($cellReference, '!') !== false) { @@ -902,10 +847,10 @@ public function updateCellReference($cellReference = 'A1', $beforeCellAddress = // Is it a range or a single cell? } elseif (!Coordinate::coordinateIsRange($cellReference)) { // Single cell - return $this->updateSingleCellReference($cellReference, $beforeCellAddress, $numberOfColumns, $numberOfRows); + return $this->cellReferenceHelper->updateCellReference($cellReference, $includeAbsoluteReferences); } elseif (Coordinate::coordinateIsRange($cellReference)) { // Range - return $this->updateCellRange($cellReference, $beforeCellAddress, $numberOfColumns, $numberOfRows); + return $this->updateCellRange($cellReference, $includeAbsoluteReferences); } // Return original @@ -928,7 +873,7 @@ public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $ne foreach ($spreadsheet->getWorksheetIterator() as $sheet) { foreach ($sheet->getCoordinates(false) as $coordinate) { $cell = $sheet->getCell($coordinate); - if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) { + if (($cell !== null) && ($cell->getDataType() === DataType::TYPE_FORMULA)) { $formula = $cell->getValue(); if (strpos($formula, $oldName) !== false) { $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); @@ -944,13 +889,10 @@ public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $ne * Update cell range. * * @param string $cellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3') - * @param string $beforeCellAddress Insert before this one - * @param int $numberOfColumns Number of columns to increment - * @param int $numberOfRows Number of rows to increment * * @return string Updated cell range */ - private function updateCellRange($cellRange = 'A1:A1', $beforeCellAddress = 'A1', $numberOfColumns = 0, $numberOfRows = 0) + private function updateCellRange(string $cellRange = 'A1:A1', bool $includeAbsoluteReferences = false): string { if (!Coordinate::coordinateIsRange($cellRange)) { throw new Exception('Only cell ranges may be passed to this method.'); @@ -963,13 +905,15 @@ private function updateCellRange($cellRange = 'A1:A1', $beforeCellAddress = 'A1' $jc = count($range[$i]); for ($j = 0; $j < $jc; ++$j) { if (ctype_alpha($range[$i][$j])) { - $r = Coordinate::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $beforeCellAddress, $numberOfColumns, $numberOfRows)); - $range[$i][$j] = $r[0]; + $range[$i][$j] = Coordinate::coordinateFromString( + $this->cellReferenceHelper->updateCellReference($range[$i][$j] . '1', $includeAbsoluteReferences) + )[0]; } elseif (ctype_digit($range[$i][$j])) { - $r = Coordinate::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $beforeCellAddress, $numberOfColumns, $numberOfRows)); - $range[$i][$j] = $r[1]; + $range[$i][$j] = Coordinate::coordinateFromString( + $this->cellReferenceHelper->updateCellReference('A' . $range[$i][$j], $includeAbsoluteReferences) + )[1]; } else { - $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $beforeCellAddress, $numberOfColumns, $numberOfRows); + $range[$i][$j] = $this->cellReferenceHelper->updateCellReference($range[$i][$j], $includeAbsoluteReferences); } } } @@ -978,44 +922,221 @@ private function updateCellRange($cellRange = 'A1:A1', $beforeCellAddress = 'A1' return Coordinate::buildRange($range); } - /** - * Update single cell reference. - * - * @param string $cellReference Single cell reference - * @param string $beforeCellAddress Insert before this one - * @param int $numberOfColumns Number of columns to increment - * @param int $numberOfRows Number of rows to increment - * - * @return string Updated cell reference - */ - private function updateSingleCellReference($cellReference = 'A1', $beforeCellAddress = 'A1', $numberOfColumns = 0, $numberOfRows = 0) + private function clearColumnStrips(int $highestRow, int $beforeColumn, int $numberOfColumns, Worksheet $worksheet): void { - if (Coordinate::coordinateIsRange($cellReference)) { - throw new Exception('Only single cell references may be passed to this method.'); + for ($i = 1; $i <= $highestRow - 1; ++$i) { + for ($j = $beforeColumn - 1 + $numberOfColumns; $j <= $beforeColumn - 2; ++$j) { + $coordinate = Coordinate::stringFromColumnIndex($j + 1) . $i; + $worksheet->removeConditionalStyles($coordinate); + if ($worksheet->cellExists($coordinate)) { + $worksheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); + $worksheet->getCell($coordinate)->setXfIndex(0); + } + } } + } - // Get coordinate of $beforeCellAddress - [$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($beforeCellAddress); + private function clearRowStrips(string $highestColumn, int $beforeColumn, int $beforeRow, int $numberOfRows, Worksheet $worksheet): void + { + $lastColumnIndex = Coordinate::columnIndexFromString($highestColumn) - 1; + + for ($i = $beforeColumn - 1; $i <= $lastColumnIndex; ++$i) { + for ($j = $beforeRow + $numberOfRows; $j <= $beforeRow - 1; ++$j) { + $coordinate = Coordinate::stringFromColumnIndex($i + 1) . $j; + $worksheet->removeConditionalStyles($coordinate); + if ($worksheet->cellExists($coordinate)) { + $worksheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); + $worksheet->getCell($coordinate)->setXfIndex(0); + } + } + } + } + + private function adjustAutoFilter(Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns): void + { + $autoFilter = $worksheet->getAutoFilter(); + $autoFilterRange = $autoFilter->getRange(); + if (!empty($autoFilterRange)) { + if ($numberOfColumns !== 0) { + $autoFilterColumns = $autoFilter->getColumns(); + if (count($autoFilterColumns) > 0) { + $column = ''; + $row = 0; + sscanf($beforeCellAddress, '%[A-Z]%d', $column, $row); + $columnIndex = Coordinate::columnIndexFromString($column); + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($autoFilterRange); + if ($columnIndex <= $rangeEnd[0]) { + if ($numberOfColumns < 0) { + $this->adjustAutoFilterDeleteRules($columnIndex, $numberOfColumns, $autoFilterColumns, $autoFilter); + } + $startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0]; + + // Shuffle columns in autofilter range + if ($numberOfColumns > 0) { + $this->adjustAutoFilterInsert($startCol, $numberOfColumns, $rangeEnd[0], $autoFilter); + } else { + $this->adjustAutoFilterDelete($startCol, $numberOfColumns, $rangeEnd[0], $autoFilter); + } + } + } + } - // Get coordinate of $cellReference - [$newColumn, $newRow] = Coordinate::coordinateFromString($cellReference); + $worksheet->setAutoFilter( + $this->updateCellReference($autoFilterRange) + ); + } + } - // Verify which parts should be updated - $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Coordinate::columnIndexFromString($newColumn) >= Coordinate::columnIndexFromString($beforeColumn))); - $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow); + private function adjustAutoFilterDeleteRules(int $columnIndex, int $numberOfColumns, array $autoFilterColumns, AutoFilter $autoFilter): void + { + // If we're actually deleting any columns that fall within the autofilter range, + // then we delete any rules for those columns + $deleteColumn = $columnIndex + $numberOfColumns - 1; + $deleteCount = abs($numberOfColumns); + + for ($i = 1; $i <= $deleteCount; ++$i) { + $columnName = Coordinate::stringFromColumnIndex($deleteColumn + 1); + if (isset($autoFilterColumns[$columnName])) { + $autoFilter->clearColumn($columnName); + } + ++$deleteColumn; + } + } - // Create new column reference - if ($updateColumn) { - $newColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($newColumn) + $numberOfColumns); + private function adjustAutoFilterInsert(int $startCol, int $numberOfColumns, int $rangeEnd, AutoFilter $autoFilter): void + { + $startColRef = $startCol; + $endColRef = $rangeEnd; + $toColRef = $rangeEnd + $numberOfColumns; + + do { + $autoFilter->shiftColumn(Coordinate::stringFromColumnIndex($endColRef), Coordinate::stringFromColumnIndex($toColRef)); + --$endColRef; + --$toColRef; + } while ($startColRef <= $endColRef); + } + + private function adjustAutoFilterDelete(int $startCol, int $numberOfColumns, int $rangeEnd, AutoFilter $autoFilter): void + { + // For delete, we shuffle from beginning to end to avoid overwriting + $startColID = Coordinate::stringFromColumnIndex($startCol); + $toColID = Coordinate::stringFromColumnIndex($startCol + $numberOfColumns); + $endColID = Coordinate::stringFromColumnIndex($rangeEnd + 1); + + do { + $autoFilter->shiftColumn($startColID, $toColID); + ++$startColID; + ++$toColID; + } while ($startColID !== $endColID); + } + + private function adjustTable(Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns): void + { + $tableCollection = $worksheet->getTableCollection(); + + foreach ($tableCollection as $table) { + $tableRange = $table->getRange(); + if (!empty($tableRange)) { + if ($numberOfColumns !== 0) { + $tableColumns = $table->getColumns(); + if (count($tableColumns) > 0) { + $column = ''; + $row = 0; + sscanf($beforeCellAddress, '%[A-Z]%d', $column, $row); + $columnIndex = Coordinate::columnIndexFromString($column); + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($tableRange); + if ($columnIndex <= $rangeEnd[0]) { + if ($numberOfColumns < 0) { + $this->adjustTableDeleteRules($columnIndex, $numberOfColumns, $tableColumns, $table); + } + $startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0]; + + // Shuffle columns in table range + if ($numberOfColumns > 0) { + $this->adjustTableInsert($startCol, $numberOfColumns, $rangeEnd[0], $table); + } else { + $this->adjustTableDelete($startCol, $numberOfColumns, $rangeEnd[0], $table); + } + } + } + } + + $table->setRange($this->updateCellReference($tableRange)); + } } + } + + private function adjustTableDeleteRules(int $columnIndex, int $numberOfColumns, array $tableColumns, Table $table): void + { + // If we're actually deleting any columns that fall within the table range, + // then we delete any rules for those columns + $deleteColumn = $columnIndex + $numberOfColumns - 1; + $deleteCount = abs($numberOfColumns); + + for ($i = 1; $i <= $deleteCount; ++$i) { + $columnName = Coordinate::stringFromColumnIndex($deleteColumn + 1); + if (isset($tableColumns[$columnName])) { + $table->clearColumn($columnName); + } + ++$deleteColumn; + } + } + + private function adjustTableInsert(int $startCol, int $numberOfColumns, int $rangeEnd, Table $table): void + { + $startColRef = $startCol; + $endColRef = $rangeEnd; + $toColRef = $rangeEnd + $numberOfColumns; + + do { + $table->shiftColumn(Coordinate::stringFromColumnIndex($endColRef), Coordinate::stringFromColumnIndex($toColRef)); + --$endColRef; + --$toColRef; + } while ($startColRef <= $endColRef); + } - // Create new row reference - if ($updateRow) { - $newRow = (int) $newRow + $numberOfRows; + private function adjustTableDelete(int $startCol, int $numberOfColumns, int $rangeEnd, Table $table): void + { + // For delete, we shuffle from beginning to end to avoid overwriting + $startColID = Coordinate::stringFromColumnIndex($startCol); + $toColID = Coordinate::stringFromColumnIndex($startCol + $numberOfColumns); + $endColID = Coordinate::stringFromColumnIndex($rangeEnd + 1); + + do { + $table->shiftColumn($startColID, $toColID); + ++$startColID; + ++$toColID; + } while ($startColID !== $endColID); + } + + private function duplicateStylesByColumn(Worksheet $worksheet, int $beforeColumn, int $beforeRow, int $highestRow, int $numberOfColumns): void + { + $beforeColumnName = Coordinate::stringFromColumnIndex($beforeColumn - 1); + for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { + // Style + $coordinate = $beforeColumnName . $i; + if ($worksheet->cellExists($coordinate)) { + $xfIndex = $worksheet->getCell($coordinate)->getXfIndex(); + for ($j = $beforeColumn; $j <= $beforeColumn - 1 + $numberOfColumns; ++$j) { + $worksheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex); + } + } } + } - // Return new reference - return $newColumn . $newRow; + private function duplicateStylesByRow(Worksheet $worksheet, int $beforeColumn, int $beforeRow, string $highestColumn, int $numberOfRows): void + { + $highestColumnIndex = Coordinate::columnIndexFromString($highestColumn); + for ($i = $beforeColumn; $i <= $highestColumnIndex; ++$i) { + // Style + $coordinate = Coordinate::stringFromColumnIndex($i) . ($beforeRow - 1); + if ($worksheet->cellExists($coordinate)) { + $xfIndex = $worksheet->getCell($coordinate)->getXfIndex(); + for ($j = $beforeRow; $j <= $beforeRow - 1 + $numberOfRows; ++$j) { + $worksheet->getCell(Coordinate::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); + } + } + } } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php index 5b0a290..8727807 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php @@ -7,8 +7,11 @@ use DateTimeZone; use PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel; use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; +use PhpOffice\PhpSpreadsheet\Shared\Date as SharedDate; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; class Date @@ -157,6 +160,36 @@ private static function validateTimeZone($timeZone) throw new PhpSpreadsheetException('Invalid timezone'); } + /** + * @param mixed $value + * + * @return float|int + */ + public static function convertIsoDate($value) + { + if (!is_string($value)) { + throw new Exception('Non-string value supplied for Iso Date conversion'); + } + + $date = new DateTime($value); + $dateErrors = DateTime::getLastErrors(); + + if (is_array($dateErrors) && ($dateErrors['warning_count'] > 0 || $dateErrors['error_count'] > 0)) { + throw new Exception("Invalid string $value supplied for datatype Date"); + } + + $newValue = SharedDate::PHPToExcel($date); + if ($newValue === false) { + throw new Exception("Invalid string $value supplied for datatype Date"); + } + + if (preg_match('/^\\d\\d:\\d\\d:\\d\\d/', $value) == 1) { + $newValue = fmod($newValue, 1.0); + } + + return $newValue; + } + /** * Convert a MS serialized datetime value from Excel to a PHP Date/Time object. * @@ -228,7 +261,7 @@ public static function excelToTimestamp($excelTimestamp, $timeZone = null) * @param mixed $dateValue PHP DateTime object or a string - Unix timestamp is also permitted, but discouraged; * not Y2038-safe on a 32-bit system, and no timezone info * - * @return bool|float Excel date/time value + * @return false|float Excel date/time value * or boolean FALSE on failure */ public static function PHPToExcel($dateValue) @@ -454,13 +487,13 @@ public static function stringToExcel($dateValue) $dateValueNew = DateTimeExcel\DateValue::fromString($dateValue); - if ($dateValueNew === Functions::VALUE()) { + if ($dateValueNew === ExcelError::VALUE()) { return false; } if (strpos($dateValue, ':') !== false) { $timeValue = DateTimeExcel\TimeValue::fromString($dateValue); - if ($timeValue === Functions::VALUE()) { + if ($timeValue === ExcelError::VALUE()) { return false; } $dateValueNew += $timeValue; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php index 0d8ad61..3378958 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php @@ -164,11 +164,15 @@ public static function imagecreatefrombmp($bmpFilename) { // Load the image into a string $file = fopen($bmpFilename, 'rb'); + /** @phpstan-ignore-next-line */ $read = fread($file, 10); + // @phpstan-ignore-next-line while (!feof($file) && ($read != '')) { + // @phpstan-ignore-next-line $read .= fread($file, 1024); } + /** @phpstan-ignore-next-line */ $temp = unpack('H*', $read); $hex = $temp[1]; $header = substr($hex, 0, 108); @@ -196,6 +200,8 @@ public static function imagecreatefrombmp($bmpFilename) $y = 1; // Create newimage + + /** @phpstan-ignore-next-line */ $image = imagecreatetruecolor($width, $height); // Grab the body from the image @@ -241,7 +247,10 @@ public static function imagecreatefrombmp($bmpFilename) $b = hexdec($body[$i_pos] . $body[$i_pos + 1]); // Calculate and draw the pixel + + /** @phpstan-ignore-next-line */ $color = imagecolorallocate($image, $r, $g, $b); + // @phpstan-ignore-next-line imagesetpixel($image, $x, $height - $y, $color); // Raise the horizontal position @@ -252,6 +261,7 @@ public static function imagecreatefrombmp($bmpFilename) unset($body); // Return image-object + // @phpstan-ignore-next-line return $image; } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php index 293b15c..f2fe8ca 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php @@ -56,8 +56,8 @@ public static function fileExists(string $filename): bool // doing the original file_exists on ZIP archives... if (strtolower(substr($filename, 0, 6)) == 'zip://') { // Open ZIP file and verify if the file exists - $zipFile = substr($filename, 6, strpos($filename, '#') - 6); - $archiveFile = substr($filename, strpos($filename, '#') + 1); + $zipFile = substr($filename, 6, strrpos($filename, '#') - 6); + $archiveFile = substr($filename, strrpos($filename, '#') + 1); if (self::validateZipFirst4($zipFile)) { $zip = new ZipArchive(); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php index 9a74bef..3ee3d5a 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php @@ -222,11 +222,15 @@ public static function getTrueTypeFontPath() * @param RichText|string $cellText Text to calculate width * @param int $rotation Rotation angle * @param null|FontStyle $defaultFont Font object - * - * @return int Column width + * @param bool $filterAdjustment Add space for Autofilter or Table dropdown */ - public static function calculateColumnWidth(FontStyle $font, $cellText = '', $rotation = 0, ?FontStyle $defaultFont = null) - { + public static function calculateColumnWidth( + FontStyle $font, + $cellText = '', + $rotation = 0, + ?FontStyle $defaultFont = null, + bool $filterAdjustment = false + ): int { // If it is rich text, use plain text if ($cellText instanceof RichText) { $cellText = $cellText->getPlainText(); @@ -237,7 +241,7 @@ public static function calculateColumnWidth(FontStyle $font, $cellText = '', $ro $lineTexts = explode("\n", $cellText); $lineWidths = []; foreach ($lineTexts as $lineText) { - $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont); + $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont, $filterAdjustment); } return max($lineWidths); // width of longest line in cell @@ -247,7 +251,13 @@ public static function calculateColumnWidth(FontStyle $font, $cellText = '', $ro $approximate = self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX; $columnWidth = 0; if (!$approximate) { - $columnWidthAdjust = ceil(self::getTextWidthPixelsExact('n', $font, 0) * 1.07); + $columnWidthAdjust = ceil( + self::getTextWidthPixelsExact( + str_repeat('n', 1 * ($filterAdjustment ? 3 : 1)), + $font, + 0 + ) * 1.07 + ); try { // Width of text in pixels excl. padding @@ -259,7 +269,11 @@ public static function calculateColumnWidth(FontStyle $font, $cellText = '', $ro } if ($approximate) { - $columnWidthAdjust = self::getTextWidthPixelsApprox('n', $font, 0); + $columnWidthAdjust = self::getTextWidthPixelsApprox( + str_repeat('n', 1 * ($filterAdjustment ? 3 : 1)), + $font, + 0 + ); // Width of text in pixels excl. padding, approximation // and addition because Excel adds some padding, just use approx width of 'n' glyph $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation) + $columnWidthAdjust; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php index 5c6ccfd..66111b6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -415,7 +415,7 @@ private function hqr2(): void $norm = 0.0; for ($i = 0; $i < $nn; ++$i) { - if (($i < $low) || ($i > $high)) { + if ($i > $high) { $this->d[$i] = $this->H[$i][$i]; $this->e[$i] = 0.0; } @@ -762,7 +762,7 @@ private function hqr2(): void // Vectors of isolated roots for ($i = 0; $i < $nn; ++$i) { - if ($i < $low | $i > $high) { + if ($i > $high) { for ($j = $i; $j < $nn; ++$j) { $this->V[$i][$j] = $this->H[$i][$j]; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index adf399a..ab78ef1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -3,7 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Shared\JAMA; use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalculationException; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; use PhpOffice\PhpSpreadsheet\Shared\StringHelper; /** @@ -543,7 +543,7 @@ public function plusEquals(...$args) if ($validValues) { $this->A[$i][$j] += $value; } else { - $this->A[$i][$j] = Functions::NAN(); + $this->A[$i][$j] = ExcelError::NAN(); } } } @@ -643,7 +643,7 @@ public function minusEquals(...$args) if ($validValues) { $this->A[$i][$j] -= $value; } else { - $this->A[$i][$j] = Functions::NAN(); + $this->A[$i][$j] = ExcelError::NAN(); } } } @@ -745,7 +745,7 @@ public function arrayTimesEquals(...$args) if ($validValues) { $this->A[$i][$j] *= $value; } else { - $this->A[$i][$j] = Functions::NAN(); + $this->A[$i][$j] = ExcelError::NAN(); } } } @@ -808,7 +808,7 @@ public function arrayRightDivide(...$args) $M->set($i, $j, $this->A[$i][$j] / $value); } } else { - $M->set($i, $j, Functions::NAN()); + $M->set($i, $j, ExcelError::NAN()); } } } @@ -1090,7 +1090,7 @@ public function power(...$args) if ($validValues) { $this->A[$i][$j] = $this->A[$i][$j] ** $value; } else { - $this->A[$i][$j] = Functions::NAN(); + $this->A[$i][$j] = ExcelError::NAN(); } } } @@ -1134,6 +1134,7 @@ public function concat(...$args) $this->checkMatrixDimensions($M); for ($i = 0; $i < $this->m; ++$i) { for ($j = 0; $j < $this->n; ++$j) { + // @phpstan-ignore-next-line $this->A[$i][$j] = trim($this->A[$i][$j], '"') . trim($M->get($i, $j), '"'); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php index ca97573..5c95d79 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php @@ -251,6 +251,7 @@ public function getStream($blockIdOrPps) */ private static function readInt1($fileHandle) { + // @phpstan-ignore-next-line [, $tmp] = unpack('c', fread($fileHandle, 1)); return $tmp; @@ -265,6 +266,7 @@ private static function readInt1($fileHandle) */ private static function readInt2($fileHandle) { + // @phpstan-ignore-next-line [, $tmp] = unpack('v', fread($fileHandle, 2)); return $tmp; @@ -279,6 +281,7 @@ private static function readInt2($fileHandle) */ private static function readInt4($fileHandle) { + // @phpstan-ignore-next-line [, $tmp] = unpack('V', fread($fileHandle, 4)); return $tmp; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php index 43e4804..ac9fcb0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -160,6 +160,7 @@ public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine $this->pos = $offset; } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) { $this->pos += $offset; + // @phpstan-ignore-next-line } elseif ($whence == SEEK_END && -$offset <= count($this->data)) { $this->pos = strlen($this->data) + $offset; } else { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index 7a31d77..fa92fd5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -71,12 +71,12 @@ public function save($fileHandle) $this->fileHandle = $fileHandle; // Initial Setting for saving - $this->bigBlockSize = 2 ** ( + $this->bigBlockSize = (int) (2 ** ( (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9 - ); - $this->smallBlockSize = 2 ** ( + )); + $this->smallBlockSize = (int) (2 ** ( (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6 - ); + )); // Make an array of PPS's (for Save) $aList = []; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php index 435d0e4..9970a21 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php @@ -49,7 +49,7 @@ class StringHelper /** * Is iconv extension avalable? * - * @var bool + * @var ?bool */ private static $isIconvEnabled; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php index 2c8eea5..b10a0a1 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -114,6 +114,7 @@ public function getSlope($dp = 0) public function getCoefficients($dp = 0) { + // @phpstan-ignore-next-line return array_merge([$this->getIntersect($dp)], $this->getSlope($dp)); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php index 61d1183..929f59b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php @@ -72,6 +72,7 @@ public static function calculate($trendType = self::TREND_BEST_FIT, $yValues = [ case self::TREND_POWER: if (!isset(self::$trendCache[$key])) { $className = '\PhpOffice\PhpSpreadsheet\Shared\Trend\\' . $trendType . 'BestFit'; + // @phpstan-ignore-next-line self::$trendCache[$key] = new $className($yValues, $xValues, $const); } @@ -82,7 +83,7 @@ public static function calculate($trendType = self::TREND_BEST_FIT, $yValues = [ case self::TREND_POLYNOMIAL_5: case self::TREND_POLYNOMIAL_6: if (!isset(self::$trendCache[$key])) { - $order = substr($trendType, -1); + $order = (int) substr($trendType, -1); self::$trendCache[$key] = new PolynomialBestFit($order, $yValues, $xValues); } @@ -100,7 +101,7 @@ public static function calculate($trendType = self::TREND_BEST_FIT, $yValues = [ } if ($trendType != self::TREND_BEST_FIT_NO_POLY) { foreach (self::$trendTypePolynomialOrders as $trendMethod) { - $order = substr($trendMethod, -1); + $order = (int) substr($trendMethod, -1); $bestFit[$trendMethod] = new PolynomialBestFit($order, $yValues, $xValues); if ($bestFit[$trendMethod]->getError()) { unset($bestFit[$trendMethod]); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php index 84ad8a8..3dc0aad 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php @@ -54,7 +54,9 @@ public function __construct($temporaryStorage = self::STORAGE_MEMORY, $temporary public function __destruct() { // Unlink temporary files + // There is nothing reasonable to do if unlink fails. if ($this->tempFileName != '') { + /** @scrutinizer ignore-unhandled */ @unlink($this->tempFileName); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php index 9990a68..33b4fe0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php @@ -313,7 +313,7 @@ public function getRibbonXMLData($what = 'all') //we need some constants here... break; case 'target': case 'data': - if (is_array($this->ribbonXMLData) && isset($this->ribbonXMLData[$what])) { + if (is_array($this->ribbonXMLData)) { $returnData = $this->ribbonXMLData[$what]; } @@ -608,7 +608,7 @@ public function sheetNameExists($worksheetName) /** * Add sheet. * - * @param Worksheet $worksheet The worskeet to add + * @param Worksheet $worksheet The worksheet to add * @param null|int $sheetIndex Index where sheet should go (0,1,..., or null for last) * * @return Worksheet @@ -869,6 +869,19 @@ public function addExternalSheet(Worksheet $worksheet, $sheetIndex = null) $cell->setXfIndex($cell->getXfIndex() + $countCellXfs); } + // update the column dimensions Xfs + foreach ($worksheet->getColumnDimensions() as $columnDimension) { + $columnDimension->setXfIndex($columnDimension->getXfIndex() + $countCellXfs); + } + + // update the row dimensions Xfs + foreach ($worksheet->getRowDimensions() as $rowDimension) { + $xfIndex = $rowDimension->getXfIndex(); + if ($xfIndex !== null) { + $rowDimension->setXfIndex($xfIndex + $countCellXfs); + } + } + return $this->addSheet($worksheet, $sheetIndex); } @@ -1589,4 +1602,27 @@ public function setTabRatio($tabRatio): void throw new Exception('Tab ratio must be between 0 and 1000.'); } } + + public function reevaluateAutoFilters(bool $resetToMax): void + { + foreach ($this->workSheetCollection as $sheet) { + $filter = $sheet->getAutoFilter(); + if (!empty($filter->getRange())) { + if ($resetToMax) { + $filter->setRangeToMaxRow(); + } + $filter->showHideRows(); + } + } + } + + /** + * Silliness to mollify Scrutinizer. + * + * @codeCoverageIgnore + */ + public function getSharedComponent(): Style + { + return new Style(); + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php index 1b3ed6a..83ac5b0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php @@ -111,7 +111,10 @@ public function __construct($isSupervisor = false, $isConditional = false) */ public function getSharedComponent() { - return $this->parent->getSharedComponent()->getAlignment(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getAlignment(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php index 9fabf36..a5ec980 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php @@ -70,8 +70,11 @@ public function __construct($isSupervisor = false) */ public function getSharedComponent() { + /** @var Style */ + $parent = $this->parent; + /** @var Borders $sharedComponent */ - $sharedComponent = $this->parent->getSharedComponent(); + $sharedComponent = $parent->getSharedComponent(); switch ($this->parentPropertyName) { case 'bottom': return $sharedComponent->getBottom(); @@ -97,7 +100,10 @@ public function getSharedComponent() */ public function getStyleArray($array) { - return $this->parent->getStyleArray([$this->parentPropertyName => $array]); + /** @var Style */ + $parent = $this->parent; + + return $parent->getStyleArray([$this->parentPropertyName => $array]); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php index 5d92f93..56a5270 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php @@ -140,7 +140,10 @@ public function __construct($isSupervisor = false) */ public function getSharedComponent() { - return $this->parent->getSharedComponent()->getBorders(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getBorders(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php index d9b9830..9ab0c98 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php @@ -26,17 +26,83 @@ class Color extends Supervisor const COLOR_DARKGREEN = 'FF008000'; const COLOR_YELLOW = 'FFFFFF00'; const COLOR_DARKYELLOW = 'FF808000'; + const COLOR_MAGENTA = 'FFFF00FF'; + const COLOR_CYAN = 'FF00FFFF'; + + const NAMED_COLOR_TRANSLATIONS = [ + 'Black' => self::COLOR_BLACK, + 'White' => self::COLOR_WHITE, + 'Red' => self::COLOR_RED, + 'Green' => self::COLOR_GREEN, + 'Blue' => self::COLOR_BLUE, + 'Yellow' => self::COLOR_YELLOW, + 'Magenta' => self::COLOR_MAGENTA, + 'Cyan' => self::COLOR_CYAN, + ]; const VALIDATE_ARGB_SIZE = 8; const VALIDATE_RGB_SIZE = 6; - const VALIDATE_COLOR_VALUE = '/^[A-F0-9]{%d}$/i'; - - /** - * Indexed colors array. - * - * @var array - */ - protected static $indexedColors; + const VALIDATE_COLOR_6 = '/^[A-F0-9]{6}$/i'; + const VALIDATE_COLOR_8 = '/^[A-F0-9]{8}$/i'; + + private const INDEXED_COLORS = [ + 1 => 'FF000000', // System Colour #1 - Black + 2 => 'FFFFFFFF', // System Colour #2 - White + 3 => 'FFFF0000', // System Colour #3 - Red + 4 => 'FF00FF00', // System Colour #4 - Green + 5 => 'FF0000FF', // System Colour #5 - Blue + 6 => 'FFFFFF00', // System Colour #6 - Yellow + 7 => 'FFFF00FF', // System Colour #7- Magenta + 8 => 'FF00FFFF', // System Colour #8- Cyan + 9 => 'FF800000', // Standard Colour #9 + 10 => 'FF008000', // Standard Colour #10 + 11 => 'FF000080', // Standard Colour #11 + 12 => 'FF808000', // Standard Colour #12 + 13 => 'FF800080', // Standard Colour #13 + 14 => 'FF008080', // Standard Colour #14 + 15 => 'FFC0C0C0', // Standard Colour #15 + 16 => 'FF808080', // Standard Colour #16 + 17 => 'FF9999FF', // Chart Fill Colour #17 + 18 => 'FF993366', // Chart Fill Colour #18 + 19 => 'FFFFFFCC', // Chart Fill Colour #19 + 20 => 'FFCCFFFF', // Chart Fill Colour #20 + 21 => 'FF660066', // Chart Fill Colour #21 + 22 => 'FFFF8080', // Chart Fill Colour #22 + 23 => 'FF0066CC', // Chart Fill Colour #23 + 24 => 'FFCCCCFF', // Chart Fill Colour #24 + 25 => 'FF000080', // Chart Line Colour #25 + 26 => 'FFFF00FF', // Chart Line Colour #26 + 27 => 'FFFFFF00', // Chart Line Colour #27 + 28 => 'FF00FFFF', // Chart Line Colour #28 + 29 => 'FF800080', // Chart Line Colour #29 + 30 => 'FF800000', // Chart Line Colour #30 + 31 => 'FF008080', // Chart Line Colour #31 + 32 => 'FF0000FF', // Chart Line Colour #32 + 33 => 'FF00CCFF', // Standard Colour #33 + 34 => 'FFCCFFFF', // Standard Colour #34 + 35 => 'FFCCFFCC', // Standard Colour #35 + 36 => 'FFFFFF99', // Standard Colour #36 + 37 => 'FF99CCFF', // Standard Colour #37 + 38 => 'FFFF99CC', // Standard Colour #38 + 39 => 'FFCC99FF', // Standard Colour #39 + 40 => 'FFFFCC99', // Standard Colour #40 + 41 => 'FF3366FF', // Standard Colour #41 + 42 => 'FF33CCCC', // Standard Colour #42 + 43 => 'FF99CC00', // Standard Colour #43 + 44 => 'FFFFCC00', // Standard Colour #44 + 45 => 'FFFF9900', // Standard Colour #45 + 46 => 'FFFF6600', // Standard Colour #46 + 47 => 'FF666699', // Standard Colour #47 + 48 => 'FF969696', // Standard Colour #48 + 49 => 'FF003366', // Standard Colour #49 + 50 => 'FF339966', // Standard Colour #50 + 51 => 'FF003300', // Standard Colour #51 + 52 => 'FF333300', // Standard Colour #52 + 53 => 'FF993300', // Standard Colour #53 + 54 => 'FF993366', // Standard Colour #54 + 55 => 'FF333399', // Standard Colour #55 + 56 => 'FF333333', // Standard Colour #56 + ]; /** * ARGB - Alpha RGB. @@ -45,6 +111,9 @@ class Color extends Supervisor */ protected $argb; + /** @var bool */ + private $hasChanged = false; + /** * Create a new Color. * @@ -63,7 +132,7 @@ public function __construct($colorValue = self::COLOR_BLACK, $isSupervisor = fal // Initialise values if (!$isConditional) { - $this->argb = $this->validateColor($colorValue, self::VALIDATE_ARGB_SIZE) ? $colorValue : self::COLOR_BLACK; + $this->argb = $this->validateColor($colorValue) ?: self::COLOR_BLACK; } } @@ -75,12 +144,15 @@ public function __construct($colorValue = self::COLOR_BLACK, $isSupervisor = fal */ public function getSharedComponent() { + /** @var Style */ + $parent = $this->parent; /** @var Border|Fill $sharedComponent */ - $sharedComponent = $this->parent->getSharedComponent(); - if ($this->parentPropertyName === 'endColor') { - return $sharedComponent->getEndColor(); - } - if ($this->parentPropertyName === 'startColor') { + $sharedComponent = $parent->getSharedComponent(); + if ($sharedComponent instanceof Fill) { + if ($this->parentPropertyName === 'endColor') { + return $sharedComponent->getEndColor(); + } + return $sharedComponent->getStartColor(); } @@ -96,7 +168,10 @@ public function getSharedComponent() */ public function getStyleArray($array) { - return $this->parent->getStyleArray([$this->parentPropertyName => $array]); + /** @var Style */ + $parent = $this->parent; + + return $parent->getStyleArray([$this->parentPropertyName => $array]); } /** @@ -126,10 +201,23 @@ public function applyFromArray(array $styleArray) return $this; } - private function validateColor(string $colorValue, int $size): bool + private function validateColor(?string $colorValue): string { - return in_array(ucfirst(strtolower($colorValue)), self::NAMED_COLORS) || - preg_match(sprintf(self::VALIDATE_COLOR_VALUE, $size), $colorValue); + if ($colorValue === null || $colorValue === '') { + return self::COLOR_BLACK; + } + $named = ucfirst(strtolower($colorValue)); + if (array_key_exists($named, self::NAMED_COLOR_TRANSLATIONS)) { + return self::NAMED_COLOR_TRANSLATIONS[$named]; + } + if (preg_match(self::VALIDATE_COLOR_8, $colorValue) === 1) { + return $colorValue; + } + if (preg_match(self::VALIDATE_COLOR_6, $colorValue) === 1) { + return 'FF' . $colorValue; + } + + return ''; } /** @@ -153,9 +241,9 @@ public function getARGB(): ?string */ public function setARGB(?string $colorValue = self::COLOR_BLACK) { - if ($colorValue === '' || $colorValue === null) { - $colorValue = self::COLOR_BLACK; - } elseif (!$this->validateColor($colorValue, self::VALIDATE_ARGB_SIZE)) { + $this->hasChanged = true; + $colorValue = $this->validateColor($colorValue); + if ($colorValue === '') { return $this; } @@ -190,20 +278,7 @@ public function getRGB(): string */ public function setRGB(?string $colorValue = self::COLOR_BLACK) { - if ($colorValue === '' || $colorValue === null) { - $colorValue = '000000'; - } elseif (!$this->validateColor($colorValue, self::VALIDATE_RGB_SIZE)) { - return $this; - } - - if ($this->isSupervisor) { - $styleArray = $this->getStyleArray(['argb' => 'FF' . $colorValue]); - $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); - } else { - $this->argb = 'FF' . $colorValue; - } - - return $this; + return $this->setARGB($colorValue); } /** @@ -218,9 +293,12 @@ public function setRGB(?string $colorValue = self::COLOR_BLACK) */ private static function getColourComponent($rgbValue, $offset, $hex = true) { - $colour = substr($rgbValue, $offset, 2); + $colour = substr($rgbValue, $offset, 2) ?: ''; + if (preg_match('/^[0-9a-f]{2}$/i', $colour) !== 1) { + $colour = '00'; + } - return ($hex) ? $colour : hexdec($colour); + return ($hex) ? $colour : (int) hexdec($colour); } /** @@ -312,75 +390,19 @@ public static function changeBrightness($hexColourValue, $adjustPercentage) * * @return Color */ - public static function indexedColor($colorIndex, $background = false): self + public static function indexedColor($colorIndex, $background = false, ?array $palette = null): self { // Clean parameter $colorIndex = (int) $colorIndex; - // Indexed colors - if (self::$indexedColors === null) { - self::$indexedColors = [ - 1 => 'FF000000', // System Colour #1 - Black - 2 => 'FFFFFFFF', // System Colour #2 - White - 3 => 'FFFF0000', // System Colour #3 - Red - 4 => 'FF00FF00', // System Colour #4 - Green - 5 => 'FF0000FF', // System Colour #5 - Blue - 6 => 'FFFFFF00', // System Colour #6 - Yellow - 7 => 'FFFF00FF', // System Colour #7- Magenta - 8 => 'FF00FFFF', // System Colour #8- Cyan - 9 => 'FF800000', // Standard Colour #9 - 10 => 'FF008000', // Standard Colour #10 - 11 => 'FF000080', // Standard Colour #11 - 12 => 'FF808000', // Standard Colour #12 - 13 => 'FF800080', // Standard Colour #13 - 14 => 'FF008080', // Standard Colour #14 - 15 => 'FFC0C0C0', // Standard Colour #15 - 16 => 'FF808080', // Standard Colour #16 - 17 => 'FF9999FF', // Chart Fill Colour #17 - 18 => 'FF993366', // Chart Fill Colour #18 - 19 => 'FFFFFFCC', // Chart Fill Colour #19 - 20 => 'FFCCFFFF', // Chart Fill Colour #20 - 21 => 'FF660066', // Chart Fill Colour #21 - 22 => 'FFFF8080', // Chart Fill Colour #22 - 23 => 'FF0066CC', // Chart Fill Colour #23 - 24 => 'FFCCCCFF', // Chart Fill Colour #24 - 25 => 'FF000080', // Chart Line Colour #25 - 26 => 'FFFF00FF', // Chart Line Colour #26 - 27 => 'FFFFFF00', // Chart Line Colour #27 - 28 => 'FF00FFFF', // Chart Line Colour #28 - 29 => 'FF800080', // Chart Line Colour #29 - 30 => 'FF800000', // Chart Line Colour #30 - 31 => 'FF008080', // Chart Line Colour #31 - 32 => 'FF0000FF', // Chart Line Colour #32 - 33 => 'FF00CCFF', // Standard Colour #33 - 34 => 'FFCCFFFF', // Standard Colour #34 - 35 => 'FFCCFFCC', // Standard Colour #35 - 36 => 'FFFFFF99', // Standard Colour #36 - 37 => 'FF99CCFF', // Standard Colour #37 - 38 => 'FFFF99CC', // Standard Colour #38 - 39 => 'FFCC99FF', // Standard Colour #39 - 40 => 'FFFFCC99', // Standard Colour #40 - 41 => 'FF3366FF', // Standard Colour #41 - 42 => 'FF33CCCC', // Standard Colour #42 - 43 => 'FF99CC00', // Standard Colour #43 - 44 => 'FFFFCC00', // Standard Colour #44 - 45 => 'FFFF9900', // Standard Colour #45 - 46 => 'FFFF6600', // Standard Colour #46 - 47 => 'FF666699', // Standard Colour #47 - 48 => 'FF969696', // Standard Colour #48 - 49 => 'FF003366', // Standard Colour #49 - 50 => 'FF339966', // Standard Colour #50 - 51 => 'FF003300', // Standard Colour #51 - 52 => 'FF333300', // Standard Colour #52 - 53 => 'FF993300', // Standard Colour #53 - 54 => 'FF993366', // Standard Colour #54 - 55 => 'FF333399', // Standard Colour #55 - 56 => 'FF333333', // Standard Colour #56 - ]; - } - - if (isset(self::$indexedColors[$colorIndex])) { - return new self(self::$indexedColors[$colorIndex]); + if (empty($palette)) { + if (isset(self::INDEXED_COLORS[$colorIndex])) { + return new self(self::INDEXED_COLORS[$colorIndex]); + } + } else { + if (isset($palette[$colorIndex])) { + return new self($palette[$colorIndex]); + } } return ($background) ? new self(self::COLOR_WHITE) : new self(self::COLOR_BLACK); @@ -410,4 +432,13 @@ protected function exportArray1(): array return $exportedArray; } + + public function getHasChanged(): bool + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->hasChanged; + } + + return $this->hasChanged; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php index e148ee8..019c064 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php @@ -9,23 +9,37 @@ class Conditional implements IComparable { // Condition types const CONDITION_NONE = 'none'; + const CONDITION_BEGINSWITH = 'beginsWith'; const CONDITION_CELLIS = 'cellIs'; + const CONDITION_CONTAINSBLANKS = 'containsBlanks'; + const CONDITION_CONTAINSERRORS = 'containsErrors'; const CONDITION_CONTAINSTEXT = 'containsText'; + const CONDITION_DATABAR = 'dataBar'; + const CONDITION_ENDSWITH = 'endsWith'; const CONDITION_EXPRESSION = 'expression'; - const CONDITION_CONTAINSBLANKS = 'containsBlanks'; const CONDITION_NOTCONTAINSBLANKS = 'notContainsBlanks'; - const CONDITION_DATABAR = 'dataBar'; + const CONDITION_NOTCONTAINSERRORS = 'notContainsErrors'; const CONDITION_NOTCONTAINSTEXT = 'notContainsText'; + const CONDITION_TIMEPERIOD = 'timePeriod'; + const CONDITION_DUPLICATES = 'duplicateValues'; + const CONDITION_UNIQUE = 'uniqueValues'; private const CONDITION_TYPES = [ + self::CONDITION_BEGINSWITH, self::CONDITION_CELLIS, self::CONDITION_CONTAINSBLANKS, + self::CONDITION_CONTAINSERRORS, self::CONDITION_CONTAINSTEXT, self::CONDITION_DATABAR, + self::CONDITION_DUPLICATES, + self::CONDITION_ENDSWITH, self::CONDITION_EXPRESSION, self::CONDITION_NONE, self::CONDITION_NOTCONTAINSBLANKS, + self::CONDITION_NOTCONTAINSERRORS, self::CONDITION_NOTCONTAINSTEXT, + self::CONDITION_TIMEPERIOD, + self::CONDITION_UNIQUE, ]; // Operator types @@ -43,6 +57,17 @@ class Conditional implements IComparable const OPERATOR_BETWEEN = 'between'; const OPERATOR_NOTBETWEEN = 'notBetween'; + const TIMEPERIOD_TODAY = 'today'; + const TIMEPERIOD_YESTERDAY = 'yesterday'; + const TIMEPERIOD_TOMORROW = 'tomorrow'; + const TIMEPERIOD_LAST_7_DAYS = 'last7Days'; + const TIMEPERIOD_LAST_WEEK = 'lastWeek'; + const TIMEPERIOD_THIS_WEEK = 'thisWeek'; + const TIMEPERIOD_NEXT_WEEK = 'nextWeek'; + const TIMEPERIOD_LAST_MONTH = 'lastMonth'; + const TIMEPERIOD_THIS_MONTH = 'thisMonth'; + const TIMEPERIOD_NEXT_MONTH = 'nextMonth'; + /** * Condition type. * @@ -74,7 +99,7 @@ class Conditional implements IComparable /** * Condition. * - * @var string[] + * @var (bool|float|int|string)[] */ private $condition = []; @@ -198,7 +223,7 @@ public function setStopIfTrue($stopIfTrue) /** * Get Conditions. * - * @return string[] + * @return (bool|float|int|string)[] */ public function getConditions() { @@ -208,7 +233,7 @@ public function getConditions() /** * Set Conditions. * - * @param bool|float|int|string|string[] $conditions Condition + * @param bool|float|int|string|(bool|float|int|string)[] $conditions Condition * * @return $this */ @@ -225,7 +250,7 @@ public function setConditions($conditions) /** * Add Condition. * - * @param string $condition Condition + * @param bool|float|int|string $condition Condition * * @return $this */ @@ -251,7 +276,7 @@ public function getStyle() * * @return $this */ - public function setStyle(?Style $style = null) + public function setStyle(Style $style) { $this->style = $style; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellMatcher.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellMatcher.php new file mode 100644 index 0000000..7d52012 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellMatcher.php @@ -0,0 +1,312 @@ + '=', + Conditional::OPERATOR_GREATERTHAN => '>', + Conditional::OPERATOR_GREATERTHANOREQUAL => '>=', + Conditional::OPERATOR_LESSTHAN => '<', + Conditional::OPERATOR_LESSTHANOREQUAL => '<=', + Conditional::OPERATOR_NOTEQUAL => '<>', + ]; + + public const COMPARISON_RANGE_OPERATORS = [ + Conditional::OPERATOR_BETWEEN => 'IF(AND(A1>=%s,A1<=%s),TRUE,FALSE)', + Conditional::OPERATOR_NOTBETWEEN => 'IF(AND(A1>=%s,A1<=%s),FALSE,TRUE)', + ]; + + public const COMPARISON_DUPLICATES_OPERATORS = [ + Conditional::CONDITION_DUPLICATES => "COUNTIF('%s'!%s,%s)>1", + Conditional::CONDITION_UNIQUE => "COUNTIF('%s'!%s,%s)=1", + ]; + + /** + * @var Cell + */ + protected $cell; + + /** + * @var int + */ + protected $cellRow; + + /** + * @var Worksheet + */ + protected $worksheet; + + /** + * @var int + */ + protected $cellColumn; + + /** + * @var string + */ + protected $conditionalRange; + + /** + * @var string + */ + protected $referenceCell; + + /** + * @var int + */ + protected $referenceRow; + + /** + * @var int + */ + protected $referenceColumn; + + /** + * @var Calculation + */ + protected $engine; + + public function __construct(Cell $cell, string $conditionalRange) + { + $this->cell = $cell; + $this->worksheet = $cell->getWorksheet(); + [$this->cellColumn, $this->cellRow] = Coordinate::indexesFromString($this->cell->getCoordinate()); + $this->setReferenceCellForExpressions($conditionalRange); + + $this->engine = Calculation::getInstance($this->worksheet->getParent()); + } + + protected function setReferenceCellForExpressions(string $conditionalRange): void + { + $conditionalRange = Coordinate::splitRange(str_replace('$', '', strtoupper($conditionalRange))); + [$this->referenceCell] = $conditionalRange[0]; + + [$this->referenceColumn, $this->referenceRow] = Coordinate::indexesFromString($this->referenceCell); + + // Convert our conditional range to an absolute conditional range, so it can be used "pinned" in formulae + $rangeSets = []; + foreach ($conditionalRange as $rangeSet) { + $absoluteRangeSet = array_map( + [Coordinate::class, 'absoluteCoordinate'], + $rangeSet + ); + $rangeSets[] = implode(':', $absoluteRangeSet); + } + $this->conditionalRange = implode(',', $rangeSets); + } + + public function evaluateConditional(Conditional $conditional): bool + { + // Some calculations may modify the stored cell; so reset it before every evaluation. + $cellColumn = Coordinate::stringFromColumnIndex($this->cellColumn); + $cellAddress = "{$cellColumn}{$this->cellRow}"; + $this->cell = $this->worksheet->getCell($cellAddress); + + switch ($conditional->getConditionType()) { + case Conditional::CONDITION_CELLIS: + return $this->processOperatorComparison($conditional); + case Conditional::CONDITION_DUPLICATES: + case Conditional::CONDITION_UNIQUE: + return $this->processDuplicatesComparison($conditional); + case Conditional::CONDITION_CONTAINSTEXT: + // Expression is NOT(ISERROR(SEARCH("",))) + case Conditional::CONDITION_NOTCONTAINSTEXT: + // Expression is ISERROR(SEARCH("",)) + case Conditional::CONDITION_BEGINSWITH: + // Expression is LEFT(,LEN(""))="" + case Conditional::CONDITION_ENDSWITH: + // Expression is RIGHT(,LEN(""))="" + case Conditional::CONDITION_CONTAINSBLANKS: + // Expression is LEN(TRIM())=0 + case Conditional::CONDITION_NOTCONTAINSBLANKS: + // Expression is LEN(TRIM())>0 + case Conditional::CONDITION_CONTAINSERRORS: + // Expression is ISERROR() + case Conditional::CONDITION_NOTCONTAINSERRORS: + // Expression is NOT(ISERROR()) + case Conditional::CONDITION_TIMEPERIOD: + // Expression varies, depending on specified timePeriod value, e.g. + // Yesterday FLOOR(,1)=TODAY()-1 + // Today FLOOR(,1)=TODAY() + // Tomorrow FLOOR(,1)=TODAY()+1 + // Last 7 Days AND(TODAY()-FLOOR(,1)<=6,FLOOR(,1)<=TODAY()) + case Conditional::CONDITION_EXPRESSION: + return $this->processExpression($conditional); + } + + return false; + } + + /** + * @param mixed $value + * + * @return float|int|string + */ + protected function wrapValue($value) + { + if (!is_numeric($value)) { + if (is_bool($value)) { + return $value ? 'TRUE' : 'FALSE'; + } elseif ($value === null) { + return 'NULL'; + } + + return '"' . $value . '"'; + } + + return $value; + } + + /** + * @return float|int|string + */ + protected function wrapCellValue() + { + return $this->wrapValue($this->cell->getCalculatedValue()); + } + + /** + * @return float|int|string + */ + protected function conditionCellAdjustment(array $matches) + { + $column = $matches[6]; + $row = $matches[7]; + + if (strpos($column, '$') === false) { + $column = Coordinate::columnIndexFromString($column); + $column += $this->cellColumn - $this->referenceColumn; + $column = Coordinate::stringFromColumnIndex($column); + } + + if (strpos($row, '$') === false) { + $row += $this->cellRow - $this->referenceRow; + } + + if (!empty($matches[4])) { + $worksheet = $this->worksheet->getParent()->getSheetByName(trim($matches[4], "'")); + if ($worksheet === null) { + return $this->wrapValue(null); + } + + return $this->wrapValue( + $worksheet + ->getCell(str_replace('$', '', "{$column}{$row}")) + ->getCalculatedValue() + ); + } + + return $this->wrapValue( + $this->worksheet + ->getCell(str_replace('$', '', "{$column}{$row}")) + ->getCalculatedValue() + ); + } + + protected function cellConditionCheck(string $condition): string + { + $splitCondition = explode(Calculation::FORMULA_STRING_QUOTE, $condition); + $i = false; + foreach ($splitCondition as &$value) { + // Only count/replace in alternating array entries (ie. not in quoted strings) + if ($i = !$i) { + $value = preg_replace_callback( + '/' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '/i', + [$this, 'conditionCellAdjustment'], + $value + ); + } + } + unset($value); + // Then rebuild the condition string to return it + return implode(Calculation::FORMULA_STRING_QUOTE, $splitCondition); + } + + protected function adjustConditionsForCellReferences(array $conditions): array + { + return array_map( + [$this, 'cellConditionCheck'], + $conditions + ); + } + + protected function processOperatorComparison(Conditional $conditional): bool + { + if (array_key_exists($conditional->getOperatorType(), self::COMPARISON_RANGE_OPERATORS)) { + return $this->processRangeOperator($conditional); + } + + $operator = self::COMPARISON_OPERATORS[$conditional->getOperatorType()]; + $conditions = $this->adjustConditionsForCellReferences($conditional->getConditions()); + $expression = sprintf('%s%s%s', (string) $this->wrapCellValue(), $operator, (string) array_pop($conditions)); + + return $this->evaluateExpression($expression); + } + + protected function processRangeOperator(Conditional $conditional): bool + { + $conditions = $this->adjustConditionsForCellReferences($conditional->getConditions()); + sort($conditions); + $expression = sprintf( + (string) preg_replace( + '/\bA1\b/i', + (string) $this->wrapCellValue(), + self::COMPARISON_RANGE_OPERATORS[$conditional->getOperatorType()] + ), + ...$conditions + ); + + return $this->evaluateExpression($expression); + } + + protected function processDuplicatesComparison(Conditional $conditional): bool + { + $worksheetName = $this->cell->getWorksheet()->getTitle(); + + $expression = sprintf( + self::COMPARISON_DUPLICATES_OPERATORS[$conditional->getConditionType()], + $worksheetName, + $this->conditionalRange, + $this->cellConditionCheck($this->cell->getCalculatedValue()) + ); + + return $this->evaluateExpression($expression); + } + + protected function processExpression(Conditional $conditional): bool + { + $conditions = $this->adjustConditionsForCellReferences($conditional->getConditions()); + $expression = array_pop($conditions); + + $expression = preg_replace( + '/\b' . $this->referenceCell . '\b/i', + (string) $this->wrapCellValue(), + $expression + ); + + return $this->evaluateExpression($expression); + } + + protected function evaluateExpression(string $expression): bool + { + $expression = "={$expression}"; + + try { + $this->engine->flushInstance(); + $result = (bool) $this->engine->calculateFormula($expression); + } catch (Exception $e) { + return false; + } + + return $result; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellStyleAssessor.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellStyleAssessor.php new file mode 100644 index 0000000..4c000db --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/CellStyleAssessor.php @@ -0,0 +1,45 @@ +cellMatcher = new CellMatcher($cell, $conditionalRange); + $this->styleMerger = new StyleMerger($cell->getStyle()); + } + + /** + * @param Conditional[] $conditionalStyles + */ + public function matchConditions(array $conditionalStyles = []): Style + { + foreach ($conditionalStyles as $conditional) { + /** @var Conditional $conditional */ + if ($this->cellMatcher->evaluateConditional($conditional) === true) { + // Merging the conditional style into the base style goes in here + $this->styleMerger->mergeStyle($conditional->getStyle()); + if ($conditional->getStopIfTrue() === true) { + break; + } + } + } + + return $this->styleMerger->getStyle(); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/StyleMerger.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/StyleMerger.php new file mode 100644 index 0000000..95e6dfd --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/StyleMerger.php @@ -0,0 +1,118 @@ +baseStyle = $baseStyle; + } + + public function getStyle(): Style + { + return $this->baseStyle; + } + + public function mergeStyle(Style $style): void + { + if ($style->getNumberFormat() !== null && $style->getNumberFormat()->getFormatCode() !== null) { + $this->baseStyle->getNumberFormat()->setFormatCode($style->getNumberFormat()->getFormatCode()); + } + + if ($style->getFont() !== null) { + $this->mergeFontStyle($this->baseStyle->getFont(), $style->getFont()); + } + + if ($style->getFill() !== null) { + $this->mergeFillStyle($this->baseStyle->getFill(), $style->getFill()); + } + + if ($style->getBorders() !== null) { + $this->mergeBordersStyle($this->baseStyle->getBorders(), $style->getBorders()); + } + } + + protected function mergeFontStyle(Font $baseFontStyle, Font $fontStyle): void + { + if ($fontStyle->getBold() !== null) { + $baseFontStyle->setBold($fontStyle->getBold()); + } + + if ($fontStyle->getItalic() !== null) { + $baseFontStyle->setItalic($fontStyle->getItalic()); + } + + if ($fontStyle->getStrikethrough() !== null) { + $baseFontStyle->setStrikethrough($fontStyle->getStrikethrough()); + } + + if ($fontStyle->getUnderline() !== null) { + $baseFontStyle->setUnderline($fontStyle->getUnderline()); + } + + if ($fontStyle->getColor() !== null && $fontStyle->getColor()->getARGB() !== null) { + $baseFontStyle->setColor($fontStyle->getColor()); + } + } + + protected function mergeFillStyle(Fill $baseFillStyle, Fill $fillStyle): void + { + if ($fillStyle->getFillType() !== null) { + $baseFillStyle->setFillType($fillStyle->getFillType()); + } + + if ($fillStyle->getRotation() !== null) { + $baseFillStyle->setRotation($fillStyle->getRotation()); + } + + if ($fillStyle->getStartColor() !== null && $fillStyle->getStartColor()->getARGB() !== null) { + $baseFillStyle->setStartColor($fillStyle->getStartColor()); + } + + if ($fillStyle->getEndColor() !== null && $fillStyle->getEndColor()->getARGB() !== null) { + $baseFillStyle->setEndColor($fillStyle->getEndColor()); + } + } + + protected function mergeBordersStyle(Borders $baseBordersStyle, Borders $bordersStyle): void + { + if ($bordersStyle->getTop() !== null) { + $this->mergeBorderStyle($baseBordersStyle->getTop(), $bordersStyle->getTop()); + } + + if ($bordersStyle->getBottom() !== null) { + $this->mergeBorderStyle($baseBordersStyle->getBottom(), $bordersStyle->getBottom()); + } + + if ($bordersStyle->getLeft() !== null) { + $this->mergeBorderStyle($baseBordersStyle->getLeft(), $bordersStyle->getLeft()); + } + + if ($bordersStyle->getRight() !== null) { + $this->mergeBorderStyle($baseBordersStyle->getRight(), $bordersStyle->getRight()); + } + } + + protected function mergeBorderStyle(Border $baseBorderStyle, Border $borderStyle): void + { + if ($borderStyle->getBorderStyle() !== null) { + $baseBorderStyle->setBorderStyle($borderStyle->getBorderStyle()); + } + + if ($borderStyle->getColor() !== null && $borderStyle->getColor()->getARGB() !== null) { + $baseBorderStyle->setColor($borderStyle->getColor()); + } + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard.php new file mode 100644 index 0000000..d5d56a9 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard.php @@ -0,0 +1,95 @@ +cellRange = $cellRange; + } + + public function newRule(string $ruleType): WizardInterface + { + switch ($ruleType) { + case self::CELL_VALUE: + return new Wizard\CellValue($this->cellRange); + case self::TEXT_VALUE: + return new Wizard\TextValue($this->cellRange); + case self::BLANKS: + return new Wizard\Blanks($this->cellRange, true); + case self::NOT_BLANKS: + return new Wizard\Blanks($this->cellRange, false); + case self::ERRORS: + return new Wizard\Errors($this->cellRange, true); + case self::NOT_ERRORS: + return new Wizard\Errors($this->cellRange, false); + case self::EXPRESSION: + case self::FORMULA: + return new Wizard\Expression($this->cellRange); + case self::DATES_OCCURRING: + return new Wizard\DateValue($this->cellRange); + case self::DUPLICATES: + return new Wizard\Duplicates($this->cellRange, false); + case self::UNIQUE: + return new Wizard\Duplicates($this->cellRange, true); + default: + throw new Exception('No wizard exists for this CF rule type'); + } + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + $conditionalType = $conditional->getConditionType(); + + switch ($conditionalType) { + case Conditional::CONDITION_CELLIS: + return Wizard\CellValue::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_CONTAINSTEXT: + case Conditional::CONDITION_NOTCONTAINSTEXT: + case Conditional::CONDITION_BEGINSWITH: + case Conditional::CONDITION_ENDSWITH: + return Wizard\TextValue::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_CONTAINSBLANKS: + case Conditional::CONDITION_NOTCONTAINSBLANKS: + return Wizard\Blanks::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_CONTAINSERRORS: + case Conditional::CONDITION_NOTCONTAINSERRORS: + return Wizard\Errors::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_TIMEPERIOD: + return Wizard\DateValue::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_EXPRESSION: + return Wizard\Expression::fromConditional($conditional, $cellRange); + case Conditional::CONDITION_DUPLICATES: + case Conditional::CONDITION_UNIQUE: + return Wizard\Duplicates::fromConditional($conditional, $cellRange); + default: + throw new Exception('No wizard exists for this CF rule type'); + } + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Blanks.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Blanks.php new file mode 100644 index 0000000..14f30d3 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Blanks.php @@ -0,0 +1,99 @@ + false, + 'isBlank' => true, + 'notEmpty' => false, + 'empty' => true, + ]; + + protected const EXPRESSIONS = [ + Wizard::NOT_BLANKS => 'LEN(TRIM(%s))>0', + Wizard::BLANKS => 'LEN(TRIM(%s))=0', + ]; + + /** + * @var bool + */ + protected $inverse; + + public function __construct(string $cellRange, bool $inverse = false) + { + parent::__construct($cellRange); + $this->inverse = $inverse; + } + + protected function inverse(bool $inverse): void + { + $this->inverse = $inverse; + } + + protected function getExpression(): void + { + $this->expression = sprintf( + self::EXPRESSIONS[$this->inverse ? Wizard::BLANKS : Wizard::NOT_BLANKS], + $this->referenceCell + ); + } + + public function getConditional(): Conditional + { + $this->getExpression(); + + $conditional = new Conditional(); + $conditional->setConditionType( + $this->inverse ? Conditional::CONDITION_CONTAINSBLANKS : Conditional::CONDITION_NOTCONTAINSBLANKS + ); + $conditional->setConditions([$this->expression]); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ( + $conditional->getConditionType() !== Conditional::CONDITION_CONTAINSBLANKS && + $conditional->getConditionType() !== Conditional::CONDITION_NOTCONTAINSBLANKS + ) { + throw new Exception('Conditional is not a Blanks CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + $wizard->inverse = $conditional->getConditionType() === Conditional::CONDITION_CONTAINSBLANKS; + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!array_key_exists($methodName, self::OPERATORS)) { + throw new Exception('Invalid Operation for Blanks CF Rule Wizard'); + } + + $this->inverse(self::OPERATORS[$methodName]); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/CellValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/CellValue.php new file mode 100644 index 0000000..f36033d --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/CellValue.php @@ -0,0 +1,189 @@ + Conditional::OPERATOR_EQUAL, + 'notEquals' => Conditional::OPERATOR_NOTEQUAL, + 'greaterThan' => Conditional::OPERATOR_GREATERTHAN, + 'greaterThanOrEqual' => Conditional::OPERATOR_GREATERTHANOREQUAL, + 'lessThan' => Conditional::OPERATOR_LESSTHAN, + 'lessThanOrEqual' => Conditional::OPERATOR_LESSTHANOREQUAL, + 'between' => Conditional::OPERATOR_BETWEEN, + 'notBetween' => Conditional::OPERATOR_NOTBETWEEN, + ]; + + protected const SINGLE_OPERATORS = CellMatcher::COMPARISON_OPERATORS; + + protected const RANGE_OPERATORS = CellMatcher::COMPARISON_RANGE_OPERATORS; + + /** @var string */ + protected $operator = Conditional::OPERATOR_EQUAL; + + /** @var array */ + protected $operand = [0]; + + /** + * @var string[] + */ + protected $operandValueType = []; + + public function __construct(string $cellRange) + { + parent::__construct($cellRange); + } + + protected function operator(string $operator): void + { + if ((!isset(self::SINGLE_OPERATORS[$operator])) && (!isset(self::RANGE_OPERATORS[$operator]))) { + throw new Exception('Invalid Operator for Cell Value CF Rule Wizard'); + } + + $this->operator = $operator; + } + + /** + * @param mixed $operand + */ + protected function operand(int $index, $operand, string $operandValueType = Wizard::VALUE_TYPE_LITERAL): void + { + if (is_string($operand)) { + $operand = $this->validateOperand($operand, $operandValueType); + } + + $this->operand[$index] = $operand; + $this->operandValueType[$index] = $operandValueType; + } + + /** + * @param mixed $value + * + * @return float|int|string + */ + protected function wrapValue($value, string $operandValueType) + { + if (!is_numeric($value) && !is_bool($value) && null !== $value) { + if ($operandValueType === Wizard::VALUE_TYPE_LITERAL) { + return '"' . str_replace('"', '""', $value) . '"'; + } + + return $this->cellConditionCheck($value); + } + + if (null === $value) { + $value = 'NULL'; + } elseif (is_bool($value)) { + $value = $value ? 'TRUE' : 'FALSE'; + } + + return $value; + } + + public function getConditional(): Conditional + { + if (!isset(self::RANGE_OPERATORS[$this->operator])) { + unset($this->operand[1], $this->operandValueType[1]); + } + $values = array_map([$this, 'wrapValue'], $this->operand, $this->operandValueType); + + $conditional = new Conditional(); + $conditional->setConditionType(Conditional::CONDITION_CELLIS); + $conditional->setOperatorType($this->operator); + $conditional->setConditions($values); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + protected static function unwrapString(string $condition): string + { + if ((strpos($condition, '"') === 0) && (strpos(strrev($condition), '"') === 0)) { + $condition = substr($condition, 1, -1); + } + + return str_replace('""', '"', $condition); + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ($conditional->getConditionType() !== Conditional::CONDITION_CELLIS) { + throw new Exception('Conditional is not a Cell Value CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + + $wizard->operator = $conditional->getOperatorType(); + $conditions = $conditional->getConditions(); + foreach ($conditions as $index => $condition) { + // Best-guess to try and identify if the text is a string literal, a cell reference or a formula? + $operandValueType = Wizard::VALUE_TYPE_LITERAL; + if (is_string($condition)) { + if (array_key_exists($condition, Calculation::$excelConstants)) { + $condition = Calculation::$excelConstants[$condition]; + } elseif (preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '$/i', $condition)) { + $operandValueType = Wizard::VALUE_TYPE_CELL; + $condition = self::reverseAdjustCellRef($condition, $cellRange); + } elseif ( + preg_match('/\(\)/', $condition) || + preg_match('/' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '/i', $condition) + ) { + $operandValueType = Wizard::VALUE_TYPE_FORMULA; + $condition = self::reverseAdjustCellRef($condition, $cellRange); + } else { + $condition = self::unwrapString($condition); + } + } + $wizard->operand($index, $condition, $operandValueType); + } + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!isset(self::MAGIC_OPERATIONS[$methodName]) && $methodName !== 'and') { + throw new Exception('Invalid Operator for Cell Value CF Rule Wizard'); + } + + if ($methodName === 'and') { + if (!isset(self::RANGE_OPERATORS[$this->operator])) { + throw new Exception('AND Value is only appropriate for range operators'); + } + + $this->operand(1, ...$arguments); + + return $this; + } + + $this->operator(self::MAGIC_OPERATIONS[$methodName]); + $this->operand(0, ...$arguments); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/DateValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/DateValue.php new file mode 100644 index 0000000..453dcdf --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/DateValue.php @@ -0,0 +1,111 @@ + Conditional::TIMEPERIOD_YESTERDAY, + 'today' => Conditional::TIMEPERIOD_TODAY, + 'tomorrow' => Conditional::TIMEPERIOD_TOMORROW, + 'lastSevenDays' => Conditional::TIMEPERIOD_LAST_7_DAYS, + 'last7Days' => Conditional::TIMEPERIOD_LAST_7_DAYS, + 'lastWeek' => Conditional::TIMEPERIOD_LAST_WEEK, + 'thisWeek' => Conditional::TIMEPERIOD_THIS_WEEK, + 'nextWeek' => Conditional::TIMEPERIOD_NEXT_WEEK, + 'lastMonth' => Conditional::TIMEPERIOD_LAST_MONTH, + 'thisMonth' => Conditional::TIMEPERIOD_THIS_MONTH, + 'nextMonth' => Conditional::TIMEPERIOD_NEXT_MONTH, + ]; + + protected const EXPRESSIONS = [ + Conditional::TIMEPERIOD_YESTERDAY => 'FLOOR(%s,1)=TODAY()-1', + Conditional::TIMEPERIOD_TODAY => 'FLOOR(%s,1)=TODAY()', + Conditional::TIMEPERIOD_TOMORROW => 'FLOOR(%s,1)=TODAY()+1', + Conditional::TIMEPERIOD_LAST_7_DAYS => 'AND(TODAY()-FLOOR(%s,1)<=6,FLOOR(%s,1)<=TODAY())', + Conditional::TIMEPERIOD_LAST_WEEK => 'AND(TODAY()-ROUNDDOWN(%s,0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(%s,0)<(WEEKDAY(TODAY())+7))', + Conditional::TIMEPERIOD_THIS_WEEK => 'AND(TODAY()-ROUNDDOWN(%s,0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(%s,0)-TODAY()<=7-WEEKDAY(TODAY()))', + Conditional::TIMEPERIOD_NEXT_WEEK => 'AND(ROUNDDOWN(%s,0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(%s,0)-TODAY()<(15-WEEKDAY(TODAY())))', + Conditional::TIMEPERIOD_LAST_MONTH => 'AND(MONTH(%s)=MONTH(EDATE(TODAY(),0-1)),YEAR(%s)=YEAR(EDATE(TODAY(),0-1)))', + Conditional::TIMEPERIOD_THIS_MONTH => 'AND(MONTH(%s)=MONTH(TODAY()),YEAR(%s)=YEAR(TODAY()))', + Conditional::TIMEPERIOD_NEXT_MONTH => 'AND(MONTH(%s)=MONTH(EDATE(TODAY(),0+1)),YEAR(%s)=YEAR(EDATE(TODAY(),0+1)))', + ]; + + /** @var string */ + protected $operator; + + public function __construct(string $cellRange) + { + parent::__construct($cellRange); + } + + protected function operator(string $operator): void + { + $this->operator = $operator; + } + + protected function setExpression(): void + { + $referenceCount = substr_count(self::EXPRESSIONS[$this->operator], '%s'); + $references = array_fill(0, $referenceCount, $this->referenceCell); + $this->expression = sprintf(self::EXPRESSIONS[$this->operator], ...$references); + } + + public function getConditional(): Conditional + { + $this->setExpression(); + + $conditional = new Conditional(); + $conditional->setConditionType(Conditional::CONDITION_TIMEPERIOD); + $conditional->setText($this->operator); + $conditional->setConditions([$this->expression]); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ($conditional->getConditionType() !== Conditional::CONDITION_TIMEPERIOD) { + throw new Exception('Conditional is not a Date Value CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + $wizard->operator = $conditional->getText(); + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!isset(self::MAGIC_OPERATIONS[$methodName])) { + throw new Exception('Invalid Operation for Date Value CF Rule Wizard'); + } + + $this->operator(self::MAGIC_OPERATIONS[$methodName]); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Duplicates.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Duplicates.php new file mode 100644 index 0000000..3f063fe --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Duplicates.php @@ -0,0 +1,78 @@ + false, + 'unique' => true, + ]; + + /** + * @var bool + */ + protected $inverse; + + public function __construct(string $cellRange, bool $inverse = false) + { + parent::__construct($cellRange); + $this->inverse = $inverse; + } + + protected function inverse(bool $inverse): void + { + $this->inverse = $inverse; + } + + public function getConditional(): Conditional + { + $conditional = new Conditional(); + $conditional->setConditionType( + $this->inverse ? Conditional::CONDITION_UNIQUE : Conditional::CONDITION_DUPLICATES + ); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ( + $conditional->getConditionType() !== Conditional::CONDITION_DUPLICATES && + $conditional->getConditionType() !== Conditional::CONDITION_UNIQUE + ) { + throw new Exception('Conditional is not a Duplicates CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + $wizard->inverse = $conditional->getConditionType() === Conditional::CONDITION_UNIQUE; + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!array_key_exists($methodName, self::OPERATORS)) { + throw new Exception('Invalid Operation for Errors CF Rule Wizard'); + } + + $this->inverse(self::OPERATORS[$methodName]); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Errors.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Errors.php new file mode 100644 index 0000000..56b9086 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Errors.php @@ -0,0 +1,95 @@ + false, + 'isError' => true, + ]; + + protected const EXPRESSIONS = [ + Wizard::NOT_ERRORS => 'NOT(ISERROR(%s))', + Wizard::ERRORS => 'ISERROR(%s)', + ]; + + /** + * @var bool + */ + protected $inverse; + + public function __construct(string $cellRange, bool $inverse = false) + { + parent::__construct($cellRange); + $this->inverse = $inverse; + } + + protected function inverse(bool $inverse): void + { + $this->inverse = $inverse; + } + + protected function getExpression(): void + { + $this->expression = sprintf( + self::EXPRESSIONS[$this->inverse ? Wizard::ERRORS : Wizard::NOT_ERRORS], + $this->referenceCell + ); + } + + public function getConditional(): Conditional + { + $this->getExpression(); + + $conditional = new Conditional(); + $conditional->setConditionType( + $this->inverse ? Conditional::CONDITION_CONTAINSERRORS : Conditional::CONDITION_NOTCONTAINSERRORS + ); + $conditional->setConditions([$this->expression]); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ( + $conditional->getConditionType() !== Conditional::CONDITION_CONTAINSERRORS && + $conditional->getConditionType() !== Conditional::CONDITION_NOTCONTAINSERRORS + ) { + throw new Exception('Conditional is not an Errors CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + $wizard->inverse = $conditional->getConditionType() === Conditional::CONDITION_CONTAINSERRORS; + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!array_key_exists($methodName, self::OPERATORS)) { + throw new Exception('Invalid Operation for Errors CF Rule Wizard'); + } + + $this->inverse(self::OPERATORS[$methodName]); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Expression.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Expression.php new file mode 100644 index 0000000..ee71e34 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/Expression.php @@ -0,0 +1,73 @@ +validateOperand($expression, Wizard::VALUE_TYPE_FORMULA); + $this->expression = $expression; + + return $this; + } + + public function getConditional(): Conditional + { + $expression = $this->adjustConditionsForCellReferences([$this->expression]); + + $conditional = new Conditional(); + $conditional->setConditionType(Conditional::CONDITION_EXPRESSION); + $conditional->setConditions($expression); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if ($conditional->getConditionType() !== Conditional::CONDITION_EXPRESSION) { + throw new Exception('Conditional is not an Expression CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + $wizard->expression = self::reverseAdjustCellRef((string) ($conditional->getConditions()[0]), $cellRange); + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if ($methodName !== 'formula') { + throw new Exception('Invalid Operation for Expression CF Rule Wizard'); + } + + $this->expression(...$arguments); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/TextValue.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/TextValue.php new file mode 100644 index 0000000..4fa635b --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/TextValue.php @@ -0,0 +1,163 @@ + Conditional::OPERATOR_CONTAINSTEXT, + 'doesntContain' => Conditional::OPERATOR_NOTCONTAINS, + 'doesNotContain' => Conditional::OPERATOR_NOTCONTAINS, + 'beginsWith' => Conditional::OPERATOR_BEGINSWITH, + 'startsWith' => Conditional::OPERATOR_BEGINSWITH, + 'endsWith' => Conditional::OPERATOR_ENDSWITH, + ]; + + protected const OPERATORS = [ + Conditional::OPERATOR_CONTAINSTEXT => Conditional::CONDITION_CONTAINSTEXT, + Conditional::OPERATOR_NOTCONTAINS => Conditional::CONDITION_NOTCONTAINSTEXT, + Conditional::OPERATOR_BEGINSWITH => Conditional::CONDITION_BEGINSWITH, + Conditional::OPERATOR_ENDSWITH => Conditional::CONDITION_ENDSWITH, + ]; + + protected const EXPRESSIONS = [ + Conditional::OPERATOR_CONTAINSTEXT => 'NOT(ISERROR(SEARCH(%s,%s)))', + Conditional::OPERATOR_NOTCONTAINS => 'ISERROR(SEARCH(%s,%s))', + Conditional::OPERATOR_BEGINSWITH => 'LEFT(%s,LEN(%s))=%s', + Conditional::OPERATOR_ENDSWITH => 'RIGHT(%s,LEN(%s))=%s', + ]; + + /** @var string */ + protected $operator; + + /** @var string */ + protected $operand; + + /** + * @var string + */ + protected $operandValueType; + + public function __construct(string $cellRange) + { + parent::__construct($cellRange); + } + + protected function operator(string $operator): void + { + if (!isset(self::OPERATORS[$operator])) { + throw new Exception('Invalid Operator for Text Value CF Rule Wizard'); + } + + $this->operator = $operator; + } + + protected function operand(string $operand, string $operandValueType = Wizard::VALUE_TYPE_LITERAL): void + { + if (is_string($operand)) { + $operand = $this->validateOperand($operand, $operandValueType); + } + + $this->operand = $operand; + $this->operandValueType = $operandValueType; + } + + protected function wrapValue(string $value): string + { + return '"' . $value . '"'; + } + + protected function setExpression(): void + { + $operand = $this->operandValueType === Wizard::VALUE_TYPE_LITERAL + ? $this->wrapValue(str_replace('"', '""', $this->operand)) + : $this->cellConditionCheck($this->operand); + + if ( + $this->operator === Conditional::OPERATOR_CONTAINSTEXT || + $this->operator === Conditional::OPERATOR_NOTCONTAINS + ) { + $this->expression = sprintf(self::EXPRESSIONS[$this->operator], $operand, $this->referenceCell); + } else { + $this->expression = sprintf(self::EXPRESSIONS[$this->operator], $this->referenceCell, $operand, $operand); + } + } + + public function getConditional(): Conditional + { + $this->setExpression(); + + $conditional = new Conditional(); + $conditional->setConditionType(self::OPERATORS[$this->operator]); + $conditional->setOperatorType($this->operator); + $conditional->setText( + $this->operandValueType !== Wizard::VALUE_TYPE_LITERAL + ? $this->cellConditionCheck($this->operand) + : $this->operand + ); + $conditional->setConditions([$this->expression]); + $conditional->setStyle($this->getStyle()); + $conditional->setStopIfTrue($this->getStopIfTrue()); + + return $conditional; + } + + public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface + { + if (!in_array($conditional->getConditionType(), self::OPERATORS, true)) { + throw new Exception('Conditional is not a Text Value CF Rule conditional'); + } + + $wizard = new self($cellRange); + $wizard->operator = (string) array_search($conditional->getConditionType(), self::OPERATORS, true); + $wizard->style = $conditional->getStyle(); + $wizard->stopIfTrue = $conditional->getStopIfTrue(); + + // Best-guess to try and identify if the text is a string literal, a cell reference or a formula? + $wizard->operandValueType = Wizard::VALUE_TYPE_LITERAL; + $condition = $conditional->getText(); + if (is_string($condition) && array_key_exists($condition, Calculation::$excelConstants)) { + $condition = Calculation::$excelConstants[$condition]; + } elseif (preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '$/i', $condition)) { + $wizard->operandValueType = Wizard::VALUE_TYPE_CELL; + $condition = self::reverseAdjustCellRef($condition, $cellRange); + } elseif ( + preg_match('/\(\)/', $condition) || + preg_match('/' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '/i', $condition) + ) { + $wizard->operandValueType = Wizard::VALUE_TYPE_FORMULA; + } + $wizard->operand = $condition; + + return $wizard; + } + + /** + * @param string $methodName + * @param mixed[] $arguments + */ + public function __call($methodName, $arguments): self + { + if (!isset(self::MAGIC_OPERATIONS[$methodName])) { + throw new Exception('Invalid Operation for Text Value CF Rule Wizard'); + } + + $this->operator(self::MAGIC_OPERATIONS[$methodName]); + $this->operand(...$arguments); + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php new file mode 100644 index 0000000..df9daab --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardAbstract.php @@ -0,0 +1,197 @@ +setCellRange($cellRange); + } + + public function getCellRange(): string + { + return $this->cellRange; + } + + public function setCellRange(string $cellRange): void + { + $this->cellRange = $cellRange; + $this->setReferenceCellForExpressions($cellRange); + } + + protected function setReferenceCellForExpressions(string $conditionalRange): void + { + $conditionalRange = Coordinate::splitRange(str_replace('$', '', strtoupper($conditionalRange))); + [$this->referenceCell] = $conditionalRange[0]; + + [$this->referenceColumn, $this->referenceRow] = Coordinate::indexesFromString($this->referenceCell); + } + + public function getStopIfTrue(): bool + { + return $this->stopIfTrue; + } + + public function setStopIfTrue(bool $stopIfTrue): void + { + $this->stopIfTrue = $stopIfTrue; + } + + public function getStyle(): Style + { + return $this->style ?? new Style(false, true); + } + + public function setStyle(Style $style): void + { + $this->style = $style; + } + + protected function validateOperand(string $operand, string $operandValueType = Wizard::VALUE_TYPE_LITERAL): string + { + if ( + $operandValueType === Wizard::VALUE_TYPE_LITERAL && + substr($operand, 0, 1) === '"' && + substr($operand, -1) === '"' + ) { + $operand = str_replace('""', '"', substr($operand, 1, -1)); + } elseif ($operandValueType === Wizard::VALUE_TYPE_FORMULA && substr($operand, 0, 1) === '=') { + $operand = substr($operand, 1); + } + + return $operand; + } + + protected static function reverseCellAdjustment(array $matches, int $referenceColumn, int $referenceRow): string + { + $worksheet = $matches[1]; + $column = $matches[6]; + $row = $matches[7]; + + if (strpos($column, '$') === false) { + $column = Coordinate::columnIndexFromString($column); + $column -= $referenceColumn - 1; + $column = Coordinate::stringFromColumnIndex($column); + } + + if (strpos($row, '$') === false) { + $row -= $referenceRow - 1; + } + + return "{$worksheet}{$column}{$row}"; + } + + public static function reverseAdjustCellRef(string $condition, string $cellRange): string + { + $conditionalRange = Coordinate::splitRange(str_replace('$', '', strtoupper($cellRange))); + [$referenceCell] = $conditionalRange[0]; + [$referenceColumnIndex, $referenceRow] = Coordinate::indexesFromString($referenceCell); + + $splitCondition = explode(Calculation::FORMULA_STRING_QUOTE, $condition); + $i = false; + foreach ($splitCondition as &$value) { + // Only count/replace in alternating array entries (ie. not in quoted strings) + if ($i = !$i) { + $value = preg_replace_callback( + '/' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '/i', + function ($matches) use ($referenceColumnIndex, $referenceRow) { + return self::reverseCellAdjustment($matches, $referenceColumnIndex, $referenceRow); + }, + $value + ); + } + } + unset($value); + + // Then rebuild the condition string to return it + return implode(Calculation::FORMULA_STRING_QUOTE, $splitCondition); + } + + protected function conditionCellAdjustment(array $matches): string + { + $worksheet = $matches[1]; + $column = $matches[6]; + $row = $matches[7]; + + if (strpos($column, '$') === false) { + $column = Coordinate::columnIndexFromString($column); + $column += $this->referenceColumn - 1; + $column = Coordinate::stringFromColumnIndex($column); + } + + if (strpos($row, '$') === false) { + $row += $this->referenceRow - 1; + } + + return "{$worksheet}{$column}{$row}"; + } + + protected function cellConditionCheck(string $condition): string + { + $splitCondition = explode(Calculation::FORMULA_STRING_QUOTE, $condition); + $i = false; + foreach ($splitCondition as &$value) { + // Only count/replace in alternating array entries (ie. not in quoted strings) + if ($i = !$i) { + $value = preg_replace_callback( + '/' . Calculation::CALCULATION_REGEXP_CELLREF_RELATIVE . '/i', + [$this, 'conditionCellAdjustment'], + $value + ); + } + } + unset($value); + + // Then rebuild the condition string to return it + return implode(Calculation::FORMULA_STRING_QUOTE, $splitCondition); + } + + protected function adjustConditionsForCellReferences(array $conditions): array + { + return array_map( + [$this, 'cellConditionCheck'], + $conditions + ); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardInterface.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardInterface.php new file mode 100644 index 0000000..10ad57b --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/ConditionalFormatting/Wizard/WizardInterface.php @@ -0,0 +1,25 @@ +parent->getSharedComponent()->getFill(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getFill(); } /** @@ -124,7 +130,7 @@ public function getStyleArray($array) * $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( * [ * 'fillType' => Fill::FILL_GRADIENT_LINEAR, - * 'rotation' => 0, + * 'rotation' => 0.0, * 'startColor' => [ * 'rgb' => '000000' * ], @@ -248,6 +254,7 @@ public function getStartColor() */ public function setStartColor(Color $color) { + $this->colorChanged = true; // make sure parameter is a real color and not a supervisor $color = $color->getIsSupervisor() ? $color->getSharedComponent() : $color; @@ -278,6 +285,7 @@ public function getEndColor() */ public function setEndColor(Color $color) { + $this->colorChanged = true; // make sure parameter is a real color and not a supervisor $color = $color->getIsSupervisor() ? $color->getSharedComponent() : $color; @@ -291,6 +299,17 @@ public function setEndColor(Color $color) return $this; } + public function getColorsChanged(): bool + { + if ($this->isSupervisor) { + $changed = $this->getSharedComponent()->colorChanged; + } else { + $changed = $this->colorChanged; + } + + return $changed || $this->startColor->getHasChanged() || $this->endColor->getHasChanged(); + } + /** * Get hash code. * @@ -308,6 +327,7 @@ public function getHashCode() $this->getRotation() . ($this->getFillType() !== self::FILL_NONE ? $this->getStartColor()->getHashCode() : '') . ($this->getFillType() !== self::FILL_NONE ? $this->getEndColor()->getHashCode() : '') . + ((string) $this->getColorsChanged()) . __CLASS__ ); } @@ -315,10 +335,12 @@ public function getHashCode() protected function exportArray1(): array { $exportedArray = []; - $this->exportArray2($exportedArray, 'endColor', $this->getEndColor()); $this->exportArray2($exportedArray, 'fillType', $this->getFillType()); $this->exportArray2($exportedArray, 'rotation', $this->getRotation()); - $this->exportArray2($exportedArray, 'startColor', $this->getStartColor()); + if ($this->getColorsChanged()) { + $this->exportArray2($exportedArray, 'endColor', $this->getEndColor()); + $this->exportArray2($exportedArray, 'startColor', $this->getStartColor()); + } return $exportedArray; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php index 63a75cc..13fe2b6 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php @@ -122,7 +122,10 @@ public function __construct($isSupervisor = false, $isConditional = false) */ public function getSharedComponent() { - return $this->parent->getSharedComponent()->getFont(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getFont(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php index a456928..6f552cb 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php @@ -10,11 +10,13 @@ class NumberFormat extends Supervisor const FORMAT_TEXT = '@'; const FORMAT_NUMBER = '0'; + const FORMAT_NUMBER_0 = '0.0'; const FORMAT_NUMBER_00 = '0.00'; const FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'; const FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'; const FORMAT_PERCENTAGE = '0%'; + const FORMAT_PERCENTAGE_0 = '0.0%'; const FORMAT_PERCENTAGE_00 = '0.00%'; const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; @@ -104,7 +106,10 @@ public function __construct($isSupervisor = false, $isConditional = false) */ public function getSharedComponent() { - return $this->parent->getSharedComponent()->getNumberFormat(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getNumberFormat(); } /** @@ -157,7 +162,7 @@ public function getFormatCode() if ($this->isSupervisor) { return $this->getSharedComponent()->getFormatCode(); } - if ($this->builtInFormatCode !== false) { + if (is_int($this->builtInFormatCode)) { return self::builtInFormatCode($this->builtInFormatCode); } @@ -352,7 +357,7 @@ public static function builtInFormatCode($index) * * @param string $formatCodeIndex * - * @return bool|int + * @return false|int */ public static function builtInFormatCodeIndex($formatCodeIndex) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php index db18e63..b8e14b8 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php @@ -8,10 +8,8 @@ class DateFormatter { /** * Search/replace values to convert Excel date/time format masks to PHP format masks. - * - * @var array */ - private static $dateFormatReplacements = [ + private const DATE_FORMAT_REPLACEMENTS = [ // first remove escapes related to non-format characters '\\' => '', // 12-hour suffix @@ -32,10 +30,6 @@ class DateFormatter // It isn't perfect, but the best way I know how ':mm' => ':i', 'mm:' => 'i:', - // month leading zero - 'mm' => 'm', - // month no leading zero - 'm' => 'n', // full day of week name 'dddd' => 'l', // short day of week name @@ -44,85 +38,145 @@ class DateFormatter 'dd' => 'd', // days no leading zero 'd' => 'j', - // seconds - 'ss' => 's', // fractional seconds - no php equivalent '.s' => '', ]; /** * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock). - * - * @var array */ - private static $dateFormatReplacements24 = [ + private const DATE_FORMAT_REPLACEMENTS24 = [ 'hh' => 'H', 'h' => 'G', + // month leading zero + 'mm' => 'm', + // month no leading zero + 'm' => 'n', + // seconds + 'ss' => 's', ]; /** * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock). - * - * @var array */ - private static $dateFormatReplacements12 = [ + private const DATE_FORMAT_REPLACEMENTS12 = [ 'hh' => 'h', 'h' => 'g', + // month leading zero + 'mm' => 'm', + // month no leading zero + 'm' => 'n', + // seconds + 'ss' => 's', + ]; + + private const HOURS_IN_DAY = 24; + private const MINUTES_IN_DAY = 60 * self::HOURS_IN_DAY; + private const SECONDS_IN_DAY = 60 * self::MINUTES_IN_DAY; + private const INTERVAL_PRECISION = 10; + private const INTERVAL_LEADING_ZERO = [ + '[hh]', + '[mm]', + '[ss]', + ]; + private const INTERVAL_ROUND_PRECISION = [ + // hours and minutes truncate + '[h]' => self::INTERVAL_PRECISION, + '[hh]' => self::INTERVAL_PRECISION, + '[m]' => self::INTERVAL_PRECISION, + '[mm]' => self::INTERVAL_PRECISION, + // seconds round + '[s]' => 0, + '[ss]' => 0, + ]; + private const INTERVAL_MULTIPLIER = [ + '[h]' => self::HOURS_IN_DAY, + '[hh]' => self::HOURS_IN_DAY, + '[m]' => self::MINUTES_IN_DAY, + '[mm]' => self::MINUTES_IN_DAY, + '[s]' => self::SECONDS_IN_DAY, + '[ss]' => self::SECONDS_IN_DAY, ]; + /** @param mixed $value */ + private static function tryInterval(bool &$seekingBracket, string &$block, $value, string $format): void + { + if ($seekingBracket) { + if (false !== strpos($block, $format)) { + $hours = (string) (int) round( + self::INTERVAL_MULTIPLIER[$format] * $value, + self::INTERVAL_ROUND_PRECISION[$format] + ); + if (strlen($hours) === 1 && in_array($format, self::INTERVAL_LEADING_ZERO, true)) { + $hours = "0$hours"; + } + $block = str_replace($format, $hours, $block); + $seekingBracket = false; + } + } + } + + /** @param mixed $value */ public static function format($value, string $format): string { // strip off first part containing e.g. [$-F800] or [$USD-409] // general syntax: [$-] // language info is in hexadecimal // strip off chinese part like [DBNum1][$-804] - $format = preg_replace('/^(\[DBNum\d\])*(\[\$[^\]]*\])/i', '', $format); + $format = (string) preg_replace('/^(\[DBNum\d\])*(\[\$[^\]]*\])/i', '', $format); // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case; // but we don't want to change any quoted strings - $format = preg_replace_callback('/(?:^|")([^"]*)(?:$|")/', ['self', 'setLowercaseCallback'], $format); + /** @var callable */ + $callable = [self::class, 'setLowercaseCallback']; + $format = preg_replace_callback('/(?:^|")([^"]*)(?:$|")/', $callable, $format); // Only process the non-quoted blocks for date format characters + + /** @phpstan-ignore-next-line */ $blocks = explode('"', $format); foreach ($blocks as $key => &$block) { if ($key % 2 == 0) { - $block = strtr($block, self::$dateFormatReplacements); + $block = strtr($block, self::DATE_FORMAT_REPLACEMENTS); if (!strpos($block, 'A')) { // 24-hour time format // when [h]:mm format, the [h] should replace to the hours of the value * 24 - if (false !== strpos($block, '[h]')) { - $hours = (int) ($value * 24); - $block = str_replace('[h]', $hours, $block); - - continue; - } - $block = strtr($block, self::$dateFormatReplacements24); + $seekingBracket = true; + self::tryInterval($seekingBracket, $block, $value, '[h]'); + self::tryInterval($seekingBracket, $block, $value, '[hh]'); + self::tryInterval($seekingBracket, $block, $value, '[mm]'); + self::tryInterval($seekingBracket, $block, $value, '[m]'); + self::tryInterval($seekingBracket, $block, $value, '[s]'); + self::tryInterval($seekingBracket, $block, $value, '[ss]'); + $block = strtr($block, self::DATE_FORMAT_REPLACEMENTS24); } else { // 12-hour time format - $block = strtr($block, self::$dateFormatReplacements12); + $block = strtr($block, self::DATE_FORMAT_REPLACEMENTS12); } } } $format = implode('"', $blocks); // escape any quoted characters so that DateTime format() will render them correctly - $format = preg_replace_callback('/"(.*)"/U', ['self', 'escapeQuotesCallback'], $format); + /** @var callable */ + $callback = [self::class, 'escapeQuotesCallback']; + $format = (string) preg_replace_callback('/"(.*)"/U', $callback, $format); $dateObj = Date::excelToDateTimeObject($value); // If the colon preceding minute had been quoted, as happens in // Excel 2003 XML formats, m will not have been changed to i above. // Change it now. - $format = \preg_replace('/\\\\:m/', ':i', $format); + $format = (string) \preg_replace('/\\\\:m/', ':i', $format); return $dateObj->format($format); } - private static function setLowercaseCallback($matches): string + private static function setLowercaseCallback(array $matches): string { return mb_strtolower($matches[0]); } - private static function escapeQuotesCallback($matches): string + private static function escapeQuotesCallback(array $matches): string { return '\\' . implode('\\', str_split($matches[1])); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/FractionFormatter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/FractionFormatter.php index 46f27cc..d1fc89f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/FractionFormatter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/FractionFormatter.php @@ -26,9 +26,12 @@ public static function format($value, string $format): string $decimalLength = strlen($decimalPart); $decimalDivisor = 10 ** $decimalLength; + /** @var float */ $GCD = MathTrig\Gcd::evaluate($decimalPart, $decimalDivisor); + /** @var float */ + $decimalPartx = $decimalPart; - $adjustedDecimalPart = $decimalPart / $GCD; + $adjustedDecimalPart = $decimalPartx / $GCD; $adjustedDecimalDivisor = $decimalDivisor / $GCD; if ((strpos($format, '0') !== false)) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php index b2ed3c8..1dd0bcd 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php @@ -33,6 +33,7 @@ private static function mergeComplexNumberFormatMasks(array $numbers, array $mas */ private static function processComplexNumberFormatMask($number, string $mask): string { + /** @var string */ $result = $number; $maskingBlockCount = preg_match_all('/0+/', $mask, $maskingBlocks, PREG_OFFSET_CAPTURE); @@ -45,12 +46,16 @@ private static function processComplexNumberFormatMask($number, string $mask): s $divisor = 10 ** $size; $offset = $block[1]; - $blockValue = sprintf("%0{$size}d", fmod($number, $divisor)); - $number = floor($number / $divisor); + /** @var float */ + $numberFloat = $number; + $blockValue = sprintf("%0{$size}d", fmod($numberFloat, $divisor)); + $number = floor($numberFloat / $divisor); $mask = substr_replace($mask, $blockValue, $offset, $size); } + /** @var string */ + $numberString = $number; if ($number > 0) { - $mask = substr_replace($mask, $number, $offset, 0); + $mask = substr_replace($mask, $numberString, $offset, 0); } $result = $mask; } @@ -64,7 +69,9 @@ private static function processComplexNumberFormatMask($number, string $mask): s private static function complexNumberFormatMask($number, string $mask, bool $splitOnPoint = true): string { $sign = ($number < 0.0) ? '-' : ''; - $number = (string) abs($number); + /** @var float */ + $numberFloat = $number; + $number = (string) abs($numberFloat); if ($splitOnPoint && strpos($mask, '.') !== false && strpos($number, '.') !== false) { $numbers = explode('.', $number); @@ -88,6 +95,8 @@ private static function complexNumberFormatMask($number, string $mask, bool $spl */ private static function formatStraightNumericValue($value, string $format, array $matches, bool $useThousands): string { + /** @var float */ + $valueFloat = $value; $left = $matches[1]; $dec = $matches[2]; $right = $matches[3]; @@ -96,7 +105,7 @@ private static function formatStraightNumericValue($value, string $format, array $minWidth = strlen($left) + strlen($dec) + strlen($right); if ($useThousands) { $value = number_format( - $value, + $valueFloat, strlen($right), StringHelper::getDecimalSeparator(), StringHelper::getThousandsSeparator() @@ -107,9 +116,9 @@ private static function formatStraightNumericValue($value, string $format, array if (preg_match('/[0#]E[+-]0/i', $format)) { // Scientific format - return sprintf('%5.2E', $value); + return sprintf('%5.2E', $valueFloat); } elseif (preg_match('/0([^\d\.]+)0/', $format) || substr_count($format, '.') > 1) { - if ($value == (int) $value && substr_count($format, '.') === 1) { + if ($value == (int) $valueFloat && substr_count($format, '.') === 1) { $value *= 10 ** strlen(explode('.', $format)[1]); } @@ -117,7 +126,9 @@ private static function formatStraightNumericValue($value, string $format, array } $sprintf_pattern = "%0$minWidth." . strlen($right) . 'f'; - $value = sprintf($sprintf_pattern, $value); + /** @var float */ + $valueFloat = $value; + $value = sprintf($sprintf_pattern, round($valueFloat, strlen($right))); return self::pregReplace(self::NUMBER_REGEX, $value, $format); } @@ -196,15 +207,15 @@ public static function format($value, string $format): string } /** - * @param mixed $value + * @param array|string $value */ private static function makeString($value): string { - return is_array($value) ? '' : (string) $value; + return is_array($value) ? '' : "$value"; } private static function pregReplace(string $pattern, string $replacement, string $subject): string { - return self::makeString(preg_replace($pattern, $replacement, $subject)); + return self::makeString(preg_replace($pattern, $replacement, $subject) ?? ''); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php index cf1731e..334c40d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php @@ -37,6 +37,9 @@ public static function format($value, string $format): string $replacement = "{$wholePartSize}.{$decimalPartSize}"; $mask = preg_replace('/[#0,]+\.?[?#0,]*/ui', "%{$replacement}f{$placeHolders}", $format); - return sprintf($mask, $value); + /** @var float */ + $valueFloat = $value; + + return sprintf($mask, round($valueFloat, $decimalPartSize)); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php index fc15e3b..1c174e7 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php @@ -53,7 +53,10 @@ public function __construct($isSupervisor = false, $isConditional = false) */ public function getSharedComponent() { - return $this->parent->getSharedComponent()->getProtection(); + /** @var Style */ + $parent = $this->parent; + + return $parent->getSharedComponent()->getProtection(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php index 5823929..78e5ebb 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php @@ -78,9 +78,7 @@ class Style extends Supervisor * @see Style::applyFromArray() * @see Style::getHashCode() * - * @phpstan-var null|array{styleByHash: array, hashByObjId: array} - * - * @var array + * @var ?array */ private static $cachedStyles; @@ -132,17 +130,15 @@ public function getSharedComponent(): self $xfIndex = 0; } - return $this->parent->getCellXfByIndex($xfIndex); + return $activeSheet->getParent()->getCellXfByIndex($xfIndex); } /** * Get parent. Only used for style supervisor. - * - * @return Spreadsheet */ - public function getParent() + public function getParent(): Spreadsheet { - return $this->parent; + return $this->getActiveSheet()->getParent(); } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php index 7f655be..8a5c350 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php @@ -18,7 +18,7 @@ abstract class Supervisor implements IComparable /** * Parent. Only used for supervisor. * - * @var Spreadsheet|Style + * @var Spreadsheet|Supervisor */ protected $parent; @@ -45,7 +45,7 @@ public function __construct($isSupervisor = false) /** * Bind parent. Only used for supervisor. * - * @param Spreadsheet|Style $parent + * @param Spreadsheet|Supervisor $parent * @param null|string $parentPropertyName * * @return $this @@ -155,4 +155,21 @@ final protected function exportArray2(array &$exportedArray, string $index, $obj $exportedArray[$index] = $objOrValue; } } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return mixed + */ + abstract public function getSharedComponent(); + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + abstract public function getStyleArray($array); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 01dd837..dd33d5d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -7,6 +7,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch; +use PhpOffice\PhpSpreadsheet\Cell\AddressRange; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Shared\Date; @@ -35,13 +36,33 @@ class AutoFilter */ private $columns = []; + /** @var bool */ + private $evaluated = false; + + public function getEvaluated(): bool + { + return $this->evaluated; + } + + public function setEvaluated(bool $value): void + { + $this->evaluated = $value; + } + /** * Create a new AutoFilter. * - * @param string $range Cell range (i.e. A1:E10) + * @param AddressRange|array|string $range + * A simple string containing a Cell range like 'A1:E10' is permitted + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. */ public function __construct($range = '', ?Worksheet $worksheet = null) { + if ($range !== '') { + [, $range] = Worksheet::extractSheetTitle(Validations::validateCellRange($range), true); + } + $this->range = $range; $this->workSheet = $worksheet; } @@ -63,6 +84,7 @@ public function getParent() */ public function setParent(?Worksheet $worksheet = null) { + $this->evaluated = false; $this->workSheet = $worksheet; return $this; @@ -79,16 +101,20 @@ public function getRange() } /** - * Set AutoFilter Range. + * Set AutoFilter Cell Range. * - * @param string $range Cell range (i.e. A1:E10) - * - * @return $this + * @param AddressRange|array|string $range + * A simple string containing a Cell range like 'A1:E10' is permitted + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. */ - public function setRange($range) + public function setRange($range = ''): self { + $this->evaluated = false; // extract coordinate - [$worksheet, $range] = Worksheet::extractSheetTitle($range, true); + if ($range !== '') { + [, $range] = Worksheet::extractSheetTitle(Validations::validateCellRange($range), true); + } if (empty($range)) { // Discard all column rules $this->columns = []; @@ -114,6 +140,20 @@ public function setRange($range) return $this; } + public function setRangeToMaxRow(): self + { + $this->evaluated = false; + if ($this->workSheet !== null) { + $thisrange = $this->range; + $range = preg_replace('/\\d+$/', (string) $this->workSheet->getHighestRow(), $thisrange) ?? ''; + if ($range !== $thisrange) { + $this->setRange($range); + } + } + + return $this; + } + /** * Get all AutoFilter Columns. * @@ -201,6 +241,7 @@ public function getColumnByOffset($columnOffset) */ public function setColumn($columnObjectOrString) { + $this->evaluated = false; if ((is_string($columnObjectOrString)) && (!empty($columnObjectOrString))) { $column = $columnObjectOrString; } elseif (is_object($columnObjectOrString) && ($columnObjectOrString instanceof AutoFilter\Column)) { @@ -230,6 +271,7 @@ public function setColumn($columnObjectOrString) */ public function clearColumn($column) { + $this->evaluated = false; $this->testColumnInRange($column); if (isset($this->columns[$column])) { @@ -253,6 +295,7 @@ public function clearColumn($column) */ public function shiftColumn($fromColumn, $toColumn) { + $this->evaluated = false; $fromColumn = strtoupper($fromColumn); $toColumn = strtoupper($toColumn); @@ -360,7 +403,7 @@ private static function filterTestInCustomDataSet($cellValue, $ruleSet) /** @var string */ $ruleOperator = $rule['operator']; /** @var string */ - $cellValueString = $cellValue; + $cellValueString = $cellValue ?? ''; $retVal = false; if (is_numeric($ruleValue)) { @@ -905,6 +948,9 @@ public function showHideRows() $averageFormula = '=AVERAGE(' . $columnID . ($rangeStart[1] + 1) . ':' . $columnID . $rangeEnd[1] . ')'; $spreadsheet = ($this->workSheet === null) ? null : $this->workSheet->getParent(); $average = Calculation::getInstance($spreadsheet)->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1')); + while (is_array($average)) { + $average = array_pop($average); + } // Set above/below rule based on greaterThan or LessTan $operator = ($dynamicRuleType === Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ? Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN @@ -1002,6 +1048,7 @@ public function showHideRows() // Set show/hide for the row based on the result of the autoFilter result $this->workSheet->getRowDimension((int) $row)->setVisible($result); } + $this->evaluated = true; return $this; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php index ef741ee..076292f 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -100,6 +100,13 @@ public function __construct($column, ?AutoFilter $parent = null) $this->parent = $parent; } + public function setEvaluatedFalse(): void + { + if ($this->parent !== null) { + $this->parent->setEvaluated(false); + } + } + /** * Get AutoFilter column index as string eg: 'A'. * @@ -119,6 +126,7 @@ public function getColumnIndex() */ public function setColumnIndex($column) { + $this->setEvaluatedFalse(); // Uppercase coordinate $column = strtoupper($column); if ($this->parent !== null) { @@ -147,6 +155,7 @@ public function getParent() */ public function setParent(?AutoFilter $parent = null) { + $this->setEvaluatedFalse(); $this->parent = $parent; return $this; @@ -171,6 +180,7 @@ public function getFilterType() */ public function setFilterType($filterType) { + $this->setEvaluatedFalse(); if (!in_array($filterType, self::$filterTypes)) { throw new PhpSpreadsheetException('Invalid filter type for column AutoFilter.'); } @@ -202,6 +212,7 @@ public function getJoin() */ public function setJoin($join) { + $this->setEvaluatedFalse(); // Lowercase And/Or $join = strtolower($join); if (!in_array($join, self::$ruleJoins)) { @@ -222,6 +233,7 @@ public function setJoin($join) */ public function setAttributes($attributes) { + $this->setEvaluatedFalse(); $this->attributes = $attributes; return $this; @@ -231,12 +243,13 @@ public function setAttributes($attributes) * Set An AutoFilter Attribute. * * @param string $name Attribute Name - * @param string $value Attribute Value + * @param int|string $value Attribute Value * * @return $this */ public function setAttribute($name, $value) { + $this->setEvaluatedFalse(); $this->attributes[$name] = $value; return $this; @@ -306,6 +319,7 @@ public function getRule($index) */ public function createRule() { + $this->setEvaluatedFalse(); if ($this->filterType === self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER && count($this->ruleset) >= 2) { throw new PhpSpreadsheetException('No more than 2 rules are allowed in a Custom Filter'); } @@ -321,6 +335,7 @@ public function createRule() */ public function addRule(Column\Rule $rule) { + $this->setEvaluatedFalse(); $rule->setParent($this); $this->ruleset[] = $rule; @@ -337,6 +352,7 @@ public function addRule(Column\Rule $rule) */ public function deleteRule($index) { + $this->setEvaluatedFalse(); if (isset($this->ruleset[$index])) { unset($this->ruleset[$index]); // If we've just deleted down to a single rule, then reset And/Or joining to Or @@ -355,6 +371,7 @@ public function deleteRule($index) */ public function clearRules() { + $this->setEvaluatedFalse(); $this->ruleset = []; $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php index 525b06f..408dfb3 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -213,6 +213,13 @@ public function __construct(?Column $parent = null) $this->parent = $parent; } + private function setEvaluatedFalse(): void + { + if ($this->parent !== null) { + $this->parent->setEvaluatedFalse(); + } + } + /** * Get AutoFilter Rule Type. * @@ -232,6 +239,7 @@ public function getRuleType() */ public function setRuleType($ruleType) { + $this->setEvaluatedFalse(); if (!in_array($ruleType, self::RULE_TYPES)) { throw new PhpSpreadsheetException('Invalid rule type for column AutoFilter Rule.'); } @@ -260,6 +268,7 @@ public function getValue() */ public function setValue($value) { + $this->setEvaluatedFalse(); if (is_array($value)) { $grouping = -1; foreach ($value as $key => $v) { @@ -302,6 +311,7 @@ public function getOperator() */ public function setOperator($operator) { + $this->setEvaluatedFalse(); if (empty($operator)) { $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL; } @@ -335,6 +345,7 @@ public function getGrouping() */ public function setGrouping($grouping) { + $this->setEvaluatedFalse(); if ( ($grouping !== null) && (!in_array($grouping, self::DATE_TIME_GROUPS)) && @@ -359,6 +370,7 @@ public function setGrouping($grouping) */ public function setRule($operator, $value, $grouping = null) { + $this->setEvaluatedFalse(); $this->setOperator($operator); $this->setValue($value); // Only set grouping if it's been passed in as a user-supplied argument, @@ -388,6 +400,7 @@ public function getParent() */ public function setParent(?Column $parent = null) { + $this->setEvaluatedFalse(); $this->parent = $parent; return $this; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php index b8cfb01..815536b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -8,6 +8,22 @@ class BaseDrawing implements IComparable { + const EDIT_AS_ABSOLUTE = 'absolute'; + const EDIT_AS_ONECELL = 'onecell'; + const EDIT_AS_TWOCELL = 'twocell'; + private const VALID_EDIT_AS = [ + self::EDIT_AS_ABSOLUTE, + self::EDIT_AS_ONECELL, + self::EDIT_AS_TWOCELL, + ]; + + /** + * The editAs attribute, used only with two cell anchor. + * + * @var string + */ + protected $editAs = ''; + /** * Image counter. * @@ -27,14 +43,14 @@ class BaseDrawing implements IComparable * * @var string */ - protected $name; + protected $name = ''; /** * Description. * * @var string */ - protected $description; + protected $description = ''; /** * Worksheet. @@ -48,49 +64,84 @@ class BaseDrawing implements IComparable * * @var string */ - protected $coordinates; + protected $coordinates = 'A1'; /** * Offset X. * * @var int */ - protected $offsetX; + protected $offsetX = 0; /** * Offset Y. * * @var int */ - protected $offsetY; + protected $offsetY = 0; + + /** + * Coordinates2. + * + * @var string + */ + protected $coordinates2 = ''; + + /** + * Offset X2. + * + * @var int + */ + protected $offsetX2 = 0; + + /** + * Offset Y2. + * + * @var int + */ + protected $offsetY2 = 0; /** * Width. * * @var int */ - protected $width; + protected $width = 0; /** * Height. * * @var int */ - protected $height; + protected $height = 0; + + /** + * Pixel width of image. See $width for the size the Drawing will be in the sheet. + * + * @var int + */ + protected $imageWidth = 0; + + /** + * Pixel width of image. See $height for the size the Drawing will be in the sheet. + * + * @var int + */ + protected $imageHeight = 0; /** * Proportional resize. * * @var bool */ - protected $resizeProportional; + protected $resizeProportional = true; /** * Rotation. * * @var int */ - protected $rotation; + protected $rotation = 0; /** * Shadow. @@ -106,93 +157,56 @@ class BaseDrawing implements IComparable */ private $hyperlink; + /** + * Image type. + * + * @var int + */ + protected $type = IMAGETYPE_UNKNOWN; + /** * Create a new BaseDrawing. */ public function __construct() { // Initialise values - $this->name = ''; - $this->description = ''; - $this->worksheet = null; - $this->coordinates = 'A1'; - $this->offsetX = 0; - $this->offsetY = 0; - $this->width = 0; - $this->height = 0; - $this->resizeProportional = true; - $this->rotation = 0; - $this->shadow = new Drawing\Shadow(); + $this->setShadow(); // Set image index ++self::$imageCounter; $this->imageIndex = self::$imageCounter; } - /** - * Get image index. - * - * @return int - */ - public function getImageIndex() + public function getImageIndex(): int { return $this->imageIndex; } - /** - * Get Name. - * - * @return string - */ - public function getName() + public function getName(): string { return $this->name; } - /** - * Set Name. - * - * @param string $name - * - * @return $this - */ - public function setName($name) + public function setName(string $name): self { $this->name = $name; return $this; } - /** - * Get Description. - * - * @return string - */ - public function getDescription() + public function getDescription(): string { return $this->description; } - /** - * Set Description. - * - * @param string $description - * - * @return $this - */ - public function setDescription($description) + public function setDescription(string $description): self { $this->description = $description; return $this; } - /** - * Get Worksheet. - * - * @return null|Worksheet - */ - public function getWorksheet() + public function getWorksheet(): ?Worksheet { return $this->worksheet; } @@ -201,16 +215,16 @@ public function getWorksheet() * Set Worksheet. * * @param bool $overrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? - * - * @return $this */ - public function setWorksheet(?Worksheet $worksheet = null, $overrideOld = false) + public function setWorksheet(?Worksheet $worksheet = null, bool $overrideOld = false): self { if ($this->worksheet === null) { // Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet - $this->worksheet = $worksheet; - $this->worksheet->getCell($this->coordinates); - $this->worksheet->getDrawingCollection()->append($this); + if ($worksheet !== null) { + $this->worksheet = $worksheet; + $this->worksheet->getCell($this->coordinates); + $this->worksheet->getDrawingCollection()->append($this); + } } else { if ($overrideOld) { // Remove drawing from old \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet @@ -235,96 +249,84 @@ public function setWorksheet(?Worksheet $worksheet = null, $overrideOld = false) return $this; } - /** - * Get Coordinates. - * - * @return string - */ - public function getCoordinates() + public function getCoordinates(): string { return $this->coordinates; } - /** - * Set Coordinates. - * - * @param string $coordinates eg: 'A1' - * - * @return $this - */ - public function setCoordinates($coordinates) + public function setCoordinates(string $coordinates): self { $this->coordinates = $coordinates; return $this; } - /** - * Get OffsetX. - * - * @return int - */ - public function getOffsetX() + public function getOffsetX(): int { return $this->offsetX; } - /** - * Set OffsetX. - * - * @param int $offsetX - * - * @return $this - */ - public function setOffsetX($offsetX) + public function setOffsetX(int $offsetX): self { $this->offsetX = $offsetX; return $this; } - /** - * Get OffsetY. - * - * @return int - */ - public function getOffsetY() + public function getOffsetY(): int { return $this->offsetY; } - /** - * Set OffsetY. - * - * @param int $offsetY - * - * @return $this - */ - public function setOffsetY($offsetY) + public function setOffsetY(int $offsetY): self { $this->offsetY = $offsetY; return $this; } - /** - * Get Width. - * - * @return int - */ - public function getWidth() + public function getCoordinates2(): string + { + return $this->coordinates2; + } + + public function setCoordinates2(string $coordinates2): self + { + $this->coordinates2 = $coordinates2; + + return $this; + } + + public function getOffsetX2(): int + { + return $this->offsetX2; + } + + public function setOffsetX2(int $offsetX2): self + { + $this->offsetX2 = $offsetX2; + + return $this; + } + + public function getOffsetY2(): int + { + return $this->offsetY2; + } + + public function setOffsetY2(int $offsetY2): self + { + $this->offsetY2 = $offsetY2; + + return $this; + } + + public function getWidth(): int { return $this->width; } - /** - * Set Width. - * - * @param int $width - * - * @return $this - */ - public function setWidth($width) + public function setWidth(int $width): self { // Resize proportional? if ($this->resizeProportional && $width != 0) { @@ -338,24 +340,12 @@ public function setWidth($width) return $this; } - /** - * Get Height. - * - * @return int - */ - public function getHeight() + public function getHeight(): int { return $this->height; } - /** - * Set Height. - * - * @param int $height - * - * @return $this - */ - public function setHeight($height) + public function setHeight(int $height): self { // Resize proportional? if ($this->resizeProportional && $height != 0) { @@ -378,14 +368,9 @@ public function setHeight($height) * $objDrawing->setWidthAndHeight(160,120); * * - * @param int $width - * @param int $height - * - * @return $this - * * @author Vincent@luo MSN:kele_100@hotmail.com */ - public function setWidthAndHeight($width, $height) + public function setWidthAndHeight(int $width, int $height): self { $xratio = $width / ($this->width != 0 ? $this->width : 1); $yratio = $height / ($this->height != 0 ? $this->height : 1); @@ -405,72 +390,38 @@ public function setWidthAndHeight($width, $height) return $this; } - /** - * Get ResizeProportional. - * - * @return bool - */ - public function getResizeProportional() + public function getResizeProportional(): bool { return $this->resizeProportional; } - /** - * Set ResizeProportional. - * - * @param bool $resizeProportional - * - * @return $this - */ - public function setResizeProportional($resizeProportional) + public function setResizeProportional(bool $resizeProportional): self { $this->resizeProportional = $resizeProportional; return $this; } - /** - * Get Rotation. - * - * @return int - */ - public function getRotation() + public function getRotation(): int { return $this->rotation; } - /** - * Set Rotation. - * - * @param int $rotation - * - * @return $this - */ - public function setRotation($rotation) + public function setRotation(int $rotation): self { $this->rotation = $rotation; return $this; } - /** - * Get Shadow. - * - * @return Drawing\Shadow - */ - public function getShadow() + public function getShadow(): Drawing\Shadow { return $this->shadow; } - /** - * Set Shadow. - * - * @return $this - */ - public function setShadow(?Drawing\Shadow $shadow = null) + public function setShadow(?Drawing\Shadow $shadow = null): self { - $this->shadow = $shadow; + $this->shadow = $shadow ?? new Drawing\Shadow(); return $this; } @@ -485,10 +436,13 @@ public function getHashCode() return md5( $this->name . $this->description . - $this->worksheet->getHashCode() . + (($this->worksheet === null) ? '' : $this->worksheet->getHashCode()) . $this->coordinates . $this->offsetX . $this->offsetY . + $this->coordinates2 . + $this->offsetX2 . + $this->offsetY2 . $this->width . $this->height . $this->rotation . @@ -519,11 +473,63 @@ public function setHyperlink(?Hyperlink $hyperlink = null): void $this->hyperlink = $hyperlink; } + public function getHyperlink(): ?Hyperlink + { + return $this->hyperlink; + } + /** - * @return null|Hyperlink + * Set Fact Sizes and Type of Image. */ - public function getHyperlink() + protected function setSizesAndType(string $path): void { - return $this->hyperlink; + if ($this->imageWidth === 0 && $this->imageHeight === 0 && $this->type === IMAGETYPE_UNKNOWN) { + $imageData = getimagesize($path); + + if (is_array($imageData)) { + $this->imageWidth = $imageData[0]; + $this->imageHeight = $imageData[1]; + $this->type = $imageData[2]; + } + } + if ($this->width === 0 && $this->height === 0) { + $this->width = $this->imageWidth; + $this->height = $this->imageHeight; + } + } + + /** + * Get Image Type. + */ + public function getType(): int + { + return $this->type; + } + + public function getImageWidth(): int + { + return $this->imageWidth; + } + + public function getImageHeight(): int + { + return $this->imageHeight; + } + + public function getEditAs(): string + { + return $this->editAs; + } + + public function setEditAs(string $editAs): self + { + $this->editAs = $editAs; + + return $this; + } + + public function validEditAs(): bool + { + return in_array($this->editAs, self::VALID_EDIT_AS); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php index 8a48f47..b64ecec 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php @@ -2,6 +2,7 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; +use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Helper\Dimension as CssDimension; class ColumnDimension extends Dimension @@ -53,22 +54,39 @@ public function getColumnIndex(): string /** * Set column index as string eg: 'A'. - * - * @return $this */ - public function setColumnIndex(string $index) + public function setColumnIndex(string $index): self { $this->columnIndex = $index; return $this; } + /** + * Get column index as numeric. + */ + public function getColumnNumeric(): int + { + return Coordinate::columnIndexFromString($this->columnIndex); + } + + /** + * Set column index as numeric. + */ + public function setColumnNumeric(int $index): self + { + $this->columnIndex = Coordinate::stringFromColumnIndex($index); + + return $this; + } + /** * Get Width. * - * Each unit of column width is equal to the width of one character in the default font size. - * By default, this will be the return value; but this method also accepts a unit of measure argument and will - * return the value converted to the specified UoM using an approximation method. + * Each unit of column width is equal to the width of one character in the default font size. A value of -1 + * tells Excel to display this column in its default width. + * By default, this will be the return value; but this method also accepts an optional unit of measure argument + * and will convert the returned value to the specified UoM.. */ public function getWidth(?string $unitOfMeasure = null): float { @@ -80,9 +98,11 @@ public function getWidth(?string $unitOfMeasure = null): float /** * Set Width. * - * Each unit of column width is equal to the width of one character in the default font size. - * By default, this will be the unit of measure for the passed value; but this method accepts a unit of measure - * argument, and will convert the value from the specified UoM using an approximation method. + * Each unit of column width is equal to the width of one character in the default font size. A value of -1 + * tells Excel to display this column in its default width. + * By default, this will be the unit of measure for the passed value; but this method also accepts an + * optional unit of measure argument, and will convert the value from the specified UoM using an + * approximation method. * * @return $this */ diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php index 894ac19..ba03b5b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php @@ -131,19 +131,4 @@ public function setXfIndex(int $XfIndex) return $this; } - - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() - { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if (is_object($value)) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php index bbb5acf..f62873b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php @@ -3,9 +3,17 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; +use ZipArchive; class Drawing extends BaseDrawing { + const IMAGE_TYPES_CONVERTION_MAP = [ + IMAGETYPE_GIF => IMAGETYPE_PNG, + IMAGETYPE_JPEG => IMAGETYPE_JPEG, + IMAGETYPE_PNG => IMAGETYPE_PNG, + IMAGETYPE_BMP => IMAGETYPE_PNG, + ]; + /** * Path. * @@ -48,10 +56,7 @@ public function getFilename() */ public function getIndexedFilename(): string { - $fileName = $this->getFilename(); - $fileName = str_replace(' ', '_', $fileName); - - return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension(); + return md5($this->path) . '.' . $this->getExtension(); } /** @@ -66,6 +71,20 @@ public function getExtension() return $exploded[count($exploded) - 1]; } + /** + * Get full filepath to store drawing in zip archive. + * + * @return string + */ + public function getMediaFilename() + { + if (!array_key_exists($this->type, self::IMAGE_TYPES_CONVERTION_MAP)) { + throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.'); + } + + return sprintf('image%d%s', $this->getImageIndex(), $this->getImageFileExtensionForSave()); + } + /** * Get Path. * @@ -81,10 +100,11 @@ public function getPath() * * @param string $path File path * @param bool $verifyFile Verify file + * @param ZipArchive $zip Zip archive instance * * @return $this */ - public function setPath($path, $verifyFile = true) + public function setPath($path, $verifyFile = true, $zip = null) { if ($verifyFile) { // Check if a URL has been passed. https://stackoverflow.com/a/2058596/1252979 @@ -97,18 +117,18 @@ public function setPath($path, $verifyFile = true) if ($filePath) { file_put_contents($filePath, $imageContents); if (file_exists($filePath)) { - if ($this->width == 0 && $this->height == 0) { - // Get width/height - [$this->width, $this->height] = getimagesize($filePath); - } + $this->setSizesAndType($filePath); unlink($filePath); } } } elseif (file_exists($path)) { $this->path = $path; - if ($this->width == 0 && $this->height == 0) { - // Get width/height - [$this->width, $this->height] = getimagesize($path); + $this->setSizesAndType($path); + } elseif ($zip instanceof ZipArchive) { + $zipPath = explode('#', $path)[1]; + if ($zip->locateName($zipPath) !== false) { + $this->path = $path; + $this->setSizesAndType($path); } } else { throw new PhpSpreadsheetException("File $path not found!"); @@ -153,4 +173,42 @@ public function getHashCode() __CLASS__ ); } + + /** + * Get Image Type for Save. + */ + public function getImageTypeForSave(): int + { + if (!array_key_exists($this->type, self::IMAGE_TYPES_CONVERTION_MAP)) { + throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.'); + } + + return self::IMAGE_TYPES_CONVERTION_MAP[$this->type]; + } + + /** + * Get Image file extention for Save. + */ + public function getImageFileExtensionForSave(bool $includeDot = true): string + { + if (!array_key_exists($this->type, self::IMAGE_TYPES_CONVERTION_MAP)) { + throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.'); + } + + $result = image_type_to_extension(self::IMAGE_TYPES_CONVERTION_MAP[$this->type], $includeDot); + + return is_string($result) ? $result : ''; + } + + /** + * Get Image mime type. + */ + public function getImageMimeType(): string + { + if (!array_key_exists($this->type, self::IMAGE_TYPES_CONVERTION_MAP)) { + throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.'); + } + + return image_type_to_mime_type(self::IMAGE_TYPES_CONVERTION_MAP[$this->type]); + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index 19a3d1e..e65541d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -47,6 +47,9 @@ class MemoryDrawing extends BaseDrawing */ private $uniqueName; + /** @var null|resource */ + private $alwaysNull; + /** * Create a new MemoryDrawing. */ @@ -56,6 +59,7 @@ public function __construct() $this->renderingFunction = self::RENDERING_DEFAULT; $this->mimeType = self::MIMETYPE_DEFAULT; $this->uniqueName = md5(mt_rand(0, 9999) . time() . mt_rand(0, 9999)); + $this->alwaysNull = null; // Initialize parent parent::__construct(); @@ -64,8 +68,9 @@ public function __construct() public function __destruct() { if ($this->imageResource) { - imagedestroy($this->imageResource); - $this->imageResource = null; + $rslt = @imagedestroy($this->imageResource); + // "Fix" for Scrutinizer + $this->imageResource = $rslt ? null : $this->alwaysNull; } } @@ -102,7 +107,7 @@ private function cloneResource(): void $transparent = imagecolortransparent($this->imageResource); if ($transparent >= 0) { $rgb = imagecolorsforindex($this->imageResource, $transparent); - if ($rgb === false) { + if (empty($rgb)) { throw new Exception('Could not get image colors'); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php index ec276b6..c23bfc5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -160,18 +160,32 @@ class PageSetup const PAGEORDER_DOWN_THEN_OVER = 'downThenOver'; /** - * Paper size. + * Paper size default. * * @var int */ - private $paperSize = self::PAPERSIZE_LETTER; + private static $paperSizeDefault = self::PAPERSIZE_LETTER; + + /** + * Paper size. + * + * @var ?int + */ + private $paperSize; + + /** + * Orientation default. + * + * @var string + */ + private static $orientationDefault = self::ORIENTATION_DEFAULT; /** * Orientation. * * @var string */ - private $orientation = self::ORIENTATION_DEFAULT; + private $orientation; /** * Scale (Print Scale). @@ -256,6 +270,7 @@ class PageSetup */ public function __construct() { + $this->orientation = self::$orientationDefault; } /** @@ -265,7 +280,7 @@ public function __construct() */ public function getPaperSize() { - return $this->paperSize; + return $this->paperSize ?? self::$paperSizeDefault; } /** @@ -282,6 +297,22 @@ public function setPaperSize($paperSize) return $this; } + /** + * Get Paper Size default. + */ + public static function getPaperSizeDefault(): int + { + return self::$paperSizeDefault; + } + + /** + * Set Paper Size Default. + */ + public static function setPaperSizeDefault(int $paperSize): void + { + self::$paperSizeDefault = $paperSize; + } + /** * Get Orientation. * @@ -301,11 +332,25 @@ public function getOrientation() */ public function setOrientation($orientation) { - $this->orientation = $orientation; + if ($orientation === self::ORIENTATION_LANDSCAPE || $orientation === self::ORIENTATION_PORTRAIT || $orientation === self::ORIENTATION_DEFAULT) { + $this->orientation = $orientation; + } return $this; } + public static function getOrientationDefault(): string + { + return self::$orientationDefault; + } + + public static function setOrientationDefault(string $orientation): void + { + if ($orientation === self::ORIENTATION_LANDSCAPE || $orientation === self::ORIENTATION_PORTRAIT || $orientation === self::ORIENTATION_DEFAULT) { + self::$orientationDefault = $orientation; + } + } + /** * Get Scale. * @@ -595,6 +640,7 @@ public function getPrintArea($index = 0) if ($index == 0) { return $this->printArea; } + /** @phpstan-ignore-next-line */ $printAreas = explode(',', $this->printArea); if (isset($printAreas[$index - 1])) { return $printAreas[$index - 1]; @@ -618,6 +664,7 @@ public function isPrintAreaSet($index = 0) if ($index == 0) { return $this->printArea !== null; } + /** @phpstan-ignore-next-line */ $printAreas = explode(',', $this->printArea); return isset($printAreas[$index - 1]); @@ -638,6 +685,7 @@ public function clearPrintArea($index = 0) if ($index == 0) { $this->printArea = null; } else { + /** @phpstan-ignore-next-line */ $printAreas = explode(',', $this->printArea); if (isset($printAreas[$index - 1])) { unset($printAreas[$index - 1]); @@ -686,6 +734,7 @@ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_O if ($index == 0) { $this->printArea = $value; } else { + /** @phpstan-ignore-next-line */ $printAreas = explode(',', $this->printArea); if ($index < 0) { $index = count($printAreas) - abs($index) + 1; @@ -700,6 +749,7 @@ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_O if ($index == 0) { $this->printArea = $this->printArea ? ($this->printArea . ',' . $value) : $value; } else { + /** @phpstan-ignore-next-line */ $printAreas = explode(',', $this->printArea); if ($index < 0) { $index = abs($index) - 1; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php index b593335..a5f8f32 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php @@ -35,8 +35,7 @@ public function __construct(?Worksheet $worksheet = null, $rowIndex = 1) */ public function __destruct() { - // @phpstan-ignore-next-line - $this->worksheet = null; + $this->worksheet = null; // @phpstan-ignore-line } /** diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php index 1d8aada..acaafac 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php @@ -65,8 +65,9 @@ public function setRowIndex(int $index) /** * Get Row Height. - * By default, this will be in points; but this method accepts a unit of measure - * argument, and will convert the value to the specified UoM. + * By default, this will be in points; but this method also accepts an optional unit of measure + * argument, and will convert the value from points to the specified UoM. + * A value of -1 tells Excel to display this column in its default height. * * @return float */ @@ -80,8 +81,8 @@ public function getRowHeight(?string $unitOfMeasure = null) /** * Set Row Height. * - * @param float $height in points - * By default, this will be the passed argument value; but this method accepts a unit of measure + * @param float $height in points. A value of -1 tells Excel to display this column in its default height. + * By default, this will be the passed argument value; but this method also accepts an optional unit of measure * argument, and will convert the passed argument value to points from the specified UoM * * @return $this diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table.php new file mode 100644 index 0000000..66839d4 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table.php @@ -0,0 +1,454 @@ +|string $range + * A simple string containing a Cell range like 'A1:E10' is permitted + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * @param string $name (e.g. Table1) + */ + public function __construct($range = '', string $name = '') + { + $this->setRange($range); + $this->setName($name); + $this->style = new TableStyle(); + } + + /** + * Get Table name. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Set Table name. + */ + public function setName(string $name): self + { + $name = trim($name); + + if (!empty($name)) { + if (strlen($name) === 1 && in_array($name, ['C', 'c', 'R', 'r'])) { + throw new PhpSpreadsheetException('The table name is invalid'); + } + if (strlen($name) > 255) { + throw new PhpSpreadsheetException('The table name cannot be longer than 255 characters'); + } + // Check for A1 or R1C1 cell reference notation + if ( + preg_match(Coordinate::A1_COORDINATE_REGEX, $name) || + preg_match('/^R\[?\-?[0-9]*\]?C\[?\-?[0-9]*\]?$/i', $name) + ) { + throw new PhpSpreadsheetException('The table name can\'t be the same as a cell reference'); + } + if (!preg_match('/^[\p{L}_\\\\]/iu', $name)) { + throw new PhpSpreadsheetException('The table name must begin a name with a letter, an underscore character (_), or a backslash (\)'); + } + if (!preg_match('/^[\p{L}_\\\\][\p{L}\p{M}0-9\._]+$/iu', $name)) { + throw new PhpSpreadsheetException('The table name contains invalid characters'); + } + } + + $this->name = $name; + + return $this; + } + + /** + * Get show Header Row. + */ + public function getShowHeaderRow(): bool + { + return $this->showHeaderRow; + } + + /** + * Set show Header Row. + */ + public function setShowHeaderRow(bool $showHeaderRow): self + { + $this->showHeaderRow = $showHeaderRow; + + return $this; + } + + /** + * Get show Totals Row. + */ + public function getShowTotalsRow(): bool + { + return $this->showTotalsRow; + } + + /** + * Set show Totals Row. + */ + public function setShowTotalsRow(bool $showTotalsRow): self + { + $this->showTotalsRow = $showTotalsRow; + + return $this; + } + + /** + * Get Table Range. + */ + public function getRange(): string + { + return $this->range; + } + + /** + * Set Table Cell Range. + * + * @param AddressRange|array|string $range + * A simple string containing a Cell range like 'A1:E10' is permitted + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + */ + public function setRange($range = ''): self + { + // extract coordinate + if ($range !== '') { + [, $range] = Worksheet::extractSheetTitle(Validations::validateCellRange($range), true); + } + if (empty($range)) { + // Discard all column rules + $this->columns = []; + $this->range = ''; + + return $this; + } + + if (strpos($range, ':') === false) { + throw new PhpSpreadsheetException('Table must be set on a range of cells.'); + } + + [$width, $height] = Coordinate::rangeDimension($range); + if ($width < 1 || $height < 2) { + throw new PhpSpreadsheetException('The table range must be at least 1 column and 2 rows'); + } + + $this->range = $range; + // Discard any column ruless that are no longer valid within this range + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + foreach ($this->columns as $key => $value) { + $colIndex = Coordinate::columnIndexFromString($key); + if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { + unset($this->columns[$key]); + } + } + + return $this; + } + + /** + * Set Table Cell Range to max row. + */ + public function setRangeToMaxRow(): self + { + if ($this->workSheet !== null) { + $thisrange = $this->range; + $range = preg_replace('/\\d+$/', (string) $this->workSheet->getHighestRow(), $thisrange) ?? ''; + if ($range !== $thisrange) { + $this->setRange($range); + } + } + + return $this; + } + + /** + * Get Table's Worksheet. + */ + public function getWorksheet(): ?Worksheet + { + return $this->workSheet; + } + + /** + * Set Table's Worksheet. + */ + public function setWorksheet(?Worksheet $worksheet = null): self + { + if ($this->name !== '' && $worksheet !== null) { + $spreadsheet = $worksheet->getParent(); + $tableName = StringHelper::strToUpper($this->name); + + foreach ($spreadsheet->getWorksheetIterator() as $sheet) { + foreach ($sheet->getTableCollection() as $table) { + if (StringHelper::strToUpper($table->getName()) === $tableName) { + throw new PhpSpreadsheetException("Workbook already contains a table named '{$this->name}'"); + } + } + } + } + + $this->workSheet = $worksheet; + + return $this; + } + + /** + * Get all Table Columns. + * + * @return Table\Column[] + */ + public function getColumns(): array + { + return $this->columns; + } + + /** + * Validate that the specified column is in the Table range. + * + * @param string $column Column name (e.g. A) + * + * @return int The column offset within the table range + */ + public function isColumnInRange(string $column): int + { + if (empty($this->range)) { + throw new PhpSpreadsheetException('No table range is defined.'); + } + + $columnIndex = Coordinate::columnIndexFromString($column); + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { + throw new PhpSpreadsheetException('Column is outside of current table range.'); + } + + return $columnIndex - $rangeStart[0]; + } + + /** + * Get a specified Table Column Offset within the defined Table range. + * + * @param string $column Column name (e.g. A) + * + * @return int The offset of the specified column within the table range + */ + public function getColumnOffset($column): int + { + return $this->isColumnInRange($column); + } + + /** + * Get a specified Table Column. + * + * @param string $column Column name (e.g. A) + */ + public function getColumn($column): Table\Column + { + $this->isColumnInRange($column); + + if (!isset($this->columns[$column])) { + $this->columns[$column] = new Table\Column($column, $this); + } + + return $this->columns[$column]; + } + + /** + * Get a specified Table Column by it's offset. + * + * @param int $columnOffset Column offset within range (starting from 0) + */ + public function getColumnByOffset($columnOffset): Table\Column + { + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + $pColumn = Coordinate::stringFromColumnIndex($rangeStart[0] + $columnOffset); + + return $this->getColumn($pColumn); + } + + /** + * Set Table. + * + * @param string|Table\Column $columnObjectOrString + * A simple string containing a Column ID like 'A' is permitted + */ + public function setColumn($columnObjectOrString): self + { + if ((is_string($columnObjectOrString)) && (!empty($columnObjectOrString))) { + $column = $columnObjectOrString; + } elseif (is_object($columnObjectOrString) && ($columnObjectOrString instanceof Table\Column)) { + $column = $columnObjectOrString->getColumnIndex(); + } else { + throw new PhpSpreadsheetException('Column is not within the table range.'); + } + $this->isColumnInRange($column); + + if (is_string($columnObjectOrString)) { + $this->columns[$columnObjectOrString] = new Table\Column($columnObjectOrString, $this); + } else { + $columnObjectOrString->setTable($this); + $this->columns[$column] = $columnObjectOrString; + } + ksort($this->columns); + + return $this; + } + + /** + * Clear a specified Table Column. + * + * @param string $column Column name (e.g. A) + */ + public function clearColumn($column): self + { + $this->isColumnInRange($column); + + if (isset($this->columns[$column])) { + unset($this->columns[$column]); + } + + return $this; + } + + /** + * Shift an Table Column Rule to a different column. + * + * Note: This method bypasses validation of the destination column to ensure it is within this Table range. + * Nor does it verify whether any column rule already exists at $toColumn, but will simply override any existing value. + * Use with caution. + * + * @param string $fromColumn Column name (e.g. A) + * @param string $toColumn Column name (e.g. B) + */ + public function shiftColumn($fromColumn, $toColumn): self + { + $fromColumn = strtoupper($fromColumn); + $toColumn = strtoupper($toColumn); + + if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) { + $this->columns[$fromColumn]->setTable(); + $this->columns[$fromColumn]->setColumnIndex($toColumn); + $this->columns[$toColumn] = $this->columns[$fromColumn]; + $this->columns[$toColumn]->setTable($this); + unset($this->columns[$fromColumn]); + + ksort($this->columns); + } + + return $this; + } + + /** + * Get table Style. + */ + public function getStyle(): Table\TableStyle + { + return $this->style; + } + + /** + * Set table Style. + */ + public function setStyle(TableStyle $style): self + { + $this->style = $style; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + if ($key === 'workSheet') { + // Detach from worksheet + $this->{$key} = null; + } else { + $this->{$key} = clone $value; + } + } elseif ((is_array($value)) && ($key === 'columns')) { + // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\Table objects + $this->{$key} = []; + foreach ($value as $k => $v) { + $this->{$key}[$k] = clone $v; + // attach the new cloned Column to this new cloned Table object + $this->{$key}[$k]->setTable($this); + } + } else { + $this->{$key} = $value; + } + } + } + + /** + * toString method replicates previous behavior by returning the range if object is + * referenced as a property of its worksheet. + */ + public function __toString() + { + return (string) $this->range; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/Column.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/Column.php new file mode 100644 index 0000000..a7c445f --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/Column.php @@ -0,0 +1,203 @@ +columnIndex = $column; + $this->table = $table; + } + + /** + * Get Table column index as string eg: 'A'. + */ + public function getColumnIndex(): string + { + return $this->columnIndex; + } + + /** + * Set Table column index as string eg: 'A'. + * + * @param string $column Column (e.g. A) + */ + public function setColumnIndex($column): self + { + // Uppercase coordinate + $column = strtoupper($column); + if ($this->table !== null) { + $this->table->isColumnInRange($column); + } + + $this->columnIndex = $column; + + return $this; + } + + /** + * Get show Filter Button. + */ + public function getShowFilterButton(): bool + { + return $this->showFilterButton; + } + + /** + * Set show Filter Button. + */ + public function setShowFilterButton(bool $showFilterButton): self + { + $this->showFilterButton = $showFilterButton; + + return $this; + } + + /** + * Get total Row Label. + */ + public function getTotalsRowLabel(): ?string + { + return $this->totalsRowLabel; + } + + /** + * Set total Row Label. + */ + public function setTotalsRowLabel(string $totalsRowLabel): self + { + $this->totalsRowLabel = $totalsRowLabel; + + return $this; + } + + /** + * Get total Row Function. + */ + public function getTotalsRowFunction(): ?string + { + return $this->totalsRowFunction; + } + + /** + * Set total Row Function. + */ + public function setTotalsRowFunction(string $totalsRowFunction): self + { + $this->totalsRowFunction = $totalsRowFunction; + + return $this; + } + + /** + * Get total Row Formula. + */ + public function getTotalsRowFormula(): ?string + { + return $this->totalsRowFormula; + } + + /** + * Set total Row Formula. + */ + public function setTotalsRowFormula(string $totalsRowFormula): self + { + $this->totalsRowFormula = $totalsRowFormula; + + return $this; + } + + /** + * Get column Formula. + */ + public function getColumnFormula(): ?string + { + return $this->columnFormula; + } + + /** + * Set column Formula. + */ + public function setColumnFormula(string $columnFormula): self + { + $this->columnFormula = $columnFormula; + + return $this; + } + + /** + * Get this Column's Table. + */ + public function getTable(): ?Table + { + return $this->table; + } + + /** + * Set this Column's Table. + */ + public function setTable(?Table $table = null): self + { + $this->table = $table; + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php new file mode 100644 index 0000000..78643c7 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Table/TableStyle.php @@ -0,0 +1,230 @@ +theme = $theme; + } + + /** + * Get theme. + */ + public function getTheme(): string + { + return $this->theme; + } + + /** + * Set theme. + */ + public function setTheme(string $theme): self + { + $this->theme = $theme; + + return $this; + } + + /** + * Get show First Column. + */ + public function getShowFirstColumn(): bool + { + return $this->showFirstColumn; + } + + /** + * Set show First Column. + */ + public function setShowFirstColumn(bool $showFirstColumn): self + { + $this->showFirstColumn = $showFirstColumn; + + return $this; + } + + /** + * Get show Last Column. + */ + public function getShowLastColumn(): bool + { + return $this->showLastColumn; + } + + /** + * Set show Last Column. + */ + public function setShowLastColumn(bool $showLastColumn): self + { + $this->showLastColumn = $showLastColumn; + + return $this; + } + + /** + * Get show Row Stripes. + */ + public function getShowRowStripes(): bool + { + return $this->showRowStripes; + } + + /** + * Set show Row Stripes. + */ + public function setShowRowStripes(bool $showRowStripes): self + { + $this->showRowStripes = $showRowStripes; + + return $this; + } + + /** + * Get show Column Stripes. + */ + public function getShowColumnStripes(): bool + { + return $this->showColumnStripes; + } + + /** + * Set show Column Stripes. + */ + public function setShowColumnStripes(bool $showColumnStripes): self + { + $this->showColumnStripes = $showColumnStripes; + + return $this; + } + + /** + * Get this Style's Table. + */ + public function getTable(): ?Table + { + return $this->table; + } + + /** + * Set this Style's Table. + */ + public function setTable(?Table $table = null): self + { + $this->table = $table; + + return $this; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Validations.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Validations.php new file mode 100644 index 0000000..b31b081 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Validations.php @@ -0,0 +1,100 @@ +|CellAddress|string $cellAddress Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + */ + public static function validateCellAddress($cellAddress): string + { + if (is_string($cellAddress)) { + [$worksheet, $address] = Worksheet::extractSheetTitle($cellAddress, true); +// if (!empty($worksheet) && $worksheet !== $this->getTitle()) { +// throw new Exception('Reference is not for this worksheet'); +// } + + return empty($worksheet) ? strtoupper($address) : $worksheet . '!' . strtoupper($address); + } + + if (is_array($cellAddress)) { + $cellAddress = CellAddress::fromColumnRowArray($cellAddress); + } + + return (string) $cellAddress; + } + + /** + * Validate a cell address or cell range. + * + * @param AddressRange|array|CellAddress|int|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12'; + * or as an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 12]), + * or as a CellAddress or AddressRange object. + */ + public static function validateCellOrCellRange($cellRange): string + { + if (is_string($cellRange) || is_numeric($cellRange)) { + $cellRange = (string) $cellRange; + // Convert a single column reference like 'A' to 'A:A' + $cellRange = (string) preg_replace('/^([A-Z]+)$/', '${1}:${1}', $cellRange); + // Convert a single row reference like '1' to '1:1' + $cellRange = (string) preg_replace('/^(\d+)$/', '${1}:${1}', $cellRange); + } elseif (is_object($cellRange) && $cellRange instanceof CellAddress) { + $cellRange = new CellRange($cellRange, $cellRange); + } + + return self::validateCellRange($cellRange); + } + + /** + * Validate a cell range. + * + * @param AddressRange|array|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12'; + * or as an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 12]), + * or as an AddressRange object. + */ + public static function validateCellRange($cellRange): string + { + if (is_string($cellRange)) { + [$worksheet, $addressRange] = Worksheet::extractSheetTitle($cellRange, true); + + // Convert Column ranges like 'A:C' to 'A1:C1048576' + $addressRange = (string) preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $addressRange); + // Convert Row ranges like '1:3' to 'A1:XFD3' + $addressRange = (string) preg_replace('/^(\\d+):(\\d+)$/', 'A${1}:XFD${2}', $addressRange); + + return empty($worksheet) ? strtoupper($addressRange) : $worksheet . '!' . strtoupper($addressRange); + } + + if (is_array($cellRange)) { + [$from, $to] = array_chunk($cellRange, 2); + $cellRange = new CellRange(CellAddress::fromColumnRowArray($from), CellAddress::fromColumnRowArray($to)); + } + + return (string) $cellRange; + } + + public static function definedNameToCoordinate(string $coordinate, Worksheet $worksheet): string + { + // Uppercase coordinate + $testCoordinate = strtoupper($coordinate); + // Eliminate leading equal sign + $testCoordinate = (string) preg_replace('/^=/', '', $coordinate); + $defined = $worksheet->getParent()->getDefinedName($testCoordinate, $worksheet); + if ($defined !== null) { + if ($defined->getWorksheet() === $worksheet && !$defined->isFormula()) { + $coordinate = (string) preg_replace('/^=/', '', $defined->getValue()); + } + } + + return $coordinate; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php index 24da07a..0baf6ec 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -4,7 +4,11 @@ use ArrayObject; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; +use PhpOffice\PhpSpreadsheet\Calculation\Functions; +use PhpOffice\PhpSpreadsheet\Cell\AddressRange; use PhpOffice\PhpSpreadsheet\Cell\Cell; +use PhpOffice\PhpSpreadsheet\Cell\CellAddress; +use PhpOffice\PhpSpreadsheet\Cell\CellRange; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Cell\DataValidation; @@ -107,6 +111,13 @@ class Worksheet implements IComparable */ private $chartCollection; + /** + * Collection of Table objects. + * + * @var ArrayObject + */ + private $tableCollection; + /** * Worksheet title. * @@ -371,7 +382,10 @@ public function __construct(?Spreadsheet $parent = null, $title = 'Worksheet') $this->defaultRowDimension = new RowDimension(null); // Default column dimension $this->defaultColumnDimension = new ColumnDimension(null); - $this->autoFilter = new AutoFilter(null, $this); + // AutoFilter + $this->autoFilter = new AutoFilter('', $this); + // Table collection + $this->tableCollection = new ArrayObject(); } /** @@ -567,6 +581,7 @@ public function addChart(Chart $chart, $chartIndex = null) $this->chartCollection[] = $chart; } else { // Insert the chart at the requested index + // @phpstan-ignore-next-line array_splice($this->chartCollection, $chartIndex, 0, [$chart]); } @@ -728,9 +743,19 @@ public function calculateColumnWidths() } } + $autoFilterRange = $autoFilterFirstRowRange = $this->autoFilter->getRange(); + if (!empty($autoFilterRange)) { + $autoFilterRangeBoundaries = Coordinate::rangeBoundaries($autoFilterRange); + $autoFilterFirstRowRange = (string) new CellRange( + CellAddress::fromColumnAndRow($autoFilterRangeBoundaries[0][0], $autoFilterRangeBoundaries[0][1]), + CellAddress::fromColumnAndRow($autoFilterRangeBoundaries[1][0], $autoFilterRangeBoundaries[0][1]) + ); + } + // loop through all cells in the worksheet foreach ($this->getCoordinates(false) as $coordinate) { $cell = $this->getCellOrNull($coordinate); + if ($cell !== null && isset($autoSizes[$this->cellCollection->getCurrentColumn()])) { //Determine if cell is in merge range $isMerged = isset($isMergeCell[$this->cellCollection->getCurrentCoordinate()]); @@ -747,13 +772,21 @@ public function calculateColumnWidths() } } - // Determine width if cell does not participate in a merge or does and is a value cell of 1-column wide range + // Determine width if cell is not part of a merge or does and is a value cell of 1-column wide range if (!$isMerged || $isMergedButProceed) { + // Determine if we need to make an adjustment for the first row in an AutoFilter range that + // has a column filter dropdown + $filterAdjustment = false; + if (!empty($autoFilterRange) && $cell->isInRange($autoFilterFirstRowRange)) { + $filterAdjustment = true; + } + // Calculated value // To formatted string $cellValue = NumberFormat::toFormattedString( $cell->getCalculatedValue(), - $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode() + $this->getParent()->getCellXfByIndex($cell->getXfIndex()) + ->getNumberFormat()->getFormatCode() ); if ($cellValue !== null && $cellValue !== '') { @@ -762,8 +795,10 @@ public function calculateColumnWidths() (float) Shared\Font::calculateColumnWidth( $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(), $cellValue, - $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(), - $this->getParent()->getDefaultStyle()->getFont() + $this->getParent()->getCellXfByIndex($cell->getXfIndex()) + ->getAlignment()->getTextRotation(), + $this->getParent()->getDefaultStyle()->getFont(), + $filterAdjustment ) ); } @@ -1042,7 +1077,7 @@ public function setProtection(Protection $protection) */ public function getHighestColumn($row = null) { - if (empty($row)) { + if ($row === null) { return Coordinate::stringFromColumnIndex($this->cachedHighestColumn); } @@ -1072,7 +1107,7 @@ public function getHighestDataColumn($row = null) */ public function getHighestRow($column = null) { - if ($column == null) { + if ($column === null) { return $this->cachedHighestRow; } @@ -1105,14 +1140,16 @@ public function getHighestRowAndColumn() /** * Set a cell value. * - * @param string $coordinate Coordinate of the cell, eg: 'A1' - * @param mixed $value Value of the cell + * @param array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * @param mixed $value Value for the cell * * @return $this */ public function setCellValue($coordinate, $value) { - $this->getCell($coordinate)->setValue($value); + $cellAddress = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); + $this->getCell($cellAddress)->setValue($value); return $this; } @@ -1120,6 +1157,10 @@ public function setCellValue($coordinate, $value) /** * Set a cell value by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the setCellValue() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @param mixed $value Value of the cell @@ -1128,7 +1169,7 @@ public function setCellValue($coordinate, $value) */ public function setCellValueByColumnAndRow($columnIndex, $row, $value) { - $this->getCellByColumnAndRow($columnIndex, $row)->setValue($value); + $this->getCell(Coordinate::stringFromColumnIndex($columnIndex) . $row)->setValue($value); return $this; } @@ -1136,7 +1177,8 @@ public function setCellValueByColumnAndRow($columnIndex, $row, $value) /** * Set a cell value. * - * @param string $coordinate Coordinate of the cell, eg: 'A1' + * @param array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. * @param mixed $value Value of the cell * @param string $dataType Explicit data type, see DataType::TYPE_* * @@ -1144,8 +1186,8 @@ public function setCellValueByColumnAndRow($columnIndex, $row, $value) */ public function setCellValueExplicit($coordinate, $value, $dataType) { - // Set value - $this->getCell($coordinate)->setValueExplicit($value, $dataType); + $cellAddress = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); + $this->getCell($cellAddress)->setValueExplicit($value, $dataType); return $this; } @@ -1153,6 +1195,10 @@ public function setCellValueExplicit($coordinate, $value, $dataType) /** * Set a cell value by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the setCellValueExplicit() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @param mixed $value Value of the cell @@ -1162,7 +1208,7 @@ public function setCellValueExplicit($coordinate, $value, $dataType) */ public function setCellValueExplicitByColumnAndRow($columnIndex, $row, $value, $dataType) { - $this->getCellByColumnAndRow($columnIndex, $row)->setValueExplicit($value, $dataType); + $this->getCell(Coordinate::stringFromColumnIndex($columnIndex) . $row)->setValueExplicit($value, $dataType); return $this; } @@ -1170,22 +1216,25 @@ public function setCellValueExplicitByColumnAndRow($columnIndex, $row, $value, $ /** * Get cell at a specific coordinate. * - * @param string $coordinate Coordinate of the cell, eg: 'A1' + * @param array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. * * @return Cell Cell that was found or created */ - public function getCell(string $coordinate): Cell + public function getCell($coordinate): Cell { + $cellAddress = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); + // Shortcut for increased performance for the vast majority of simple cases - if ($this->cellCollection->has($coordinate)) { + if ($this->cellCollection->has($cellAddress)) { /** @var Cell $cell */ - $cell = $this->cellCollection->get($coordinate); + $cell = $this->cellCollection->get($cellAddress); return $cell; } /** @var Worksheet $sheet */ - [$sheet, $finalCoordinate] = $this->getWorksheetAndCoordinate($coordinate); + [$sheet, $finalCoordinate] = $this->getWorksheetAndCoordinate($cellAddress); $cell = $sheet->cellCollection->get($finalCoordinate); return $cell ?? $sheet->createNewCell($finalCoordinate); @@ -1209,7 +1258,7 @@ private function getWorksheetAndCoordinate(string $coordinate): array $sheet = $this->parent->getSheetByName($worksheetReference[0]); $finalCoordinate = strtoupper($worksheetReference[1]); - if (!$sheet) { + if ($sheet === null) { throw new Exception('Sheet not found for name: ' . $worksheetReference[0]); } } elseif ( @@ -1220,16 +1269,17 @@ private function getWorksheetAndCoordinate(string $coordinate): array $namedRange = $this->validateNamedRange($coordinate, true); if ($namedRange !== null) { $sheet = $namedRange->getWorksheet(); - if (!$sheet) { + if ($sheet === null) { throw new Exception('Sheet not found for named range: ' . $namedRange->getName()); } + /** @phpstan-ignore-next-line */ $cellCoordinate = ltrim(substr($namedRange->getValue(), strrpos($namedRange->getValue(), '!')), '!'); $finalCoordinate = str_replace('$', '', $cellCoordinate); } } - if (!$sheet || !$finalCoordinate) { + if ($sheet === null || $finalCoordinate === null) { $sheet = $this; $finalCoordinate = strtoupper($coordinate); } @@ -1263,6 +1313,10 @@ private function getCellOrNull($coordinate): ?Cell /** * Get cell at a specific coordinate by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the getCell() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @@ -1270,18 +1324,7 @@ private function getCellOrNull($coordinate): ?Cell */ public function getCellByColumnAndRow($columnIndex, $row): Cell { - $columnLetter = Coordinate::stringFromColumnIndex($columnIndex); - $coordinate = $columnLetter . $row; - - if ($this->cellCollection->has($coordinate)) { - /** @var Cell $cell */ - $cell = $this->cellCollection->get($coordinate); - - return $cell; - } - - // Create new cell object, if required - return $this->createNewCell($coordinate); + return $this->getCell(Coordinate::stringFromColumnIndex($columnIndex) . $row); } /** @@ -1291,7 +1334,7 @@ public function getCellByColumnAndRow($columnIndex, $row): Cell * * @return Cell Cell that was created */ - private function createNewCell($coordinate) + public function createNewCell($coordinate) { $cell = new Cell(null, DataType::TYPE_NULL, $this); $this->cellCollection->add($coordinate, $cell); @@ -1326,14 +1369,14 @@ private function createNewCell($coordinate) /** * Does the cell at a specific coordinate exist? * - * @param string $coordinate Coordinate of the cell eg: 'A1' - * - * @return bool + * @param array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. */ - public function cellExists($coordinate) + public function cellExists($coordinate): bool { + $cellAddress = Validations::validateCellAddress($coordinate); /** @var Worksheet $sheet */ - [$sheet, $finalCoordinate] = $this->getWorksheetAndCoordinate($coordinate); + [$sheet, $finalCoordinate] = $this->getWorksheetAndCoordinate($cellAddress); return $sheet->cellCollection->has($finalCoordinate); } @@ -1341,12 +1384,14 @@ public function cellExists($coordinate) /** * Cell at a specific coordinate by using numeric cell coordinates exists? * + * @Deprecated 1.23.0 + * Use the cellExists() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell - * - * @return bool */ - public function cellExistsByColumnAndRow($columnIndex, $row) + public function cellExistsByColumnAndRow($columnIndex, $row): bool { return $this->cellExists(Coordinate::stringFromColumnIndex($columnIndex) . $row); } @@ -1414,12 +1459,15 @@ public function getStyles() /** * Get style for cell. * - * @param string $cellCoordinate Cell coordinate (or range) to get style for, eg: 'A1' - * - * @return Style + * @param AddressRange|array|CellAddress|int|string $cellCoordinate + * A simple string containing a cell address like 'A1' or a cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or a CellAddress or AddressRange object. */ - public function getStyle($cellCoordinate) + public function getStyle($cellCoordinate): Style { + $cellCoordinate = Validations::validateCellOrCellRange($cellCoordinate); + // set this sheet as active $this->parent->setActiveSheetIndex($this->parent->getIndex($this)); @@ -1429,33 +1477,100 @@ public function getStyle($cellCoordinate) return $this->parent->getCellXfSupervisor(); } + /** + * Get style for cell by using numeric cell coordinates. + * + * @Deprecated 1.23.0 + * Use the getStyle() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * + * @param int $columnIndex1 Numeric column coordinate of the cell + * @param int $row1 Numeric row coordinate of the cell + * @param null|int $columnIndex2 Numeric column coordinate of the range cell + * @param null|int $row2 Numeric row coordinate of the range cell + * + * @return Style + */ + public function getStyleByColumnAndRow($columnIndex1, $row1, $columnIndex2 = null, $row2 = null) + { + if ($columnIndex2 !== null && $row2 !== null) { + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) + ); + + return $this->getStyle($cellRange); + } + + return $this->getStyle(CellAddress::fromColumnAndRow($columnIndex1, $row1)); + } + /** * Get conditional styles for a cell. * - * @param string $coordinate eg: 'A1' + * @param string $coordinate eg: 'A1' or 'A1:A3'. + * If a single cell is referenced, then the array of conditional styles will be returned if the cell is + * included in a conditional style range. + * If a range of cells is specified, then the styles will only be returned if the range matches the entire + * range of the conditional. * * @return Conditional[] */ - public function getConditionalStyles($coordinate) + public function getConditionalStyles(string $coordinate): array + { + $coordinate = strtoupper($coordinate); + if (strpos($coordinate, ':') !== false) { + return $this->conditionalStylesCollection[$coordinate] ?? []; + } + + $cell = $this->getCell($coordinate); + foreach (array_keys($this->conditionalStylesCollection) as $conditionalRange) { + if ($cell->isInRange($conditionalRange)) { + return $this->conditionalStylesCollection[$conditionalRange]; + } + } + + return []; + } + + public function getConditionalRange(string $coordinate): ?string { $coordinate = strtoupper($coordinate); - if (!isset($this->conditionalStylesCollection[$coordinate])) { - $this->conditionalStylesCollection[$coordinate] = []; + $cell = $this->getCell($coordinate); + foreach (array_keys($this->conditionalStylesCollection) as $conditionalRange) { + if ($cell->isInRange($conditionalRange)) { + return $conditionalRange; + } } - return $this->conditionalStylesCollection[$coordinate]; + return null; } /** * Do conditional styles exist for this cell? * - * @param string $coordinate eg: 'A1' - * - * @return bool + * @param string $coordinate eg: 'A1' or 'A1:A3'. + * If a single cell is specified, then this method will return true if that cell is included in a + * conditional style range. + * If a range of cells is specified, then true will only be returned if the range matches the entire + * range of the conditional. */ - public function conditionalStylesExists($coordinate) + public function conditionalStylesExists($coordinate): bool { - return isset($this->conditionalStylesCollection[strtoupper($coordinate)]); + $coordinate = strtoupper($coordinate); + if (strpos($coordinate, ':') !== false) { + return isset($this->conditionalStylesCollection[$coordinate]); + } + + $cell = $this->getCell($coordinate); + foreach (array_keys($this->conditionalStylesCollection) as $conditionalRange) { + if ($cell->isInRange($conditionalRange)) { + return true; + } + } + + return false; } /** @@ -1497,27 +1612,6 @@ public function setConditionalStyles($coordinate, $styles) return $this; } - /** - * Get style for cell by using numeric cell coordinates. - * - * @param int $columnIndex1 Numeric column coordinate of the cell - * @param int $row1 Numeric row coordinate of the cell - * @param null|int $columnIndex2 Numeric column coordinate of the range cell - * @param null|int $row2 Numeric row coordinate of the range cell - * - * @return Style - */ - public function getStyleByColumnAndRow($columnIndex1, $row1, $columnIndex2 = null, $row2 = null) - { - if ($columnIndex2 !== null && $row2 !== null) { - $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; - - return $this->getStyle($cellRange); - } - - return $this->getStyle(Coordinate::stringFromColumnIndex($columnIndex1) . $row1); - } - /** * Duplicate cell style to a range of cells. * @@ -1602,26 +1696,22 @@ public function duplicateConditionalStyle(array $styles, $range = '') /** * Set break on a cell. * - * @param string $coordinate Cell coordinate (e.g. A1) + * @param array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. * @param int $break Break type (type of Worksheet::BREAK_*) * * @return $this */ public function setBreak($coordinate, $break) { - // Uppercase coordinate - $coordinate = strtoupper($coordinate); + $cellAddress = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); - if ($coordinate != '') { - if ($break == self::BREAK_NONE) { - if (isset($this->breaks[$coordinate])) { - unset($this->breaks[$coordinate]); - } - } else { - $this->breaks[$coordinate] = $break; + if ($break === self::BREAK_NONE) { + if (isset($this->breaks[$cellAddress])) { + unset($this->breaks[$cellAddress]); } } else { - throw new Exception('No cell coordinate specified.'); + $this->breaks[$cellAddress] = $break; } return $this; @@ -1630,6 +1720,10 @@ public function setBreak($coordinate, $break) /** * Set break on a cell by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the setBreak() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @param int $break Break type (type of Worksheet::BREAK_*) @@ -1654,35 +1748,38 @@ public function getBreaks() /** * Set merge on a cell range. * - * @param string $range Cell range (e.g. A1:E1) + * @param AddressRange|array|string $range A simple string containing a Cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange. * * @return $this */ public function mergeCells($range) { - // Uppercase coordinate - $range = strtoupper($range); + $range = Functions::trimSheetFromCellReference(Validations::validateCellRange($range)); - if (strpos($range, ':') !== false) { + if (preg_match('/^([A-Z]+)(\\d+):([A-Z]+)(\\d+)$/', $range, $matches) === 1) { $this->mergeCells[$range] = $range; - - // make sure cells are created - - // get the cells in the range - $aReferences = Coordinate::extractAllCellReferencesInRange($range); + $firstRow = (int) $matches[2]; + $lastRow = (int) $matches[4]; + $firstColumn = $matches[1]; + $lastColumn = $matches[3]; + $firstColumnIndex = Coordinate::columnIndexFromString($firstColumn); + $lastColumnIndex = Coordinate::columnIndexFromString($lastColumn); + $numberRows = $lastRow - $firstRow; + $numberColumns = $lastColumnIndex - $firstColumnIndex; // create upper left cell if it does not already exist - $upperLeft = $aReferences[0]; + $upperLeft = "{$firstColumn}{$firstRow}"; if (!$this->cellExists($upperLeft)) { $this->getCell($upperLeft)->setValueExplicit(null, DataType::TYPE_NULL); } // Blank out the rest of the cells in the range (if they exist) - $count = count($aReferences); - for ($i = 1; $i < $count; ++$i) { - if ($this->cellExists($aReferences[$i])) { - $this->getCell($aReferences[$i])->setValueExplicit(null, DataType::TYPE_NULL); - } + if ($numberRows > $numberColumns) { + $this->clearMergeCellsByColumn($firstColumn, $lastColumn, $firstRow, $lastRow, $upperLeft); + } else { + $this->clearMergeCellsByRow($firstColumn, $lastColumnIndex, $firstRow, $lastRow, $upperLeft); } } else { throw new Exception('Merge must be set on a range of cells.'); @@ -1691,9 +1788,55 @@ public function mergeCells($range) return $this; } + private function clearMergeCellsByColumn(string $firstColumn, string $lastColumn, int $firstRow, int $lastRow, string $upperLeft): void + { + foreach ($this->getColumnIterator($firstColumn, $lastColumn) as $column) { + $iterator = $column->getCellIterator($firstRow); + $iterator->setIterateOnlyExistingCells(true); + foreach ($iterator as $cell) { + if ($cell !== null) { + $row = $cell->getRow(); + if ($row > $lastRow) { + break; + } + $thisCell = $cell->getColumn() . $row; + if ($upperLeft !== $thisCell) { + $cell->setValueExplicit(null, DataType::TYPE_NULL); + } + } + } + } + } + + private function clearMergeCellsByRow(string $firstColumn, int $lastColumnIndex, int $firstRow, int $lastRow, string $upperLeft): void + { + foreach ($this->getRowIterator($firstRow, $lastRow) as $row) { + $iterator = $row->getCellIterator($firstColumn); + $iterator->setIterateOnlyExistingCells(true); + foreach ($iterator as $cell) { + if ($cell !== null) { + $column = $cell->getColumn(); + $columnIndex = Coordinate::columnIndexFromString($column); + if ($columnIndex > $lastColumnIndex) { + break; + } + $thisCell = $column . $cell->getRow(); + if ($upperLeft !== $thisCell) { + $cell->setValueExplicit(null, DataType::TYPE_NULL); + } + } + } + } + } + /** * Set merge on a cell range by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the mergeCells() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * * @param int $columnIndex1 Numeric column coordinate of the first cell * @param int $row1 Numeric row coordinate of the first cell * @param int $columnIndex2 Numeric column coordinate of the last cell @@ -1703,7 +1846,10 @@ public function mergeCells($range) */ public function mergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) { - $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) + ); return $this->mergeCells($cellRange); } @@ -1711,14 +1857,15 @@ public function mergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $r /** * Remove merge on a cell range. * - * @param string $range Cell range (e.g. A1:E1) + * @param AddressRange|array|string $range A simple string containing a Cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange. * * @return $this */ public function unmergeCells($range) { - // Uppercase coordinate - $range = strtoupper($range); + $range = Functions::trimSheetFromCellReference(Validations::validateCellRange($range)); if (strpos($range, ':') !== false) { if (isset($this->mergeCells[$range])) { @@ -1736,6 +1883,11 @@ public function unmergeCells($range) /** * Remove merge on a cell range by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the unmergeCells() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * * @param int $columnIndex1 Numeric column coordinate of the first cell * @param int $row1 Numeric row coordinate of the first cell * @param int $columnIndex2 Numeric column coordinate of the last cell @@ -1745,7 +1897,10 @@ public function unmergeCells($range) */ public function unmergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) { - $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) + ); return $this->unmergeCells($cellRange); } @@ -1776,9 +1931,11 @@ public function setMergeCells(array $mergeCells) } /** - * Set protection on a cell range. + * Set protection on a cell or cell range. * - * @param string $range Cell (e.g. A1) or cell range (e.g. A1:E1) + * @param AddressRange|array|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or a CellAddress or AddressRange object. * @param string $password Password to unlock the protection * @param bool $alreadyHashed If the password has already been hashed, set this to true * @@ -1786,8 +1943,7 @@ public function setMergeCells(array $mergeCells) */ public function protectCells($range, $password, $alreadyHashed = false) { - // Uppercase coordinate - $range = strtoupper($range); + $range = Functions::trimSheetFromCellReference(Validations::validateCellOrCellRange($range)); if (!$alreadyHashed) { $password = Shared\PasswordHasher::hashPassword($password); @@ -1800,6 +1956,11 @@ public function protectCells($range, $password, $alreadyHashed = false) /** * Set protection on a cell range by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the protectCells() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * * @param int $columnIndex1 Numeric column coordinate of the first cell * @param int $row1 Numeric row coordinate of the first cell * @param int $columnIndex2 Numeric column coordinate of the last cell @@ -1811,22 +1972,26 @@ public function protectCells($range, $password, $alreadyHashed = false) */ public function protectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2, $password, $alreadyHashed = false) { - $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) + ); return $this->protectCells($cellRange, $password, $alreadyHashed); } /** - * Remove protection on a cell range. + * Remove protection on a cell or cell range. * - * @param string $range Cell (e.g. A1) or cell range (e.g. A1:E1) + * @param AddressRange|array|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or a CellAddress or AddressRange object. * * @return $this */ public function unprotectCells($range) { - // Uppercase coordinate - $range = strtoupper($range); + $range = Functions::trimSheetFromCellReference(Validations::validateCellOrCellRange($range)); if (isset($this->protectedCells[$range])) { unset($this->protectedCells[$range]); @@ -1840,6 +2005,11 @@ public function unprotectCells($range) /** * Remove protection on a cell range by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the protectCells() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object. + * * @param int $columnIndex1 Numeric column coordinate of the first cell * @param int $row1 Numeric row coordinate of the first cell * @param int $columnIndex2 Numeric column coordinate of the last cell @@ -1849,7 +2019,10 @@ public function unprotectCells($range) */ public function unprotectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) { - $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) + ); return $this->unprotectCells($cellRange); } @@ -1877,17 +2050,21 @@ public function getAutoFilter() /** * Set AutoFilter. * - * @param AutoFilter|string $autoFilterOrRange + * @param AddressRange|array|AutoFilter|string $autoFilterOrRange * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange. * * @return $this */ public function setAutoFilter($autoFilterOrRange) { - if (is_string($autoFilterOrRange)) { - $this->autoFilter->setRange($autoFilterOrRange); - } elseif (is_object($autoFilterOrRange) && ($autoFilterOrRange instanceof AutoFilter)) { + if (is_object($autoFilterOrRange) && ($autoFilterOrRange instanceof AutoFilter)) { $this->autoFilter = $autoFilterOrRange; + } else { + $cellRange = Functions::trimSheetFromCellReference(Validations::validateCellRange($autoFilterOrRange)); + + $this->autoFilter->setRange($cellRange); } return $this; @@ -1896,6 +2073,11 @@ public function setAutoFilter($autoFilterOrRange) /** * Set Autofilter Range by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the setAutoFilter() method with a cell address range such as 'C5:F8' instead;, + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or an AddressRange object or AutoFilter object. + * * @param int $columnIndex1 Numeric column coordinate of the first cell * @param int $row1 Numeric row coordinate of the first cell * @param int $columnIndex2 Numeric column coordinate of the second cell @@ -1905,21 +2087,72 @@ public function setAutoFilter($autoFilterOrRange) */ public function setAutoFilterByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) { - return $this->setAutoFilter( - Coordinate::stringFromColumnIndex($columnIndex1) . $row1 - . ':' . - Coordinate::stringFromColumnIndex($columnIndex2) . $row2 + $cellRange = new CellRange( + CellAddress::fromColumnAndRow($columnIndex1, $row1), + CellAddress::fromColumnAndRow($columnIndex2, $row2) ); + + return $this->setAutoFilter($cellRange); } /** * Remove autofilter. + */ + public function removeAutoFilter(): self + { + $this->autoFilter->setRange(''); + + return $this; + } + + /** + * Get collection of Tables. + * + * @return ArrayObject + */ + public function getTableCollection() + { + return $this->tableCollection; + } + + /** + * Add Table. * * @return $this */ - public function removeAutoFilter() + public function addTable(Table $table): self { - $this->autoFilter->setRange(null); + $table->setWorksheet($this); + $this->tableCollection[] = $table; + + return $this; + } + + /** + * Remove Table by name. + * + * @param string $name Table name + * + * @return $this + */ + public function removeTableByName(string $name): self + { + $name = Shared\StringHelper::strToUpper($name); + foreach ($this->tableCollection as $key => $table) { + if (Shared\StringHelper::strToUpper($table->getName()) === $name) { + unset($this->tableCollection[$key]); + } + } + + return $this; + } + + /** + * Remove collection of Tables. + */ + public function removeTableCollection(): self + { + $this->tableCollection = new ArrayObject(); return $this; } @@ -1943,23 +2176,33 @@ public function getFreezePane() * - B1 will freeze the columns to the left of cell B1 (i.e column A) * - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A) * - * @param null|string $cell Position of the split - * @param null|string $topLeftCell default position of the right bottom pane + * @param null|array|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * Passing a null value for this argument will clear any existing freeze pane for this worksheet. + * @param null|array|CellAddress|string $topLeftCell default position of the right bottom pane + * Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), + * or a CellAddress object. * * @return $this */ - public function freezePane($cell, $topLeftCell = null) + public function freezePane($coordinate, $topLeftCell = null) { - if (is_string($cell) && Coordinate::coordinateIsRange($cell)) { + $cellAddress = ($coordinate !== null) + ? Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)) + : null; + if ($cellAddress !== null && Coordinate::coordinateIsRange($cellAddress)) { throw new Exception('Freeze pane can not be set on a range of cells.'); } + $topLeftCell = ($topLeftCell !== null) + ? Functions::trimSheetFromCellReference(Validations::validateCellAddress($topLeftCell)) + : null; - if ($cell !== null && $topLeftCell === null) { - $coordinate = Coordinate::coordinateFromString($cell); + if ($cellAddress !== null && $topLeftCell === null) { + $coordinate = Coordinate::coordinateFromString($cellAddress); $topLeftCell = $coordinate[0] . $coordinate[1]; } - $this->freezePane = $cell; + $this->freezePane = $cellAddress; $this->topLeftCell = $topLeftCell; return $this; @@ -1975,6 +2218,10 @@ public function setTopLeftCell(string $topLeftCell): self /** * Freeze Pane by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the freezePane() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @@ -2076,6 +2323,7 @@ public function removeRow($row, $numberOfRows = 1) throw new Exception('Rows to be deleted should at least start from row 1.'); } + $holdRowDimensions = $this->removeRowDimensions($row, $numberOfRows); $highestRow = $this->getHighestDataRow(); $removedRowsCounter = 0; @@ -2093,9 +2341,30 @@ public function removeRow($row, $numberOfRows = 1) --$highestRow; } + $this->rowDimensions = $holdRowDimensions; + return $this; } + private function removeRowDimensions(int $row, int $numberOfRows): array + { + $highRow = $row + $numberOfRows - 1; + $holdRowDimensions = []; + foreach ($this->rowDimensions as $rowDimension) { + $num = $rowDimension->getRowIndex(); + if ($num < $row) { + $holdRowDimensions[$num] = $rowDimension; + } elseif ($num > $highRow) { + $num -= $numberOfRows; + $cloneDimension = clone $rowDimension; + $cloneDimension->setRowIndex($num); + $holdRowDimensions[$num] = $cloneDimension; + } + } + + return $holdRowDimensions; + } + /** * Remove a column, updating all possible related data. * @@ -2114,14 +2383,18 @@ public function removeColumn($column, $numberOfColumns = 1) $highestColumnIndex = Coordinate::columnIndexFromString($highestColumn); $pColumnIndex = Coordinate::columnIndexFromString($column); - if ($pColumnIndex > $highestColumnIndex) { - return $this; - } + $holdColumnDimensions = $this->removeColumnDimensions($pColumnIndex, $numberOfColumns); $column = Coordinate::stringFromColumnIndex($pColumnIndex + $numberOfColumns); $objReferenceHelper = ReferenceHelper::getInstance(); $objReferenceHelper->insertNewBefore($column . '1', -$numberOfColumns, 0, $this); + $this->columnDimensions = $holdColumnDimensions; + + if ($pColumnIndex > $highestColumnIndex) { + return $this; + } + $maxPossibleColumnsToBeRemoved = $highestColumnIndex - $pColumnIndex + 1; for ($c = 0, $n = min($maxPossibleColumnsToBeRemoved, $numberOfColumns); $c < $n; ++$c) { @@ -2134,6 +2407,26 @@ public function removeColumn($column, $numberOfColumns = 1) return $this; } + private function removeColumnDimensions(int $pColumnIndex, int $numberOfColumns): array + { + $highCol = $pColumnIndex + $numberOfColumns - 1; + $holdColumnDimensions = []; + foreach ($this->columnDimensions as $columnDimension) { + $num = $columnDimension->getColumnNumeric(); + if ($num < $pColumnIndex) { + $str = $columnDimension->getColumnIndex(); + $holdColumnDimensions[$str] = $columnDimension; + } elseif ($num > $highCol) { + $cloneDimension = clone $columnDimension; + $cloneDimension->setColumnNumeric($num - $numberOfColumns); + $str = $cloneDimension->getColumnIndex(); + $holdColumnDimensions[$str] = $cloneDimension; + } + } + + return $holdColumnDimensions; + } + /** * Remove a column, updating all possible related data. * @@ -2298,31 +2591,31 @@ public function setComments(array $comments) /** * Get comment for cell. * - * @param string $cellCoordinate Cell coordinate to get comment for, eg: 'A1' + * @param array|CellAddress|string $cellCoordinate Coordinate of the cell as a string, eg: 'C5'; + * or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. * * @return Comment */ public function getComment($cellCoordinate) { - // Uppercase coordinate - $cellCoordinate = strtoupper($cellCoordinate); + $cellAddress = Functions::trimSheetFromCellReference(Validations::validateCellAddress($cellCoordinate)); - if (Coordinate::coordinateIsRange($cellCoordinate)) { + if (Coordinate::coordinateIsRange($cellAddress)) { throw new Exception('Cell coordinate string can not be a range of cells.'); - } elseif (strpos($cellCoordinate, '$') !== false) { + } elseif (strpos($cellAddress, '$') !== false) { throw new Exception('Cell coordinate string must not be absolute.'); - } elseif ($cellCoordinate == '') { + } elseif ($cellAddress == '') { throw new Exception('Cell coordinate can not be zero-length string.'); } // Check if we already have a comment for this cell. - if (isset($this->comments[$cellCoordinate])) { - return $this->comments[$cellCoordinate]; + if (isset($this->comments[$cellAddress])) { + return $this->comments[$cellAddress]; } // If not, create a new comment. $newComment = new Comment(); - $this->comments[$cellCoordinate] = $newComment; + $this->comments[$cellAddress] = $newComment; return $newComment; } @@ -2330,6 +2623,10 @@ public function getComment($cellCoordinate) /** * Get comment for cell by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the getComment() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @@ -2372,64 +2669,21 @@ public function setSelectedCell($coordinate) return $this->setSelectedCells($coordinate); } - /** - * Sigh - Phpstan thinks, correctly, that preg_replace can return null. - * But Scrutinizer doesn't. Try to satisfy both. - * - * @param mixed $str - */ - private static function ensureString($str): string - { - return is_string($str) ? $str : ''; - } - - public static function pregReplace(string $pattern, string $replacement, string $subject): string - { - return self::ensureString(preg_replace($pattern, $replacement, $subject)); - } - - private function tryDefinedName(string $coordinate): string - { - // Uppercase coordinate - $coordinate = strtoupper($coordinate); - // Eliminate leading equal sign - $coordinate = self::pregReplace('/^=/', '', $coordinate); - $defined = $this->parent->getDefinedName($coordinate, $this); - if ($defined !== null) { - if ($defined->getWorksheet() === $this && !$defined->isFormula()) { - $coordinate = self::pregReplace('/^=/', '', $defined->getValue()); - } - } - - return $coordinate; - } - /** * Select a range of cells. * - * @param string $coordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' + * @param AddressRange|array|CellAddress|int|string $coordinate A simple string containing a Cell range like 'A1:E10' + * or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), + * or a CellAddress or AddressRange object. * * @return $this */ public function setSelectedCells($coordinate) { - $originalCoordinate = $coordinate; - $coordinate = $this->tryDefinedName($coordinate); - - // Convert 'A' to 'A:A' - $coordinate = self::pregReplace('/^([A-Z]+)$/', '${1}:${1}', $coordinate); - - // Convert '1' to '1:1' - $coordinate = self::pregReplace('/^(\d+)$/', '${1}:${1}', $coordinate); - - // Convert 'A:C' to 'A1:C1048576' - $coordinate = self::pregReplace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $coordinate); - - // Convert '1:3' to 'A1:XFD3' - $coordinate = self::pregReplace('/^(\d+):(\d+)$/', 'A${1}:XFD${2}', $coordinate); - if (preg_match('/^\\$?[A-Z]{1,3}\\$?\d{1,7}(:\\$?[A-Z]{1,3}\\$?\d{1,7})?$/', $coordinate) !== 1) { - throw new Exception("Invalid setSelectedCells $originalCoordinate $coordinate"); + if (is_string($coordinate)) { + $coordinate = Validations::definedNameToCoordinate($coordinate, $this); } + $coordinate = Validations::validateCellOrCellRange($coordinate); if (Coordinate::coordinateIsRange($coordinate)) { [$first] = Coordinate::splitRange($coordinate); @@ -2445,6 +2699,10 @@ public function setSelectedCells($coordinate) /** * Selected cell by using numeric cell coordinates. * + * @Deprecated 1.23.0 + * Use the setSelectedCells() method with a cell address such as 'C5' instead;, + * or passing in an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. + * * @param int $columnIndex Numeric column coordinate of the cell * @param int $row Numeric row coordinate of the cell * @@ -2640,6 +2898,7 @@ public function namedRangeToArray(string $definedName, $nullValue = null, $calcu { $namedRange = $this->validateNamedRange($definedName); $workSheet = $namedRange->getWorksheet(); + /** @phpstan-ignore-next-line */ $cellRange = ltrim(substr($namedRange->getValue(), strrpos($namedRange->getValue(), '!')), '!'); $cellRange = str_replace('$', '', $cellRange); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php index 7811a2a..7a3fa36 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php @@ -115,7 +115,7 @@ public function openFileHandle($filename): void return; } - $mode = 'wb+'; + $mode = 'wb'; $scheme = parse_url($filename, PHP_URL_SCHEME); if ($scheme === 's3') { $mode = 'w'; diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php index a59ea1f..629e3c0 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php @@ -291,10 +291,8 @@ private function mapBorderStyle($borderStyle) /** * Get sheet index. - * - * @return int */ - public function getSheetIndex() + public function getSheetIndex(): ?int { return $this->sheetIndex; } @@ -356,6 +354,8 @@ private static function generateMeta($val, $desc) : ''; } + public const BODY_LINE = ' ' . PHP_EOL; + /** * Generate HTML header. * @@ -386,7 +386,7 @@ public function generateHTMLHeader($includeStyles = false) $html .= ' ' . PHP_EOL; $html .= '' . PHP_EOL; - $html .= ' ' . PHP_EOL; + $html .= self::BODY_LINE; return $html; } @@ -697,10 +697,12 @@ private function writeImageInCell(Worksheet $worksheet, $coordinates) $imageResource = $drawing->getImageResource(); if ($imageResource) { ob_start(); // Let's start output buffering. + // @phpstan-ignore-next-line imagepng($imageResource); // This will normally output the image, but because of ob_start(), it won't. $contents = ob_get_contents(); // Instead, output above is saved to $contents ob_end_clean(); // End the output buffer. + /** @phpstan-ignore-next-line */ $dataUri = 'data:image/jpeg;base64,' . base64_encode($contents); // Because of the nature of tables, width is more important than height. @@ -748,7 +750,7 @@ private function writeChartInCell(Worksheet $worksheet, string $coordinates): st if ($fp = fopen($chartFileName, 'rb', 0)) { $picture = fread($fp, filesize($chartFileName)); fclose($fp); - // base64 encode the binary data + /** @phpstan-ignore-next-line */ $base64 = base64_encode($picture); $imageData = 'data:' . $imageDetails['mime'] . ';base64,' . $base64; @@ -1784,6 +1786,11 @@ private function writeComment(Worksheet $worksheet, $coordinate) return $result; } + public function getOrientation(): ?string + { + return null; + } + /** * Generate @page declarations. * @@ -1819,7 +1826,7 @@ private function generatePageDeclarations($generateSurroundingHTML) $htmlPage .= 'margin-top: ' . $top; $bottom = StringHelper::FormatNumber($worksheet->getPageMargins()->getBottom()) . 'in; '; $htmlPage .= 'margin-bottom: ' . $bottom; - $orientation = $worksheet->getPageSetup()->getOrientation(); + $orientation = $this->getOrientation() ?? $worksheet->getPageSetup()->getOrientation(); if ($orientation === \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) { $htmlPage .= 'size: landscape; '; } elseif ($orientation === \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT) { diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php index decd82b..827c43b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php @@ -132,10 +132,11 @@ public function save($filename, int $flags = 0): void $zip->addFile('META-INF/manifest.xml', $this->getWriterPartMetaInf()->write()); $zip->addFile('Thumbnails/thumbnail.png', $this->getWriterPartthumbnails()->write()); + // Settings always need to be written before Content; Styles after Content + $zip->addFile('settings.xml', $this->getWriterPartsettings()->write()); $zip->addFile('content.xml', $this->getWriterPartcontent()->write()); $zip->addFile('meta.xml', $this->getWriterPartmeta()->write()); $zip->addFile('mimetype', $this->getWriterPartmimetype()->write()); - $zip->addFile('settings.xml', $this->getWriterPartsettings()->write()); $zip->addFile('styles.xml', $this->getWriterPartstyles()->write()); // Close file diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php index f8aae20..a3629bd 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php @@ -2,15 +2,20 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell; +use PhpOffice\PhpSpreadsheet\Helper\Dimension; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\Style as CellStyle; +use PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension; +use PhpOffice\PhpSpreadsheet\Worksheet\RowDimension; class Style { public const CELL_STYLE_PREFIX = 'ce'; + public const COLUMN_STYLE_PREFIX = 'co'; + public const ROW_STYLE_PREFIX = 'ro'; private $writer; @@ -159,6 +164,63 @@ protected function writeTextProperties(CellStyle $style): void $this->writer->endElement(); // Close style:text-properties } + protected function writeColumnProperties(ColumnDimension $columnDimension): void + { + $this->writer->startElement('style:table-column-properties'); + $this->writer->writeAttribute( + 'style:column-width', + round($columnDimension->getWidth(Dimension::UOM_CENTIMETERS), 3) . 'cm' + ); + $this->writer->writeAttribute('fo:break-before', 'auto'); + + // End + $this->writer->endElement(); // Close style:table-column-properties + } + + public function writeColumnStyles(ColumnDimension $columnDimension, int $sheetId): void + { + $this->writer->startElement('style:style'); + $this->writer->writeAttribute('style:family', 'table-column'); + $this->writer->writeAttribute( + 'style:name', + sprintf('%s_%d_%d', self::COLUMN_STYLE_PREFIX, $sheetId, $columnDimension->getColumnNumeric()) + ); + + $this->writeColumnProperties($columnDimension); + + // End + $this->writer->endElement(); // Close style:style + } + + protected function writeRowProperties(RowDimension $rowDimension): void + { + $this->writer->startElement('style:table-row-properties'); + $this->writer->writeAttribute( + 'style:row-height', + round($rowDimension->getRowHeight(Dimension::UOM_CENTIMETERS), 3) . 'cm' + ); + $this->writer->writeAttribute('style:use-optimal-row-height', 'true'); + $this->writer->writeAttribute('fo:break-before', 'auto'); + + // End + $this->writer->endElement(); // Close style:table-row-properties + } + + public function writeRowStyles(RowDimension $rowDimension, int $sheetId): void + { + $this->writer->startElement('style:style'); + $this->writer->writeAttribute('style:family', 'table-row'); + $this->writer->writeAttribute( + 'style:name', + sprintf('%s_%d_%d', self::ROW_STYLE_PREFIX, $sheetId, $rowDimension->getRowIndex()) + ); + + $this->writeRowProperties($rowDimension); + + // End + $this->writer->endElement(); // Close style:style + } + public function write(CellStyle $style): void { $this->writer->startElement('style:style'); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php index a589e54..5d227c8 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -119,14 +119,21 @@ private function writeSheets(XMLWriter $objWriter): void { $spreadsheet = $this->getParentWriter()->getSpreadsheet(); /** @var Spreadsheet $spreadsheet */ $sheetCount = $spreadsheet->getSheetCount(); - for ($i = 0; $i < $sheetCount; ++$i) { + for ($sheetIndex = 0; $sheetIndex < $sheetCount; ++$sheetIndex) { $objWriter->startElement('table:table'); - $objWriter->writeAttribute('table:name', $spreadsheet->getSheet($i)->getTitle()); + $objWriter->writeAttribute('table:name', $spreadsheet->getSheet($sheetIndex)->getTitle()); $objWriter->writeElement('office:forms'); - $objWriter->startElement('table:table-column'); - $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); - $objWriter->endElement(); - $this->writeRows($objWriter, $spreadsheet->getSheet($i)); + foreach ($spreadsheet->getSheet($sheetIndex)->getColumnDimensions() as $columnDimension) { + $objWriter->startElement('table:table-column'); + $objWriter->writeAttribute( + 'table:style-name', + sprintf('%s_%d_%d', Style::COLUMN_STYLE_PREFIX, $sheetIndex, $columnDimension->getColumnNumeric()) + ); + $objWriter->writeAttribute('table:default-cell-style-name', 'ce0'); +// $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); + $objWriter->endElement(); + } + $this->writeRows($objWriter, $spreadsheet->getSheet($sheetIndex), $sheetIndex); $objWriter->endElement(); } } @@ -134,7 +141,7 @@ private function writeSheets(XMLWriter $objWriter): void /** * Write rows of the specified sheet. */ - private function writeRows(XMLWriter $objWriter, Worksheet $sheet): void + private function writeRows(XMLWriter $objWriter, Worksheet $sheet, int $sheetIndex): void { $numberRowsRepeated = self::NUMBER_ROWS_REPEATED_MAX; $span_row = 0; @@ -148,8 +155,14 @@ private function writeRows(XMLWriter $objWriter, Worksheet $sheet): void if ($span_row > 1) { $objWriter->writeAttribute('table:number-rows-repeated', $span_row); } + if ($sheet->getRowDimension($row->getRowIndex())->getRowHeight() > 0) { + $objWriter->writeAttribute( + 'table:style_name', + sprintf('%s_%d_%d', Style::ROW_STYLE_PREFIX, $sheetIndex, $row->getRowIndex()) + ); + } $objWriter->startElement('table:table-cell'); - $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); + $objWriter->writeAttribute('table:number-columns-repeated', (string) self::NUMBER_COLS_REPEATED_MAX); $objWriter->endElement(); $objWriter->endElement(); $span_row = 0; @@ -275,6 +288,26 @@ private function writeCellSpan(XMLWriter $objWriter, $curColumn, $prevColumn): v private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet): void { $styleWriter = new Style($writer); + + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $worksheet = $spreadsheet->getSheet($i); + $worksheet->calculateColumnWidths(); + foreach ($worksheet->getColumnDimensions() as $columnDimension) { + if ($columnDimension->getWidth() !== -1.0) { + $styleWriter->writeColumnStyles($columnDimension, $i); + } + } + } + for ($i = 0; $i < $sheetCount; ++$i) { + $worksheet = $spreadsheet->getSheet($i); + foreach ($worksheet->getRowDimensions() as $rowDimension) { + if ($rowDimension->getRowHeight() > 0.0) { + $styleWriter->writeRowStyles($rowDimension, $i); + } + } + } + foreach ($spreadsheet->getCellXfCollection() as $style) { $styleWriter->write($style); } @@ -296,7 +329,7 @@ private function writeCellMerge(XMLWriter $objWriter, Cell $cell): void $columnSpan = Coordinate::columnIndexFromString($end[0]) - Coordinate::columnIndexFromString($start[0]) + 1; $rowSpan = ((int) $end[1]) - ((int) $start[1]) + 1; - $objWriter->writeAttribute('table:number-columns-spanned', $columnSpan); - $objWriter->writeAttribute('table:number-rows-spanned', $rowSpan); + $objWriter->writeAttribute('table:number-columns-spanned', (string) $columnSpan); + $objWriter->writeAttribute('table:number-rows-spanned', (string) $rowSpan); } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php index 047bd41..0644559 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php @@ -2,8 +2,11 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; +use PhpOffice\PhpSpreadsheet\Cell\CellAddress; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; class Settings extends WriterPart { @@ -45,28 +48,9 @@ public function write(): string $objWriter->text('view1'); $objWriter->endElement(); // ViewId $objWriter->startElement('config:config-item-map-named'); - $objWriter->writeAttribute('config:name', 'Tables'); - foreach ($spreadsheet->getWorksheetIterator() as $ws) { - $objWriter->startElement('config:config-item-map-entry'); - $objWriter->writeAttribute('config:name', $ws->getTitle()); - $selected = $ws->getSelectedCells(); - if (preg_match('/^([a-z]+)([0-9]+)/i', $selected, $matches) === 1) { - $colSel = Coordinate::columnIndexFromString($matches[1]) - 1; - $rowSel = (int) $matches[2] - 1; - $objWriter->startElement('config:config-item'); - $objWriter->writeAttribute('config:name', 'CursorPositionX'); - $objWriter->writeAttribute('config:type', 'int'); - $objWriter->text($colSel); - $objWriter->endElement(); - $objWriter->startElement('config:config-item'); - $objWriter->writeAttribute('config:name', 'CursorPositionY'); - $objWriter->writeAttribute('config:type', 'int'); - $objWriter->text($rowSel); - $objWriter->endElement(); - } - $objWriter->endElement(); // config:config-item-map-entry - } - $objWriter->endElement(); // config:config-item-map-named + + $this->writeAllWorksheetSettings($objWriter, $spreadsheet); + $wstitle = $spreadsheet->getActiveSheet()->getTitle(); $objWriter->startElement('config:config-item'); $objWriter->writeAttribute('config:name', 'ActiveTable'); @@ -85,4 +69,84 @@ public function write(): string return $objWriter->getData(); } + + private function writeAllWorksheetSettings(XMLWriter $objWriter, Spreadsheet $spreadsheet): void + { + $objWriter->writeAttribute('config:name', 'Tables'); + + foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { + $this->writeWorksheetSettings($objWriter, $worksheet); + } + + $objWriter->endElement(); // config:config-item-map-entry Tables + } + + private function writeWorksheetSettings(XMLWriter $objWriter, Worksheet $worksheet): void + { + $objWriter->startElement('config:config-item-map-entry'); + $objWriter->writeAttribute('config:name', $worksheet->getTitle()); + + $this->writeSelectedCells($objWriter, $worksheet); + if ($worksheet->getFreezePane() !== null) { + $this->writeFreezePane($objWriter, $worksheet); + } + + $objWriter->endElement(); // config:config-item-map-entry Worksheet + } + + private function writeSelectedCells(XMLWriter $objWriter, Worksheet $worksheet): void + { + $selected = $worksheet->getSelectedCells(); + if (preg_match('/^([a-z]+)([0-9]+)/i', $selected, $matches) === 1) { + $colSel = Coordinate::columnIndexFromString($matches[1]) - 1; + $rowSel = (int) $matches[2] - 1; + $objWriter->startElement('config:config-item'); + $objWriter->writeAttribute('config:name', 'CursorPositionX'); + $objWriter->writeAttribute('config:type', 'int'); + $objWriter->text((string) $colSel); + $objWriter->endElement(); + $objWriter->startElement('config:config-item'); + $objWriter->writeAttribute('config:name', 'CursorPositionY'); + $objWriter->writeAttribute('config:type', 'int'); + $objWriter->text((string) $rowSel); + $objWriter->endElement(); + } + } + + private function writeSplitValue(XMLWriter $objWriter, string $splitMode, string $type, string $value): void + { + $objWriter->startElement('config:config-item'); + $objWriter->writeAttribute('config:name', $splitMode); + $objWriter->writeAttribute('config:type', $type); + $objWriter->text($value); + $objWriter->endElement(); + } + + private function writeFreezePane(XMLWriter $objWriter, Worksheet $worksheet): void + { + $freezePane = CellAddress::fromCellAddress($worksheet->getFreezePane()); + if ($freezePane->cellAddress() === 'A1') { + return; + } + + $columnId = $freezePane->columnId(); + $columnName = $freezePane->columnName(); + $row = $freezePane->rowId(); + + $this->writeSplitValue($objWriter, 'HorizontalSplitMode', 'short', '2'); + $this->writeSplitValue($objWriter, 'HorizontalSplitPosition', 'int', (string) ($columnId - 1)); + $this->writeSplitValue($objWriter, 'PositionLeft', 'short', '0'); + $this->writeSplitValue($objWriter, 'PositionRight', 'short', (string) ($columnId - 1)); + + for ($column = 'A'; $column !== $columnName; ++$column) { + $worksheet->getColumnDimension($column)->setAutoSize(true); + } + + $this->writeSplitValue($objWriter, 'VerticalSplitMode', 'short', '2'); + $this->writeSplitValue($objWriter, 'VerticalSplitPosition', 'int', (string) ($row - 1)); + $this->writeSplitValue($objWriter, 'PositionTop', 'short', '0'); + $this->writeSplitValue($objWriter, 'PositionBottom', 'short', (string) ($row - 1)); + + $this->writeSplitValue($objWriter, 'ActiveSplitRange', 'short', '3'); + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php index c419e1e..493bbba 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php @@ -26,14 +26,14 @@ abstract class Pdf extends Html /** * Orientation (Over-ride). * - * @var string + * @var ?string */ protected $orientation; /** * Paper size (Over-ride). * - * @var int + * @var ?int */ protected $paperSize; @@ -155,7 +155,7 @@ public function setFont($fontName) /** * Get Paper Size. * - * @return int + * @return ?int */ public function getPaperSize() { @@ -178,10 +178,8 @@ public function setPaperSize($paperSize) /** * Get Orientation. - * - * @return string */ - public function getOrientation() + public function getOrientation(): ?string { return $this->orientation; } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php index e49c22c..fc96f90 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php @@ -30,33 +30,14 @@ public function save($filename, int $flags = 0): void $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation - if ($this->getSheetIndex() === null) { - $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); - } else { - $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - } + $setup = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageSetup(); + $orientation = $this->getOrientation() ?? $setup->getOrientation(); + $orientation = ($orientation === PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->getPaperSize() ?? $setup->getPaperSize(); + $paperSize = self::$paperSizes[$printPaperSize] ?? PageSetup::getPaperSizeDefault(); $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; - // Override Page Orientation - if ($this->getOrientation() !== null) { - $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_DEFAULT) - ? PageSetup::ORIENTATION_PORTRAIT - : $this->getOrientation(); - } - // Override Paper Size - if ($this->getPaperSize() !== null) { - $printPaperSize = $this->getPaperSize(); - } - - if (isset(self::$paperSizes[$printPaperSize])) { - $paperSize = self::$paperSizes[$printPaperSize]; - } - // Create PDF $pdf = $this->createExternalWriterInstance(); $pdf->setPaper($paperSize, $orientation); @@ -65,7 +46,7 @@ public function save($filename, int $flags = 0): void $pdf->render(); // Write to file - fwrite($fileHandle, $pdf->output()); + fwrite($fileHandle, $pdf->output() ?? ''); parent::restoreStateAfterSave(); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php index 8d0eda9..281e1a4 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Pdf; use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; +use PhpOffice\PhpSpreadsheet\Writer\Html; use PhpOffice\PhpSpreadsheet\Writer\Pdf; class Mpdf extends Pdf @@ -28,37 +29,12 @@ public function save($filename, int $flags = 0): void { $fileHandle = parent::prepareForSave($filename); - // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) - // Check for paper size and page orientation - if (null === $this->getSheetIndex()) { - $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); - } else { - $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - } - $this->setOrientation($orientation); - - // Override Page Orientation - if (null !== $this->getOrientation()) { - $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_DEFAULT) - ? PageSetup::ORIENTATION_PORTRAIT - : $this->getOrientation(); - } - $orientation = strtoupper($orientation); - - // Override Paper Size - if (null !== $this->getPaperSize()) { - $printPaperSize = $this->getPaperSize(); - } - - if (isset(self::$paperSizes[$printPaperSize])) { - $paperSize = self::$paperSizes[$printPaperSize]; - } + $setup = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageSetup(); + $orientation = $this->getOrientation() ?? $setup->getOrientation(); + $orientation = ($orientation === PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->getPaperSize() ?? $setup->getPaperSize(); + $paperSize = self::$paperSizes[$printPaperSize] ?? PageSetup::getPaperSizeDefault(); // Create PDF $config = ['tempDir' => $this->tempDir . '/mpdf']; @@ -82,6 +58,14 @@ public function save($filename, int $flags = 0): void $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator()); $html = $this->generateHTMLAll(); + $bodyLocation = strpos($html, Html::BODY_LINE); + // Make sure first data presented to Mpdf includes body tag + // so that Mpdf doesn't parse it as content. Issue 2432. + if ($bodyLocation !== false) { + $bodyLocation += strlen(Html::BODY_LINE); + $pdf->WriteHTML(substr($html, 0, $bodyLocation)); + $html = substr($html, $bodyLocation); + } foreach (\array_chunk(\explode(PHP_EOL, $html), 1000) as $lines) { $pdf->WriteHTML(\implode(PHP_EOL, $lines)); } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php index 6ed16a5..d29d476 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php @@ -46,32 +46,12 @@ public function save($filename, int $flags = 0): void $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation - if ($this->getSheetIndex() === null) { - $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins(); - } else { - $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); - } - - // Override Page Orientation - if ($this->getOrientation() !== null) { - $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) - ? 'L' - : 'P'; - } - // Override Paper Size - if ($this->getPaperSize() !== null) { - $printPaperSize = $this->getPaperSize(); - } - - if (isset(self::$paperSizes[$printPaperSize])) { - $paperSize = self::$paperSizes[$printPaperSize]; - } + $setup = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageSetup(); + $orientation = $this->getOrientation() ?? $setup->getOrientation(); + $orientation = ($orientation === PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->getPaperSize() ?? $setup->getPaperSize(); + $paperSize = self::$paperSizes[$printPaperSize] ?? PageSetup::getPaperSizeDefault(); + $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex() ?? 0)->getPageMargins(); // Create PDF $pdf = $this->createExternalWriterInstance($orientation, 'pt', $paperSize); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php index d134d69..b91e385 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php @@ -434,6 +434,7 @@ private function processDrawing(BstoreContainer &$bstoreContainer, Drawing $draw case 1: // GIF, not supported by BIFF8, we convert to PNG $blipType = BSE::BLIPTYPE_PNG; ob_start(); + // @phpstan-ignore-next-line imagepng(imagecreatefromgif($filename)); $blipData = ob_get_contents(); ob_end_clean(); @@ -452,6 +453,7 @@ private function processDrawing(BstoreContainer &$bstoreContainer, Drawing $draw case 6: // Windows DIB (BMP), we convert to PNG $blipType = BSE::BLIPTYPE_PNG; ob_start(); + // @phpstan-ignore-next-line imagepng(SharedDrawing::imagecreatefrombmp($filename)); $blipData = ob_get_contents(); ob_end_clean(); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php new file mode 100644 index 0000000..0f78b8c --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php @@ -0,0 +1,76 @@ +parser = $parser; + } + + /** + * @param mixed $condition + */ + public function processCondition($condition, string $cellRange): void + { + $this->condition = $condition; + $this->cellRange = $cellRange; + + if (is_int($condition) || is_float($condition)) { + $this->size = ($condition <= 65535 ? 3 : 0x0000); + $this->tokens = pack('Cv', 0x1E, $condition); + } else { + try { + $formula = Wizard\WizardAbstract::reverseAdjustCellRef((string) $condition, $cellRange); + $this->parser->parse($formula); + $this->tokens = $this->parser->toReversePolish(); + $this->size = strlen($this->tokens ?? ''); + } catch (PhpSpreadsheetException $e) { + // In the event of a parser error with a formula value, we set the expression to ptgInt + 0 + $this->tokens = pack('Cv', 0x1E, 0); + $this->size = 3; + } + } + } + + public function tokens(): ?string + { + return $this->tokens; + } + + public function size(): int + { + return $this->size; + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index 77ec5de..796c214 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -54,6 +54,12 @@ // */ class Worksheet extends BIFFwriter { + /** @var int */ + private static $always0 = 0; + + /** @var int */ + private static $always1 = 1; + /** * Formula parser. * @@ -433,6 +439,7 @@ public function close(): void } else { switch ($cell->getDatatype()) { case DataType::TYPE_STRING: + case DataType::TYPE_INLINE: case DataType::TYPE_NULL: if ($cVal === '' || $cVal === null) { $this->writeBlank($row, $column, $xfIndex); @@ -538,37 +545,44 @@ public function close(): void $this->writeSheetProtection(); $this->writeRangeProtection(); - $arrConditionalStyles = $phpSheet->getConditionalStylesCollection(); + // Write Conditional Formatting Rules and Styles + $this->writeConditionalFormatting(); + + $this->storeEof(); + } + + private function writeConditionalFormatting(): void + { + $conditionalFormulaHelper = new ConditionalHelper($this->parser); + + $arrConditionalStyles = $this->phpSheet->getConditionalStylesCollection(); if (!empty($arrConditionalStyles)) { $arrConditional = []; - $cfHeaderWritten = false; // Write ConditionalFormattingTable records foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { + $cfHeaderWritten = false; foreach ($conditionalStyles as $conditional) { /** @var Conditional $conditional */ if ( - $conditional->getConditionType() == Conditional::CONDITION_EXPRESSION || - $conditional->getConditionType() == Conditional::CONDITION_CELLIS + $conditional->getConditionType() === Conditional::CONDITION_EXPRESSION || + $conditional->getConditionType() === Conditional::CONDITION_CELLIS ) { // Write CFHEADER record (only if there are Conditional Styles that we are able to write) if ($cfHeaderWritten === false) { - $this->writeCFHeader(); - $cfHeaderWritten = true; + $cfHeaderWritten = $this->writeCFHeader($cellCoordinate, $conditionalStyles); } - if (!isset($arrConditional[$conditional->getHashCode()])) { + if ($cfHeaderWritten === true && !isset($arrConditional[$conditional->getHashCode()])) { // This hash code has been handled $arrConditional[$conditional->getHashCode()] = true; // Write CFRULE record - $this->writeCFRule($conditional); + $this->writeCFRule($conditionalFormulaHelper, $conditional, $cellCoordinate); } } } } } - - $this->storeEof(); } /** @@ -988,6 +1002,8 @@ public function writeUrlWeb($row1, $col1, $row2, $col2, $url): void $options = pack('V', 0x03); // Convert URL to a null terminated wchar string + + /** @phpstan-ignore-next-line */ $url = implode("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY)); $url = $url . "\0\0\0"; @@ -2386,9 +2402,10 @@ public function processBitmapGd($image) $data = pack('Vvvvv', 0x000c, $width, $height, 0x01, 0x18); for ($j = $height; --$j;) { for ($i = 0; $i < $width; ++$i) { + /** @phpstan-ignore-next-line */ $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); foreach (['red', 'green', 'blue'] as $key) { - $color[$key] = $color[$key] + round((255 - $color[$key]) * $color['alpha'] / 127); + $color[$key] = $color[$key] + (int) round((255 - $color[$key]) * $color['alpha'] / 127); } $data .= chr($color['blue']) . chr($color['green']) . chr($color['red']); } @@ -2426,6 +2443,8 @@ public function processBitmap($bitmap) } // The first 2 bytes are used to identify the bitmap. + + /** @phpstan-ignore-next-line */ $identity = unpack('A2ident', $data); if ($identity['ident'] != 'BM') { throw new WriterException("$bitmap doesn't appear to be a valid bitmap image.\n"); @@ -2768,11 +2787,14 @@ private function writePageLayoutView(): void /** * Write CFRule Record. */ - private function writeCFRule(Conditional $conditional): void - { + private function writeCFRule( + ConditionalHelper $conditionalFormulaHelper, + Conditional $conditional, + string $cellRange + ): void { $record = 0x01B1; // Record identifier - $type = null; // Type of the CF - $operatorType = null; // Comparison operator + $type = null; // Type of the CF + $operatorType = null; // Comparison operator if ($conditional->getConditionType() == Conditional::CONDITION_EXPRESSION) { $type = 0x02; @@ -2821,21 +2843,23 @@ private function writeCFRule(Conditional $conditional): void // $szValue2 : size of the formula data for second value or formula $arrConditions = $conditional->getConditions(); $numConditions = count($arrConditions); - if ($numConditions == 1) { - $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); - $szValue2 = 0x0000; - $operand1 = pack('Cv', 0x1E, $arrConditions[0]); - $operand2 = null; - } elseif ($numConditions == 2 && ($conditional->getOperatorType() == Conditional::OPERATOR_BETWEEN)) { - $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); - $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); - $operand1 = pack('Cv', 0x1E, $arrConditions[0]); - $operand2 = pack('Cv', 0x1E, $arrConditions[1]); - } else { - $szValue1 = 0x0000; - $szValue2 = 0x0000; - $operand1 = null; - $operand2 = null; + + $szValue1 = 0x0000; + $szValue2 = 0x0000; + $operand1 = null; + $operand2 = null; + + if ($numConditions === 1) { + $conditionalFormulaHelper->processCondition($arrConditions[0], $cellRange); + $szValue1 = $conditionalFormulaHelper->size(); + $operand1 = $conditionalFormulaHelper->tokens(); + } elseif ($numConditions === 2 && ($conditional->getOperatorType() === Conditional::OPERATOR_BETWEEN)) { + $conditionalFormulaHelper->processCondition($arrConditions[0], $cellRange); + $szValue1 = $conditionalFormulaHelper->size(); + $operand1 = $conditionalFormulaHelper->tokens(); + $conditionalFormulaHelper->processCondition($arrConditions[1], $cellRange); + $szValue2 = $conditionalFormulaHelper->size(); + $operand2 = $conditionalFormulaHelper->tokens(); } // $flags : Option flags @@ -2905,11 +2929,11 @@ private function writeCFRule(Conditional $conditional): void $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); $flags |= (1 == $bTxRotation ? 0x00000008 : 0); // Justify last line flag - $flags |= (1 == 1 ? 0x00000010 : 0); + $flags |= (1 == self::$always1 ? 0x00000010 : 0); $flags |= (1 == $bIndent ? 0x00000020 : 0); $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); // Default - $flags |= (1 == 1 ? 0x00000080 : 0); + $flags |= (1 == self::$always1 ? 0x00000080 : 0); // Protection $flags |= (1 == $bProtLocked ? 0x00000100 : 0); $flags |= (1 == $bProtHidden ? 0x00000200 : 0); @@ -2918,13 +2942,13 @@ private function writeCFRule(Conditional $conditional): void $flags |= (1 == $bBorderRight ? 0x00000800 : 0); $flags |= (1 == $bBorderTop ? 0x00001000 : 0); $flags |= (1 == $bBorderBottom ? 0x00002000 : 0); - $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border - $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border + $flags |= (1 == self::$always1 ? 0x00004000 : 0); // Top left to Bottom right border + $flags |= (1 == self::$always1 ? 0x00008000 : 0); // Bottom left to Top right border // Pattern $flags |= (1 == $bFillStyle ? 0x00010000 : 0); $flags |= (1 == $bFillColor ? 0x00020000 : 0); $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); - $flags |= (1 == 1 ? 0x00380000 : 0); + $flags |= (1 == self::$always1 ? 0x00380000 : 0); // Font $flags |= (1 == $bFormatFont ? 0x04000000 : 0); // Alignment: @@ -2936,7 +2960,7 @@ private function writeCFRule(Conditional $conditional): void // Protection $flags |= (1 == $bFormatProt ? 0x40000000 : 0); // Text direction - $flags |= (1 == 0 ? 0x80000000 : 0); + $flags |= (1 == self::$always0 ? 0x80000000 : 0); $dataBlockFont = null; $dataBlockAlign = null; @@ -3022,10 +3046,10 @@ private function writeCFRule(Conditional $conditional): void $optionsFlags = 0; $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() === null ? 1 : 0); $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); - $optionsFlags |= (1 == 1 ? 0x00000008 : 0); - $optionsFlags |= (1 == 1 ? 0x00000010 : 0); - $optionsFlags |= (1 == 0 ? 0x00000020 : 0); - $optionsFlags |= (1 == 1 ? 0x00000080 : 0); + $optionsFlags |= (1 == self::$always1 ? 0x00000008 : 0); + $optionsFlags |= (1 == self::$always1 ? 0x00000010 : 0); + $optionsFlags |= (1 == self::$always0 ? 0x00000020 : 0); + $optionsFlags |= (1 == self::$always1 ? 0x00000080 : 0); $dataBlockFont .= pack('V', $optionsFlags); // Escapement type $dataBlockFont .= pack('V', $fontEscapement); @@ -3121,8 +3145,10 @@ private function writeCFRule(Conditional $conditional): void /** * Write CFHeader record. + * + * @param Conditional[] $conditionalStyles */ - private function writeCFHeader(): void + private function writeCFHeader(string $cellCoordinate, array $conditionalStyles): bool { $record = 0x01B0; // Record identifier $length = 0x0016; // Bytes to follow @@ -3131,33 +3157,32 @@ private function writeCFHeader(): void $numColumnMax = null; $numRowMin = null; $numRowMax = null; + $arrConditional = []; - foreach ($this->phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { - foreach ($conditionalStyles as $conditional) { - if ( - $conditional->getConditionType() == Conditional::CONDITION_EXPRESSION || - $conditional->getConditionType() == Conditional::CONDITION_CELLIS - ) { - if (!in_array($conditional->getHashCode(), $arrConditional)) { - $arrConditional[] = $conditional->getHashCode(); - } - // Cells - $rangeCoordinates = Coordinate::rangeBoundaries($cellCoordinate); - if ($numColumnMin === null || ($numColumnMin > $rangeCoordinates[0][0])) { - $numColumnMin = $rangeCoordinates[0][0]; - } - if ($numColumnMax === null || ($numColumnMax < $rangeCoordinates[1][0])) { - $numColumnMax = $rangeCoordinates[1][0]; - } - if ($numRowMin === null || ($numRowMin > $rangeCoordinates[0][1])) { - $numRowMin = (int) $rangeCoordinates[0][1]; - } - if ($numRowMax === null || ($numRowMax < $rangeCoordinates[1][1])) { - $numRowMax = (int) $rangeCoordinates[1][1]; - } - } + foreach ($conditionalStyles as $conditional) { + if (!in_array($conditional->getHashCode(), $arrConditional)) { + $arrConditional[] = $conditional->getHashCode(); + } + // Cells + $rangeCoordinates = Coordinate::rangeBoundaries($cellCoordinate); + if ($numColumnMin === null || ($numColumnMin > $rangeCoordinates[0][0])) { + $numColumnMin = $rangeCoordinates[0][0]; + } + if ($numColumnMax === null || ($numColumnMax < $rangeCoordinates[1][0])) { + $numColumnMax = $rangeCoordinates[1][0]; + } + if ($numRowMin === null || ($numRowMin > $rangeCoordinates[0][1])) { + $numRowMin = (int) $rangeCoordinates[0][1]; + } + if ($numRowMax === null || ($numRowMax < $rangeCoordinates[1][1])) { + $numRowMax = (int) $rangeCoordinates[1][1]; } } + + if (count($arrConditional) === 0) { + return false; + } + $needRedraw = 1; $cellRange = pack('vvvv', $numRowMin - 1, $numRowMax - 1, $numColumnMin - 1, $numColumnMax - 1); @@ -3167,6 +3192,8 @@ private function writeCFHeader(): void $data .= pack('v', 0x0001); $data .= $cellRange; $this->append($header . $data); + + return true; } private function getDataBlockProtection(Conditional $conditional): int diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php index 8bcdc53..5aca511 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php @@ -25,6 +25,7 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA; use PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable; use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Table; use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme; use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook; use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet; @@ -167,6 +168,11 @@ class Xlsx extends BaseWriter */ private $writerPartTheme; + /** + * @var Table + */ + private $writerPartTable; + /** * @var Workbook */ @@ -196,6 +202,7 @@ public function __construct(Spreadsheet $spreadsheet) $this->writerPartStringTable = new StringTable($this); $this->writerPartStyle = new Style($this); $this->writerPartTheme = new Theme($this); + $this->writerPartTable = new Table($this); $this->writerPartWorkbook = new Workbook($this); $this->writerPartWorksheet = new Worksheet($this); @@ -271,6 +278,11 @@ public function getWriterPartTheme(): Theme return $this->writerPartTheme; } + public function getWriterPartTable(): Table + { + return $this->writerPartTable; + } + public function getWriterPartWorkbook(): Workbook { return $this->writerPartWorkbook; @@ -389,10 +401,11 @@ public function save($filename, int $flags = 0): void } $chartRef1 = 0; + $tableRef1 = 1; // Add worksheet relationships (drawings, ...) for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) { // Add relationships - $zipContent['xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels'] = $this->getWriterPartRels()->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts); + $zipContent['xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels'] = $this->getWriterPartRels()->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts, $tableRef1); // Add unparsedLoadedData $sheetCodeName = $this->spreadSheet->getSheet($i)->getCodeName(); @@ -431,19 +444,31 @@ public function save($filename, int $flags = 0): void foreach ($unparsedLoadedData['sheets'][$sheetCodeName]['Drawings'] as $relId => $drawingXml) { $drawingFile = array_search($relId, $unparsedLoadedData['sheets'][$sheetCodeName]['drawingOriginalIds']); if ($drawingFile !== false) { - $drawingFile = ltrim($drawingFile, '.'); - $zipContent['xl' . $drawingFile] = $drawingXml; + //$drawingFile = ltrim($drawingFile, '.'); + //$zipContent['xl' . $drawingFile] = $drawingXml; + $zipContent['xl/drawings/drawing' . ($i + 1) . '.xml'] = $drawingXml; } } } // Add comment relationship parts if (count($this->spreadSheet->getSheet($i)->getComments()) > 0) { + // VML Comments relationships + $zipContent['xl/drawings/_rels/vmlDrawing' . ($i + 1) . '.vml.rels'] = $this->getWriterPartRels()->writeVMLDrawingRelationships($this->spreadSheet->getSheet($i)); + // VML Comments $zipContent['xl/drawings/vmlDrawing' . ($i + 1) . '.vml'] = $this->getWriterPartComments()->writeVMLComments($this->spreadSheet->getSheet($i)); // Comments $zipContent['xl/comments' . ($i + 1) . '.xml'] = $this->getWriterPartComments()->writeComments($this->spreadSheet->getSheet($i)); + + // Media + foreach ($this->spreadSheet->getSheet($i)->getComments() as $comment) { + if ($comment->hasBackgroundImage()) { + $image = $comment->getBackgroundImage(); + $zipContent['xl/media/' . $image->getMediaFilename()] = $this->processDrawing($image); + } + } } // Add unparsed relationship parts @@ -466,6 +491,12 @@ public function save($filename, int $flags = 0): void $zipContent['xl/media/' . $image->getIndexedFilename()] = file_get_contents($image->getPath()); } } + + // Add Table parts + $tables = $this->spreadSheet->getSheet($i)->getTableCollection(); + foreach ($tables as $table) { + $zipContent['xl/tables/table' . $tableRef1 . '.xml'] = $this->getWriterPartTable()->writeTable($table, $tableRef1++); + } } // Add media @@ -486,17 +517,19 @@ public function save($filename, int $flags = 0): void $imageContents = file_get_contents($imagePath); } - $zipContent['xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())] = $imageContents; + $zipContent['xl/media/' . $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()] = $imageContents; } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof MemoryDrawing) { ob_start(); + /** @var callable */ + $callable = $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(); call_user_func( - $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), + $callable, $this->getDrawingHashTable()->getByIndex($i)->getImageResource() ); $imageContents = ob_get_contents(); ob_end_clean(); - $zipContent['xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())] = $imageContents; + $zipContent['xl/media/' . $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()] = $imageContents; } } @@ -667,4 +700,52 @@ private function addZipFiles(array $zipContent): void $this->addZipFile($path, $content); } } + + /** + * @return mixed + */ + private function processDrawing(WorksheetDrawing $drawing) + { + $data = null; + $filename = $drawing->getPath(); + $imageData = getimagesize($filename); + + if (is_array($imageData)) { + switch ($imageData[2]) { + case 1: // GIF, not supported by BIFF8, we convert to PNG + $image = imagecreatefromgif($filename); + if ($image !== false) { + ob_start(); + imagepng($image); + $data = ob_get_contents(); + ob_end_clean(); + } + + break; + + case 2: // JPEG + $data = file_get_contents($filename); + + break; + + case 3: // PNG + $data = file_get_contents($filename); + + break; + + case 6: // Windows DIB (BMP), we convert to PNG + $image = imagecreatefrombmp($filename); + if ($image !== false) { + ob_start(); + imagepng($image); + $data = ob_get_contents(); + ob_end_clean(); + } + + break; + } + } + + return $data; + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php index 62e48f8..ea0f1fa 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -178,6 +178,12 @@ private function writeVMLComment(XMLWriter $objWriter, $cellReference, Comment $ // v:fill $objWriter->startElement('v:fill'); $objWriter->writeAttribute('color2', '#' . $comment->getFillColor()->getRGB()); + if ($comment->hasBackgroundImage()) { + $bgImage = $comment->getBackgroundImage(); + $objWriter->writeAttribute('o:relid', 'rId' . $bgImage->getImageIndex()); + $objWriter->writeAttribute('o:title', $bgImage->getName()); + $objWriter->writeAttribute('type', 'frame'); + } $objWriter->endElement(); // v:shadow diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php index bf0eb08..acb85b5 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php @@ -85,6 +85,16 @@ public function writeContentTypes(Spreadsheet $spreadsheet, $includeCharts = fal // Shared strings $this->writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'); + // Table + $table = 1; + for ($i = 0; $i < $sheetCount; ++$i) { + $tableCount = $spreadsheet->getSheet($i)->getTableCollection()->count(); + + for ($t = 1; $t <= $tableCount; ++$t) { + $this->writeOverrideContentType($objWriter, '/xl/tables/table' . $table++ . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml'); + } + } + // Add worksheet relationship content types $unparsedLoadedData = $spreadsheet->getUnparsedLoadedData(); $chart = 1; @@ -158,6 +168,23 @@ public function writeContentTypes(Spreadsheet $spreadsheet, $includeCharts = fal } } } + + if (count($spreadsheet->getSheet($i)->getComments()) > 0) { + foreach ($spreadsheet->getSheet($i)->getComments() as $comment) { + if (!$comment->hasBackgroundImage()) { + continue; + } + + $bgImage = $comment->getBackgroundImage(); + $bgImageExtentionKey = strtolower($bgImage->getImageFileExtensionForSave(false)); + + if (!isset($aMediaContentTypes[$bgImageExtentionKey])) { + $aMediaContentTypes[$bgImageExtentionKey] = $bgImage->getImageMimeType(); + + $this->writeDefaultContentType($objWriter, $bgImageExtentionKey, $aMediaContentTypes[$bgImageExtentionKey]); + } + } + } } // unparsed defaults diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php index fa77e2d..816bb9d 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -3,6 +3,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; +use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing; use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing; @@ -56,7 +57,10 @@ public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $wor // Loop through charts and write the chart position if ($chartCount > 0) { for ($c = 0; $c < $chartCount; ++$c) { - $this->writeChart($objWriter, $worksheet->getChartByIndex($c), $c + $i); + $chart = $worksheet->getChartByIndex((string) $c); + if ($chart !== false) { + $this->writeChart($objWriter, $chart, $c + $i); + } } } } @@ -90,16 +94,16 @@ public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart $objWriter->startElement('xdr:twoCellAnchor'); $objWriter->startElement('xdr:from'); - $objWriter->writeElement('xdr:col', $tlColRow[0] - 1); - $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($tl['xOffset'])); - $objWriter->writeElement('xdr:row', $tlColRow[1] - 1); - $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($tl['yOffset'])); + $objWriter->writeElement('xdr:col', (string) ($tlColRow[0] - 1)); + $objWriter->writeElement('xdr:colOff', self::stringEmu($tl['xOffset'])); + $objWriter->writeElement('xdr:row', (string) ($tlColRow[1] - 1)); + $objWriter->writeElement('xdr:rowOff', self::stringEmu($tl['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:to'); - $objWriter->writeElement('xdr:col', $brColRow[0] - 1); - $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($br['xOffset'])); - $objWriter->writeElement('xdr:row', $brColRow[1] - 1); - $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($br['yOffset'])); + $objWriter->writeElement('xdr:col', (string) ($brColRow[0] - 1)); + $objWriter->writeElement('xdr:colOff', self::stringEmu($br['xOffset'])); + $objWriter->writeElement('xdr:row', (string) ($brColRow[1] - 1)); + $objWriter->writeElement('xdr:rowOff', self::stringEmu($br['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:graphicFrame'); @@ -107,7 +111,7 @@ public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart $objWriter->startElement('xdr:nvGraphicFramePr'); $objWriter->startElement('xdr:cNvPr'); $objWriter->writeAttribute('name', 'Chart ' . $relationId); - $objWriter->writeAttribute('id', 1025 * $relationId); + $objWriter->writeAttribute('id', (string) (1025 * $relationId)); $objWriter->endElement(); $objWriter->startElement('xdr:cNvGraphicFramePr'); $objWriter->startElement('a:graphicFrameLocks'); @@ -153,24 +157,52 @@ public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart public function writeDrawing(XMLWriter $objWriter, BaseDrawing $drawing, $relationId = -1, $hlinkClickId = null): void { if ($relationId >= 0) { - // xdr:oneCellAnchor - $objWriter->startElement('xdr:oneCellAnchor'); - // Image location - $aCoordinates = Coordinate::indexesFromString($drawing->getCoordinates()); - - // xdr:from - $objWriter->startElement('xdr:from'); - $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1); - $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getOffsetX())); - $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1); - $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getOffsetY())); - $objWriter->endElement(); + $isTwoCellAnchor = $drawing->getCoordinates2() !== ''; + if ($isTwoCellAnchor) { + // xdr:twoCellAnchor + $objWriter->startElement('xdr:twoCellAnchor'); + if ($drawing->validEditAs()) { + $objWriter->writeAttribute('editAs', $drawing->getEditAs()); + } + // Image location + $aCoordinates = Coordinate::indexesFromString($drawing->getCoordinates()); + $aCoordinates2 = Coordinate::indexesFromString($drawing->getCoordinates2()); + + // xdr:from + $objWriter->startElement('xdr:from'); + $objWriter->writeElement('xdr:col', (string) ($aCoordinates[0] - 1)); + $objWriter->writeElement('xdr:colOff', self::stringEmu($drawing->getOffsetX())); + $objWriter->writeElement('xdr:row', (string) ($aCoordinates[1] - 1)); + $objWriter->writeElement('xdr:rowOff', self::stringEmu($drawing->getOffsetY())); + $objWriter->endElement(); - // xdr:ext - $objWriter->startElement('xdr:ext'); - $objWriter->writeAttribute('cx', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getWidth())); - $objWriter->writeAttribute('cy', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getHeight())); - $objWriter->endElement(); + // xdr:to + $objWriter->startElement('xdr:to'); + $objWriter->writeElement('xdr:col', (string) ($aCoordinates2[0] - 1)); + $objWriter->writeElement('xdr:colOff', self::stringEmu($drawing->getOffsetX2())); + $objWriter->writeElement('xdr:row', (string) ($aCoordinates2[1] - 1)); + $objWriter->writeElement('xdr:rowOff', self::stringEmu($drawing->getOffsetY2())); + $objWriter->endElement(); + } else { + // xdr:oneCellAnchor + $objWriter->startElement('xdr:oneCellAnchor'); + // Image location + $aCoordinates = Coordinate::indexesFromString($drawing->getCoordinates()); + + // xdr:from + $objWriter->startElement('xdr:from'); + $objWriter->writeElement('xdr:col', (string) ($aCoordinates[0] - 1)); + $objWriter->writeElement('xdr:colOff', self::stringEmu($drawing->getOffsetX())); + $objWriter->writeElement('xdr:row', (string) ($aCoordinates[1] - 1)); + $objWriter->writeElement('xdr:rowOff', self::stringEmu($drawing->getOffsetY())); + $objWriter->endElement(); + + // xdr:ext + $objWriter->startElement('xdr:ext'); + $objWriter->writeAttribute('cx', self::stringEmu($drawing->getWidth())); + $objWriter->writeAttribute('cy', self::stringEmu($drawing->getHeight())); + $objWriter->endElement(); + } // xdr:pic $objWriter->startElement('xdr:pic'); @@ -180,7 +212,7 @@ public function writeDrawing(XMLWriter $objWriter, BaseDrawing $drawing, $relati // xdr:cNvPr $objWriter->startElement('xdr:cNvPr'); - $objWriter->writeAttribute('id', $relationId); + $objWriter->writeAttribute('id', (string) $relationId); $objWriter->writeAttribute('name', $drawing->getName()); $objWriter->writeAttribute('descr', $drawing->getDescription()); @@ -222,7 +254,13 @@ public function writeDrawing(XMLWriter $objWriter, BaseDrawing $drawing, $relati // a:xfrm $objWriter->startElement('a:xfrm'); - $objWriter->writeAttribute('rot', \PhpOffice\PhpSpreadsheet\Shared\Drawing::degreesToAngle($drawing->getRotation())); + $objWriter->writeAttribute('rot', (string) SharedDrawing::degreesToAngle($drawing->getRotation())); + if ($isTwoCellAnchor) { + $objWriter->startElement('a:ext'); + $objWriter->writeAttribute('cx', self::stringEmu($drawing->getWidth())); + $objWriter->writeAttribute('cy', self::stringEmu($drawing->getHeight())); + $objWriter->endElement(); + } $objWriter->endElement(); // a:prstGeom @@ -240,9 +278,9 @@ public function writeDrawing(XMLWriter $objWriter, BaseDrawing $drawing, $relati // a:outerShdw $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getShadow()->getBlurRadius())); - $objWriter->writeAttribute('dist', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($drawing->getShadow()->getDistance())); - $objWriter->writeAttribute('dir', \PhpOffice\PhpSpreadsheet\Shared\Drawing::degreesToAngle($drawing->getShadow()->getDirection())); + $objWriter->writeAttribute('blurRad', self::stringEmu($drawing->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', self::stringEmu($drawing->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', (string) SharedDrawing::degreesToAngle($drawing->getShadow()->getDirection())); $objWriter->writeAttribute('algn', $drawing->getShadow()->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); @@ -252,7 +290,7 @@ public function writeDrawing(XMLWriter $objWriter, BaseDrawing $drawing, $relati // a:alpha $objWriter->startElement('a:alpha'); - $objWriter->writeAttribute('val', $drawing->getShadow()->getAlpha() * 1000); + $objWriter->writeAttribute('val', (string) ($drawing->getShadow()->getAlpha() * 1000)); $objWriter->endElement(); $objWriter->endElement(); @@ -497,4 +535,9 @@ private function writeHyperLinkDrawing(XMLWriter $objWriter, $hlinkClickId): voi $objWriter->writeAttribute('r:id', 'rId' . $hlinkClickId); $objWriter->endElement(); } + + private static function stringEmu(int $pixelValue): string + { + return (string) SharedDrawing::pixelsToEMU($pixelValue); + } } diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php index fce54c3..238fb5b 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php @@ -163,10 +163,11 @@ public function writeWorkbookRelationships(Spreadsheet $spreadsheet) * * @param int $worksheetId * @param bool $includeCharts Flag indicating if we should write charts + * @param int $tableRef Table ID * * @return string XML Output */ - public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet, $worksheetId = 1, $includeCharts = false) + public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet, $worksheetId = 1, $includeCharts = false, $tableRef = 1) { // Create XML writer $objWriter = null; @@ -252,6 +253,17 @@ public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\ ); } + // Write Table + $tableCount = $worksheet->getTableCollection()->count(); + for ($i = 1; $i <= $tableCount; ++$i) { + $this->writeRelationship( + $objWriter, + '_table_' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table', + '../tables/table' . $tableRef++ . '.xml' + ); + } + // Write header/footer relationship? $i = 1; if (count($worksheet->getHeaderFooter()->getImages()) > 0) { @@ -328,7 +340,7 @@ public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Wo $objWriter, $i, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', - '../media/' . str_replace(' ', '', $drawing->getIndexedFilename()) + '../media/' . $drawing->getIndexedFilename() ); $i = $this->writeDrawingHyperLink($objWriter, $drawing, $i); @@ -396,6 +408,43 @@ public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\ return $objWriter->getData(); } + public function writeVMLDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet): string + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Loop through images and write relationships + foreach ($worksheet->getComments() as $comment) { + if (!$comment->hasBackgroundImage()) { + continue; + } + + $bgImage = $comment->getBackgroundImage(); + $this->writeRelationship( + $objWriter, + $bgImage->getImageIndex(), + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + '../media/' . $bgImage->getMediaFilename() + ); + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + /** * Write Override content type. * diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php index bf306a8..cb2e385 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php @@ -201,6 +201,15 @@ private function writeGradientFill(XMLWriter $objWriter, Fill $fill): void $objWriter->endElement(); } + private static function writePatternColors(Fill $fill): bool + { + if ($fill->getFillType() === Fill::FILL_NONE) { + return false; + } + + return $fill->getFillType() === Fill::FILL_SOLID || $fill->getColorsChanged(); + } + /** * Write Pattern Fill. */ @@ -213,15 +222,13 @@ private function writePatternFill(XMLWriter $objWriter, Fill $fill): void $objWriter->startElement('patternFill'); $objWriter->writeAttribute('patternType', $fill->getFillType()); - if ($fill->getFillType() !== Fill::FILL_NONE) { + if (self::writePatternColors($fill)) { // fgColor if ($fill->getStartColor()->getARGB()) { $objWriter->startElement('fgColor'); $objWriter->writeAttribute('rgb', $fill->getStartColor()->getARGB()); $objWriter->endElement(); } - } - if ($fill->getFillType() !== Fill::FILL_NONE) { // bgColor if ($fill->getEndColor()->getARGB()) { $objWriter->startElement('bgColor'); diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Table.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Table.php new file mode 100644 index 0000000..67dbd19 --- /dev/null +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Table.php @@ -0,0 +1,111 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Table + $name = 'Table' . $tableRef; + $range = $table->getRange(); + + $objWriter->startElement('table'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('id', (string) $tableRef); + $objWriter->writeAttribute('name', $name); + $objWriter->writeAttribute('displayName', $table->getName() ?: $name); + $objWriter->writeAttribute('ref', $range); + $objWriter->writeAttribute('headerRowCount', $table->getShowHeaderRow() ? '1' : '0'); + $objWriter->writeAttribute('totalsRowCount', $table->getShowTotalsRow() ? '1' : '0'); + + // Table Boundaries + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($table->getRange()); + + // Table Auto Filter + if ($table->getShowHeaderRow()) { + $objWriter->startElement('autoFilter'); + $objWriter->writeAttribute('ref', $range); + foreach (range($rangeStart[0], $rangeEnd[0]) as $offset => $columnIndex) { + $column = $table->getColumnByOffset($offset); + + if (!$column->getShowFilterButton()) { + $objWriter->startElement('filterColumn'); + $objWriter->writeAttribute('colId', (string) $offset); + $objWriter->writeAttribute('hiddenButton', '1'); + $objWriter->endElement(); + } + } + $objWriter->endElement(); + } + + // Table Columns + $objWriter->startElement('tableColumns'); + $objWriter->writeAttribute('count', (string) ($rangeEnd[0] - $rangeStart[0] + 1)); + foreach (range($rangeStart[0], $rangeEnd[0]) as $offset => $columnIndex) { + $worksheet = $table->getWorksheet(); + if (!$worksheet) { + continue; + } + + $column = $table->getColumnByOffset($offset); + $cell = $worksheet->getCellByColumnAndRow($columnIndex, $rangeStart[1]); + + $objWriter->startElement('tableColumn'); + $objWriter->writeAttribute('id', (string) ($offset + 1)); + $objWriter->writeAttribute('name', $table->getShowHeaderRow() ? $cell->getValue() : 'Column' . ($offset + 1)); + + if ($table->getShowTotalsRow()) { + if ($column->getTotalsRowLabel()) { + $objWriter->writeAttribute('totalsRowLabel', $column->getTotalsRowLabel()); + } + if ($column->getTotalsRowFunction()) { + $objWriter->writeAttribute('totalsRowFunction', $column->getTotalsRowFunction()); + } + } + if ($column->getColumnFormula()) { + $objWriter->writeElement('calculatedColumnFormula', $column->getColumnFormula()); + } + + $objWriter->endElement(); + } + $objWriter->endElement(); + + // Table Styles + $objWriter->startElement('tableStyleInfo'); + $objWriter->writeAttribute('name', $table->getStyle()->getTheme()); + $objWriter->writeAttribute('showFirstColumn', $table->getStyle()->getShowFirstColumn() ? '1' : '0'); + $objWriter->writeAttribute('showLastColumn', $table->getStyle()->getShowLastColumn() ? '1' : '0'); + $objWriter->writeAttribute('showRowStripes', $table->getStyle()->getShowRowStripes() ? '1' : '0'); + $objWriter->writeAttribute('showColumnStripes', $table->getStyle()->getShowColumnStripes() ? '1' : '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } +} diff --git a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index 3e1b537..eba4c92 100644 --- a/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -2,6 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue; +use PhpOffice\PhpSpreadsheet\Calculation\Information\Value; use PhpOffice\PhpSpreadsheet\Cell\Cell; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\RichText\RichText; @@ -118,6 +120,9 @@ public function writeWorksheet(PhpspreadsheetWorksheet $worksheet, $stringTable // AlternateContent $this->writeAlternateContent($objWriter, $worksheet); + // Table + $this->writeTable($objWriter, $worksheet); + // ConditionalFormattingRuleExtensionList // (Must be inserted last. Not insert last, an Excel parse error will occur) $this->writeExtLst($objWriter, $worksheet); @@ -145,7 +150,9 @@ private function writeSheetPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $wor $autoFilterRange = $worksheet->getAutoFilter()->getRange(); if (!empty($autoFilterRange)) { $objWriter->writeAttribute('filterMode', 1); - $worksheet->getAutoFilter()->showHideRows(); + if (!$worksheet->getAutoFilter()->getEvaluated()) { + $worksheet->getAutoFilter()->showHideRows(); + } } // tabColor @@ -203,10 +210,10 @@ private function writeSheetViews(XMLWriter $objWriter, PhpspreadsheetWorksheet $ // Zoom scales if ($worksheet->getSheetView()->getZoomScale() != 100) { - $objWriter->writeAttribute('zoomScale', $worksheet->getSheetView()->getZoomScale()); + $objWriter->writeAttribute('zoomScale', (string) $worksheet->getSheetView()->getZoomScale()); } if ($worksheet->getSheetView()->getZoomScaleNormal() != 100) { - $objWriter->writeAttribute('zoomScaleNormal', $worksheet->getSheetView()->getZoomScaleNormal()); + $objWriter->writeAttribute('zoomScaleNormal', (string) $worksheet->getSheetView()->getZoomScaleNormal()); } // Show zeros (Excel also writes this attribute only if set to false) @@ -466,21 +473,66 @@ private static function writeElementIf(XMLWriter $objWriter, $condition, string private static function writeOtherCondElements(XMLWriter $objWriter, Conditional $conditional, string $cellCoordinate): void { + $conditions = $conditional->getConditions(); if ( $conditional->getConditionType() == Conditional::CONDITION_CELLIS - || $conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT || $conditional->getConditionType() == Conditional::CONDITION_EXPRESSION + || !empty($conditions) ) { - foreach ($conditional->getConditions() as $formula) { + foreach ($conditions as $formula) { // Formula - $objWriter->writeElement('formula', Xlfn::addXlfn($formula)); + if (is_bool($formula)) { + $formula = $formula ? 'TRUE' : 'FALSE'; + } + $objWriter->writeElement('formula', Xlfn::addXlfn("$formula")); + } + } else { + if ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSBLANKS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))=0'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_NOTCONTAINSBLANKS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))>0'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSERRORS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'ISERROR(' . $cellCoordinate . ')'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_NOTCONTAINSERRORS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'NOT(ISERROR(' . $cellCoordinate . '))'); + } + } + } + + private static function writeTimePeriodCondElements(XMLWriter $objWriter, Conditional $conditional, string $cellCoordinate): void + { + $txt = $conditional->getText(); + if ($txt !== null) { + $objWriter->writeAttribute('timePeriod', $txt); + if (empty($conditional->getConditions())) { + if ($conditional->getOperatorType() == Conditional::TIMEPERIOD_TODAY) { + $objWriter->writeElement('formula', 'FLOOR(' . $cellCoordinate . ')=TODAY()'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_TOMORROW) { + $objWriter->writeElement('formula', 'FLOOR(' . $cellCoordinate . ')=TODAY()+1'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_YESTERDAY) { + $objWriter->writeElement('formula', 'FLOOR(' . $cellCoordinate . ')=TODAY()-1'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_LAST_7_DAYS) { + $objWriter->writeElement('formula', 'AND(TODAY()-FLOOR(' . $cellCoordinate . ',1)<=6,FLOOR(' . $cellCoordinate . ',1)<=TODAY())'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_LAST_WEEK) { + $objWriter->writeElement('formula', 'AND(TODAY()-ROUNDDOWN(' . $cellCoordinate . ',0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(' . $cellCoordinate . ',0)<(WEEKDAY(TODAY())+7))'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_THIS_WEEK) { + $objWriter->writeElement('formula', 'AND(TODAY()-ROUNDDOWN(' . $cellCoordinate . ',0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(' . $cellCoordinate . ',0)-TODAY()<=7-WEEKDAY(TODAY()))'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_NEXT_WEEK) { + $objWriter->writeElement('formula', 'AND(ROUNDDOWN(' . $cellCoordinate . ',0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(' . $cellCoordinate . ',0)-TODAY()<(15-WEEKDAY(TODAY())))'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_LAST_MONTH) { + $objWriter->writeElement('formula', 'AND(MONTH(' . $cellCoordinate . ')=MONTH(EDATE(TODAY(),0-1)),YEAR(' . $cellCoordinate . ')=YEAR(EDATE(TODAY(),0-1)))'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_THIS_MONTH) { + $objWriter->writeElement('formula', 'AND(MONTH(' . $cellCoordinate . ')=MONTH(TODAY()),YEAR(' . $cellCoordinate . ')=YEAR(TODAY()))'); + } elseif ($conditional->getOperatorType() == Conditional::TIMEPERIOD_NEXT_MONTH) { + $objWriter->writeElement('formula', 'AND(MONTH(' . $cellCoordinate . ')=MONTH(EDATE(TODAY(),0+1)),YEAR(' . $cellCoordinate . ')=YEAR(EDATE(TODAY(),0+1)))'); + } + } else { + $objWriter->writeElement('formula', (string) ($conditional->getConditions()[0])); } - } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSBLANKS) { - // formula copied from ms xlsx xml source file - $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))=0'); - } elseif ($conditional->getConditionType() == Conditional::CONDITION_NOTCONTAINSBLANKS) { - // formula copied from ms xlsx xml source file - $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))>0'); } } @@ -489,14 +541,18 @@ private static function writeTextCondElements(XMLWriter $objWriter, Conditional $txt = $conditional->getText(); if ($txt !== null) { $objWriter->writeAttribute('text', $txt); - if ($conditional->getOperatorType() == Conditional::OPERATOR_CONTAINSTEXT) { - $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $txt . '",' . $cellCoordinate . ')))'); - } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_BEGINSWITH) { - $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($txt) . ')="' . $txt . '"'); - } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_ENDSWITH) { - $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($txt) . ')="' . $txt . '"'); - } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_NOTCONTAINS) { - $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $txt . '",' . $cellCoordinate . '))'); + if (empty($conditional->getConditions())) { + if ($conditional->getOperatorType() == Conditional::OPERATOR_CONTAINSTEXT) { + $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $txt . '",' . $cellCoordinate . ')))'); + } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_BEGINSWITH) { + $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',LEN("' . $txt . '"))="' . $txt . '"'); + } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_ENDSWITH) { + $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',LEN("' . $txt . '"))="' . $txt . '"'); + } elseif ($conditional->getOperatorType() == Conditional::OPERATOR_NOTCONTAINS) { + $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $txt . '",' . $cellCoordinate . '))'); + } + } else { + $objWriter->writeElement('formula', (string) ($conditional->getConditions()[0])); } } } @@ -599,57 +655,63 @@ private function writeConditionalFormatting(XMLWriter $objWriter, Phpspreadsheet // Loop through styles in the current worksheet foreach ($worksheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { + $objWriter->startElement('conditionalFormatting'); + $objWriter->writeAttribute('sqref', $cellCoordinate); + foreach ($conditionalStyles as $conditional) { // WHY was this again? // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') { // continue; // } - if ($conditional->getConditionType() != Conditional::CONDITION_NONE) { - // conditionalFormatting - $objWriter->startElement('conditionalFormatting'); - $objWriter->writeAttribute('sqref', $cellCoordinate); - - // cfRule - $objWriter->startElement('cfRule'); - $objWriter->writeAttribute('type', $conditional->getConditionType()); - self::writeAttributeIf( - $objWriter, - ($conditional->getConditionType() != Conditional::CONDITION_DATABAR), - 'dxfId', - (string) $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) - ); - $objWriter->writeAttribute('priority', $id++); - - self::writeAttributeif( - $objWriter, - ( - $conditional->getConditionType() === Conditional::CONDITION_CELLIS - || $conditional->getConditionType() === Conditional::CONDITION_CONTAINSTEXT - || $conditional->getConditionType() === Conditional::CONDITION_NOTCONTAINSTEXT - ) && $conditional->getOperatorType() !== Conditional::OPERATOR_NONE, - 'operator', - $conditional->getOperatorType() - ); - - self::writeAttributeIf($objWriter, $conditional->getStopIfTrue(), 'stopIfTrue', '1'); - - if ( - $conditional->getConditionType() === Conditional::CONDITION_CONTAINSTEXT + // cfRule + $objWriter->startElement('cfRule'); + $objWriter->writeAttribute('type', $conditional->getConditionType()); + self::writeAttributeIf( + $objWriter, + ($conditional->getConditionType() != Conditional::CONDITION_DATABAR), + 'dxfId', + (string) $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) + ); + $objWriter->writeAttribute('priority', $id++); + + self::writeAttributeif( + $objWriter, + ( + $conditional->getConditionType() === Conditional::CONDITION_CELLIS + || $conditional->getConditionType() === Conditional::CONDITION_CONTAINSTEXT || $conditional->getConditionType() === Conditional::CONDITION_NOTCONTAINSTEXT - ) { - self::writeTextCondElements($objWriter, $conditional, $cellCoordinate); - } else { - self::writeOtherCondElements($objWriter, $conditional, $cellCoordinate); - } - - // - self::writeDataBarElements($objWriter, $conditional->getDataBar()); + || $conditional->getConditionType() === Conditional::CONDITION_BEGINSWITH + || $conditional->getConditionType() === Conditional::CONDITION_ENDSWITH + ) && $conditional->getOperatorType() !== Conditional::OPERATOR_NONE, + 'operator', + $conditional->getOperatorType() + ); + + self::writeAttributeIf($objWriter, $conditional->getStopIfTrue(), 'stopIfTrue', '1'); + + $cellRange = Coordinate::splitRange(str_replace('$', '', strtoupper($cellCoordinate))); + [$topLeftCell] = $cellRange[0]; + + if ( + $conditional->getConditionType() === Conditional::CONDITION_CONTAINSTEXT + || $conditional->getConditionType() === Conditional::CONDITION_NOTCONTAINSTEXT + || $conditional->getConditionType() === Conditional::CONDITION_BEGINSWITH + || $conditional->getConditionType() === Conditional::CONDITION_ENDSWITH + ) { + self::writeTextCondElements($objWriter, $conditional, $topLeftCell); + } elseif ($conditional->getConditionType() === Conditional::CONDITION_TIMEPERIOD) { + self::writeTimePeriodCondElements($objWriter, $conditional, $topLeftCell); + } else { + self::writeOtherCondElements($objWriter, $conditional, $topLeftCell); + } - $objWriter->endElement(); //end cfRule + // + self::writeDataBarElements($objWriter, $conditional->getDataBar()); - $objWriter->endElement(); - } + $objWriter->endElement(); //end cfRule } + + $objWriter->endElement(); //end conditionalFormatting } } @@ -934,6 +996,25 @@ private function writeAutoFilter(XMLWriter $objWriter, PhpspreadsheetWorksheet $ } } + /** + * Write Table. + */ + private function writeTable(XMLWriter $objWriter, PhpspreadsheetWorksheet $worksheet): void + { + $tableCount = $worksheet->getTableCollection()->count(); + + $objWriter->startElement('tableParts'); + $objWriter->writeAttribute('count', (string) $tableCount); + + for ($t = 1; $t <= $tableCount; ++$t) { + $objWriter->startElement('tablePart'); + $objWriter->writeAttribute('r:id', 'rId_table_' . $t); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + /** * Write PageSetup. */ @@ -1135,10 +1216,12 @@ private function writeCellInlineStr(XMLWriter $objWriter, string $mappedType, $c { $objWriter->writeAttribute('t', $mappedType); if (!$cellValue instanceof RichText) { + $objWriter->startElement('is'); $objWriter->writeElement( 't', StringHelper::controlCharacterPHP2OOXML(htmlspecialchars($cellValue, Settings::htmlEntityFlags())) ); + $objWriter->endElement(); } elseif ($cellValue instanceof RichText) { $objWriter->startElement('is'); $this->getParentWriter()->getWriterPartstringtable()->writeRichText($objWriter, $cellValue); @@ -1194,7 +1277,7 @@ private function writeCellFormula(XMLWriter $objWriter, string $cellValue, Cell { $calculatedValue = $this->getParentWriter()->getPreCalculateFormulas() ? $cell->getCalculatedValue() : $cellValue; if (is_string($calculatedValue)) { - if (\PhpOffice\PhpSpreadsheet\Calculation\Functions::isError($calculatedValue)) { + if (ErrorValue::isError($calculatedValue)) { $this->writeCellError($objWriter, 'e', $cellValue, $calculatedValue); return; @@ -1221,7 +1304,7 @@ private function writeCellFormula(XMLWriter $objWriter, string $cellValue, Cell $objWriter, $this->getParentWriter()->getOffice2003Compatibility() === false, 'v', - ($this->getParentWriter()->getPreCalculateFormulas() && !is_array($calculatedValue) && substr($calculatedValue, 0, 1) !== '#') + ($this->getParentWriter()->getPreCalculateFormulas() && !is_array($calculatedValue) && substr($calculatedValue ?? '', 0, 1) !== '#') ? StringHelper::formatNumber($calculatedValue) : '0' ); }