Commit Graph

23 Commits

Author SHA1 Message Date
oleibman 6d06bf94b0 Merge branch 'master' into issue1310 2024-06-25 23:18:38 -07:00
oleibman e40438916f Change Style Without Affecting Current Cell/Sheet, and Invalid Formulas
Fix #1310, which was closed as stale in 2020, but which I will now reopen. Supersedes PR #1311 (@jaiminmoslake7020), from which I will remove the stale label but leave closed. The issue and the PR were too limited  - they detected that the use of two equal signs at the start of a string made for an invalid formula, but there are variations, trivial and otherwise, which might also be detected. Using `setValue` with a string which starts with an equal sign will now attempt to parse (not evaluate) the formula; for certain situations in which the parser throws an exception, the string will be treated as a string rather than a formula. An example where it will still be treated as a formula is a 3D range reference, where the problem is not that it can't be parsed, but rather that the formula isn't supported (see unit test Calculation/Engine/RangeTest::test3dRangeEvaluation). Allowing such a formula might cause problems later on, but that is already what happens.

A string beginning with an equal sign but which isn't treated as a formula will automatically set the `quotePrefix` attribute to `true`; all other `setValue` attempts will set it to `false`. This avoids the problem of a lingering value causing problems later on.

It has long been a matter of discontent that setting a style can change the selected cells. A new method is added to `Worksheet`:
```php
applyStylesFromArray(string $coordinate, array $styleArray)
```
This will attempt to guarantee that the active sheet in the current spreadsheet, and the selected cells in the current worksheet, remain undisturbed after the call. The setting of `quotePrefix` above is the first use of the new method.
2024-06-25 22:06:36 -07:00
oleibman 85c1512b67 Better Definitions for Mixed Parameters and Values Part 3 of Many
Continuing work started with PR #4016 and PR #4026. Improve documentation within program by making explicit what types of values are allowed for variables described as "mixed". In order to avoid broken functionality, this is done mainly through doc-blocks. This will get us closer to Phpstan Level 9, but many changes will be needed before we can consider that.

This change has more executable code changes than its predecessor. I will wait longer than normal before merging it to allow for additional testing.
2024-06-04 06:47:51 -07:00
Adrian 276f7813d5 check if coordinate is inside range (#3779)
* check if coordinate is inside range

* Added coordinateIsInsideRange tests

* fix coordinateIsInsideRange error throwing

* fix coordinateIsInsideRange error throwing

* add support to worksheet name

* validateReferenceAndGetData type

* change validate and add tests data

* fix tests data reference

* fix absolute reference error

* fix boundaries to get range

* fix scrutinizer erros

* Additional Test Cases

---------

Co-authored-by: oleibman <10341515+oleibman@users.noreply.github.com>
2023-11-17 06:56:22 -08:00
Adrien Crivelli ec4098c8fd Strict mode for all tests
While we might never be able to have 100% of our code strict, we can at
the very least do it for all of our tests. This ensures that our tests
are using our API with the types as intended by the test author, and not
silently be cast to what our API requires.
2023-09-07 17:44:56 +08:00
MarkBaker 4f7da29332 Minor performance tweaks 2022-05-01 21:55:37 +02:00
MarkBaker ef4029df63 Refactor ISO data type validation from cell to shared date; add extra checks for invalid dates; and appropriate unit tests 2022-02-26 14:13:12 +01:00
MarkBaker 642fc7dee7 PHPCS and PHStan appeasement 2021-06-03 21:42:20 +02:00
MarkBaker 3297f503c2 Addtional unit tests for vlue binders 2021-06-03 21:42:20 +02:00
MarkBaker 60ade80c0f Resolve Issue with float values losing their decimal when read from SpreadsheetML 2021-05-20 23:29:57 +02:00
Nathan Dench e6a4442d9a Use named data provider in AddressHelper tests 2021-05-20 21:26:20 +02:00
Nathan Dench 1a78ecfb10 Track down bug in AddressHelper::convertFormulaToA1 2021-05-20 21:26:20 +02:00
Nathan Dench 03ba547f5a Test convertFormulaToA1FromR1C1 2021-05-20 21:26:20 +02:00
Nathan Dench 62d3a56a57 Add AddressHelper::convertFormulaToA1 tests for SpreadsheetXML 2021-05-20 21:26:20 +02:00
Nathan Dench 76ac008911 R1C1 conversion should handle absolute A1 references 2021-05-07 14:34:05 +02:00
Adrien Crivelli d02352845c PHPStan Level 2 2021-04-04 22:06:00 +09:00
Mark Baker a264cafe4c Helper class for the conversion of cell addresses between A1 and R1C1 formats, and vice-versa (#1558)
* Helper class for the conversion of cell addresses between A1 and R1C1 formats, and vice-versa
2020-06-27 23:03:25 +02:00
Gianni Genovesi 7b1957f996 fix: issue #1476 crash with numeric string value terminating with new line (#1481)
* fix: issue #1476 crash with numeric string value terminating with new line
* test: provided tests for issue #1476
2020-05-23 12:49:54 +02:00
Mark Baker e19228ecb0 Additional cell datatype unit tests (#1301) 2020-01-03 23:29:53 +01:00
Adrien Crivelli 5441b2fa73 Keep big integer as integer instead of lossely casting to float
Closes #874
Fixes #1135
2019-11-10 22:51:53 +01:00
Adrien Crivelli 8dddf56c2e Use proper syntax for variadic functions
This simplify code, increase readability and improve the function
signature for API users.
2017-01-23 15:01:20 +09:00
Adrien Crivelli 09d456e477 Introduce PHP-CS-Fixer for stricter code style rules
PHP-CS-Fixer allow to check different things than phpcs and it allows
code to be more consistent. Configuration can be changed in `.php_cs`
2016-08-17 00:33:57 +09:00
Adrien Crivelli e1f81f0fe0 Refactor tests data from custom format to PHP
FIX #14
2016-08-16 21:00:19 +09:00