Commit Graph

12 Commits

Author SHA1 Message Date
Mark Baker 55a41e8cae
Eliminate a big chunck of duplicated code for reading styles (#2021)
* Eliminate a big chunk of duplicated code for reading styles
2021-04-24 16:20:27 +02:00
oleibman b05dc31850
MathTrig - Change Names of funcWhatever to evaluate (#2008)
* MathTrig - Change Names of funcWhatever to evaluate

Per discussions while MathTrig was being broken up, this would help standardize the code. That idea was adopted partway through the breakup. This PR applies that standardization to the earlier efforts. A similar effort is required for DateTime; that will come later. This PR replaces #2006.

The only 2 remaining funcWhatevers in MathTrig are both in SUM, which required two different methods depending on whether or not string parameters were to be ignored. It seems appropriate to leave those method names non-standardized in order to require a decision about which is to be used if they are invoked internally.

3 Phpstan grandfathered errors were eliminated as part of this change, and its baseline has changed accordingly.

Co-authored-by: Mark Baker <mark@lange.demon.co.uk>
2021-04-20 22:43:29 +02:00
oleibman c79a9a8e21
Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004)
* Improved Support for INDIRECT, ROW, and COLUMN Functions

This should address issues #1913 and #1993. INDIRECT had heretofore not supported an optional parameter intended to support addresses in R1C1 format which was introduced with Excel 2010. It also had not supported the use of defined names as an argument. This PR is a replacement for #1995, which is currently in draft status and which I will close in a day or two.

The ROW and COLUMN functions also should support defined names. I have added that, and test cases, with the latest push. ROWS and COLUMNS already supported it correctly, but there had been no test cases. Because ROW and COLUMN can return arrays, and PhpSpreadsheet does not support dynamic arrays, I left the existing direct-call tests unchanged to demonstrate those capabilities.

The unit tests for INDIRECT had used mocking, and were sorely lacking (tested only error conditions). They have been replaced with normal, and hopefully adequate, tests. This includes testing globally defined names, as well as locally defined names, both in and out of scope.

The test case in 1913 was too complicated for me to add as a unit test. The main impediments to it are now removed, and its complex situation will, I hope, be corrected with this fix.

INDIRECT can also support a reference of the form Sheetname!localName when localName on its own would be out of scope. That functionality is added. It is also added, in theory, for ROW and COLUMN, however such a construction is rejected by the Calculation engine before passing control to ROW or COLUMN. It might be possible to change the engine to allow this, and I may want to look into that later, but it seems much too risky, and not nearly useful enough, to attempt to address that as part of this change.

Several unusual test cases (leading equals sign, not-quite-as-expected name definition in file, complex indirection involving concatenation and a dropdown list) were suggested by @MarkBaker and are included in this request.
2021-04-20 22:16:21 +02:00
Mark Baker 6282035c96
Extract Property and Style readers from the XML Reader into separate classes (#2009)
* Extract Property and Style readers from the XML Reader into separate classes
2021-04-20 15:27:44 +02:00
Mark Baker caf11fe808
Refactoring to extract DocProperties Reader from Gnumeric Reader (#2007)
* Refactoring to extract DocProperties Reader from Gnumeric Reader
2021-04-18 20:09:04 +02:00
Mark Baker f49a951bea
Tag deprecations for MathTrig, and eliminate calls to the deprecated methods (#2005)
* Tag deprecations for MathTrig, and eliminate calls to the deprecated methods
2021-04-18 12:19:53 +02:00
Mark Baker edca1f573d
Use validation classes rather than traits for Engineering functions (#2001)
* Use validation classes rather than traits for Engineering functions

* Re-baseline phpstan
2021-04-13 17:24:45 +02:00
Mark Baker ddd07ee504
Use validation classes rather than traits for Statistical functions, … (#1999)
* Use validation classes rather than traits for Statistical functions, and some verification of nullable arguments
* Eliminate more of the issues resolved in phpstan baseline
2021-04-13 16:56:21 +02:00
Adrien Crivelli d85eaacfa3
BREAKING `Worksheet::getCell()` cannot return null anymore
`Worksheet::getCell()` used to optionnaly return null if passed a
second argument. This second argument was removed entirely and the
method always returns a Cell (possibly creating it if needed).

This make the API more predictable and easier to do static analysis
with tools such as PHPStan.

If you relied on that second parameter, you should instead use the
`Worksheet::cellExists()` before calling `getCell()`.
2021-04-13 11:09:29 +09:00
Mark Baker a34695e0f9
Financial functions more rationalization (#1990)
* Additional unit tests and rationalisation for Financial Functions
* Providing a series of sample files for Financial functions
* Refactor the last of the existing Financial functions
* Some more unit tests with default assignments from null arguments

Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
2021-04-12 22:08:58 +02:00
Adrien Crivelli 49f87de165
Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Adrien Crivelli 89aa7e6fcd
Introduce PHPstan baseline 2021-04-11 16:56:36 +09:00