Commit Graph

217 Commits

Author SHA1 Message Date
oleibman 33eefe7c9d Resolve Phpstan Messages - FINALE - Shared/OLE (#3364)
* Resolve Phpstan Messages - FINALE - Shared/OLE

Reduce number of Phpstan messages by addressing their issues. This is the last of a series of related tickets to achieve that end. Only a handful of messages will be left in Phpstan baseline after this change is merged.

Shared/Ole.php and Shared/Ole/ChainedBlockStream.php were completely uncovered in the test suite. So I wrote some tests and found they didn't work at all. There were 2 problems. The first was that ChainedBlockStream checks for a mode of `r`, but Ole invokes it with mode `rb`. ChainedBlockStream will now just check the first character of the mode.

The second was a more interesting problem. Ole was reading "an *unsigned* long". However, what it should have been reading was "a 32-bit *signed* long". The irony of this mismatch is that, once the mode problem was corrected, 32-bit Php handled Ole and ChainedBlockStream correctly, but 64-bit Php did not. The code is corrected to work properly for both 32- and 64-bit.

* Scrutinizer

2 dead assignments - sufficient to just make calls which are expected to fail.
2023-02-20 06:40:02 -08:00
oleibman 1f94687f1c Resolve Phpstan Messages - Writer Xls Worksheet (#3363)
Reduce number of Phpstan messages by addressing their issues.
2023-02-18 07:44:26 -08:00
oleibman 9e1378d806 Resolve Phpstan Messages - Statistical/Trend and Shared/Trend (#3362)
* Resolve Phpstan Messages - Statistical/Trend and Shared/Trend

Reduce number of Phpstan messages by addressing their issues. The changes in this PR are all to doc blocks; no executable code is changed.

* Scrutinizer

1 mystifying "new" error (matches "old" error), 2 updated doc blocks.
2023-02-16 19:18:02 -08:00
oleibman 545fc89d8f Resolve Phpstan Messages Reader/Xls Shared/Escher (#3355)
* Resolve Phpstan Messages Reader/Xls Shared/Escher

Reduce number of Phpstan messages by addressing their issues.

* Scrutinizer

Hyperactivity.

* More Scrutinizer

Getting close.

* Even More Scrutinizer

Closer and closer.
2023-02-11 17:21:19 -08:00
oleibman 5fb76c83ef Resolve Phpstan Messages in Writer Xls (#3343)
* Resolve Phpstan Messages in Writer Xls

Reduce number of Phpstan messages by addressing their issues. This change does not touch Worksheet, and does not eliminate all Phpstan problems in the modules it does touch.

* Scrutinizer

Yet another false positive.
2023-02-07 07:02:27 -08:00
oleibman 14fd9bddeb Resolve Phpstan Messages in Writer Ods (#3342)
* Resolve Phpstan Messages in Writer Ods

Reduce number of Phpstan messages by addressing their issues.

* Minor Fix

Phpstan reports one fewer error under Php8 than previously.
2023-02-05 18:54:11 -08:00
oleibman 889ad85b84 Resolve Phpstan Messages in Reader Ods (#3324)
* Resolve Phpstan Messages in Reader Ods

Reduce number of Phpstan messages by addressing their issues.

* Update HiddenMergeCellsTest.php
2023-02-01 08:52:26 -08:00
oleibman cc347fd1c8 Resolve Phpstan Messages in IOFactory and Several Readers (#3319)
Reduce number of Phpstan messages by addressing their issues. Reader/Ods will require a separate ticket. Reader/Xls will require many separate tickets.
2023-01-31 15:19:58 -08:00
oleibman 1cdc6cd2fb Breaking Change to toFormattedString and 3 toArray Methods (#3304)
* Breaking Change to toFormattedString and 3 toArray Methods

DocBlock says `toFormattedString` returns string, but code can return int, float, bool, null, or RichText. I think the DocBlock is correct (function name clearly indicates "to string"), and the code needs to change to match it. This is not that big a deal on its own. However, some methods in `Worksheet` call this function by default - `rangeToArray`, `toArray`, and `namedRangeToArray`. All 3 can be called with a parameter so that they don't call `toFormattedString`, but, by default, they do call, and so are affected by this change. Some unit test results are changed as a result of this code change. In all those cases, an additional test is added which would match the previous result.

* Update Change Log

I often skip this till later, but, since it's a breaking change ...

* Scrutinizer, Plus Strange Cast to -0

Avoid Scrutinizer complaint by casting string to float, but ... Php decides resulted should sometimes be `-0`? That caused test failures. Very odd.
2023-01-30 00:54:48 -08:00
oleibman a950d1042b Resolve Phpstan Messages in Style (except NumberFormat/Formatter) (#3303)
Reduce number of Phpstan messages by addressing their issues.

NumberFormat/Formatter has a problem and needs to be dealt with in a separate ticket.
2023-01-28 01:17:51 -08:00
oleibman a0e6e09557 Resolve Phpstan Messages LookupRef TextData Coordinate ReferenceHelpe… (#3298)
* Resolve Phpstan Messages LookupRef TextData Coordinate ReferenceHelper RichText

Reduce number of Phpstan messages by addressing their issues.

* Scrutinizer

One legitimate observation, one unfathomable false positive.

* Scrutinizer (legitimate)

Reasonable simplification suggestion.
2023-01-27 09:15:08 -08:00
oleibman 8497a320ea Resolve Phpstan Messages in Calculation Statistical (#3290)
* Resolve Phpstan Messages in Calculation Statistical

Reduce number of Phpstan messages by addressing their issues.

I did not eliminate the messages for Trends, because I did not understand why it is working as it does, so felt it was better to leave it alone.

* Scrutinizer

A new false positive.
2023-01-16 07:19:39 -08:00
oleibman c93d2a53db Resolve Phpstan Messages in Calculation Functions Internal and MathTrig (#3288)
Reduce number of Phpstan messages by addressing their issues.
2023-01-16 06:15:02 -08:00
oleibman ac5299b5df Minor Fix for AND/OR/XOR (#3287)
* Minor Fix for AND/OR/XOR

These 3 fall into the set of functions where Excel treats string literals differently depending on whether they are passed to the function directly or as a cell reference. PhpSpreadsheet is updated to try to duplicate that logic. New tests are added. Some existing test results had to change as a result of this code change.

* Adopt A Suggestion From Mark Baker

Reduce if statements by adding functions.
2023-01-16 05:35:28 -08:00
oleibman a5f1de02e3 Resolve Phpstan Messages in Calculation Financial (#3284)
Reduce number of Phpstan messages by addressing their issues.
2023-01-15 08:18:33 -08:00
oleibman 811406ba7a Resolve Phpstan Messages in Calculation Engineering and DateTime (#3283)
Reduce number of Phpstan messages by addressing their issues.
2023-01-14 07:29:51 -08:00
oleibman a3f3d2c9ad Clean Up Documentation for Worksheet (#3281)
* Clean Up Documentation for Worksheet

This PR was intended to clean up Phpstan/Scrutinizer messages regarding Worksheet. It is, for the most part, straightforward, but there is one problem which complicates things. The frequently-called public method `getParent` returns `Worksheet` or `null` but is documented to return only `Worksheet`. This can be addressed in either of two ways - change the code to match the documentation (smaller number of changes but a backwards compatibility break), or change the documentation to match the code (larger number of changes but no compatibility break). I have prepared a PR for each approach, but avoiding a compatibility break seems better, so I am pushing the latter. I can switch to the other if preferred. Most existing internal calls to `getParent` are changed to use a new method `getParentOrThrow`, which will throw an exception if parent is null. These calls would all have thrown a null pointer exception anyhow in that situation, so this should not cause any new breaks.

* Scrutinizer

One false positive, and one message leading to a minor code improvement.
2023-01-11 23:34:52 -08:00
oleibman 4adafecea9 Eliminate Shared\JAMA (#3260)
* Eliminate Shared\JAMA

The code under `Shared\JAMA` is called from exactly 3 places in Calculation, and exactly 1 other place (see next paragraph). These places are inadequately covered in the test suite, so it is not clear that the existing code works. In addition, see PR #2964 for commentary decrying the continued used of JAMA. I will also note that it has a pitiful 8.20% coverage in the test suite. There seems to already be a perfectly adequate equivalent in Calculation for those parts of JAMA which are used (e.g. we don't use any decompositions, so the fact that no decomposition code is present in Calculation is not a problem). This PR replaces the uses of JAMA within Calculation with `checkMatrixOperands`, and deletes Shared/JAMA entirely (which, among other thing, makes many Phpstan reported problems go away). The test suite is enhanced to ensure coverage of all the changed statements. A side benefit of deleting Shared/Jama is that the only function which PhpSpreadsheet has added to the global namespace (hypo in Maths.php) goes away.

There is one additional use in Shared/Trend/PolynomialBestFit. That use is best replaced with Matrix/Matrix, which is already a requirement for PhpSpreadsheet. PolynomialBestFit has zero test coverage, and I didn't add any for this change. There seem to be existing errors which both Phpstan and Scrutinizer complain about, and I am quite convinced that they are not false positives. Fixing those problems will be a project for another day.

Calculation has many calls to `Information\ErrorValue` and `Information\ExcelError`. It is inconsistent in how it does so - most invoke `Information\E...` but a small number take advantage of additional `use` statements to just invoke `E...`. I have made the usage consistent by changing the small number to act like the majority and eliminating the `use` statements.

Some of the test cases exposed the fact that MAX, MAXA, MIN, and MINA do not properly handle error strings in their input. For example, if cell A1 contains 2, and A2 contains `=5/0`, `=MAX(A1, A2)` should return `#DIV/0!`. They are changed to handle them properly.

`Shared\JAMA` was normally omitted from code coverage. Since it is being deleted, there is no longer a reason to explicitly exclude it. `Writer\PDF` was also on the exclude list, probably for historical reasons, but there is no reason to exclude it now (it is, in fact, 100% covered), so it will no longer be excluded.

* Scrutinizer

Eliminate some newly dead code.
2022-12-30 07:22:58 -08:00
MarkBaker 6fd24cad58 Refactor database tests to execute the test itself and check assertions in the main test function, not in the base class
Test both the function implementation (directly), and when the function is called in a formula from a spreadsheet
Replace error strings in expected result for providers with the value returned from the ExcelErrors class
2022-12-08 12:49:19 +01:00
oleibman 2430abde03 Eliminate Some Scrutinizer 'Major' Problems Part 7 Xls (#3219)
* Eliminate Some Scrutinizer 'Major' Problems Part 7 Xls

The last change in this series. Dividing the work between xls and non-xls code seems to partitition the work very nicely 50-50. This is the Xls part. All remaining Scrutinizer problems will be recoded, annotated, or preceded by a comment explaining why no action is taken.

* One More Dead Assignment

Fix it.
2022-12-03 07:12:23 -08:00
oleibman 25d3968788 Eliminate Some Scrutinizer 'Major' Problems Part 6 Non-Xls (#3218)
* Eliminate Some Scrutinizer 'Major' Problems Part 6 Non-Xls

The penultimate change in this series. Dividing the work between xls and non-xls code seems to partitition the work very nicely 50-50. This is the non-Xls part. All remaining Scrutinizer problems will be recoded, annotated, or preceded by a comment explaining why no action is taken.

Three members in Shared/Jama are deleted. All had Scrutinizer errors. None are called from anywhere inside PhpSpreadsheet, including the test suite. It is much easier to delete the unused members than to fix (and test) them.

* More Surprises

Apparently Scrutinizer will sometimes flag an error only once for a module no matter how often it occurs.
2022-12-03 06:44:27 -08:00
oleibman 58c6e51992 Sync composer.lock/.json and Phpstan Upgrade (#3212)
* Sync composer.lock/.json and Phpstan Upgrade

For some reason, a version newly cloned from master receives a complaint from composer that the lock and json files aren't in sync. So I ran composer update. The only thing that needs special attention is, as usual, Phpstan. There are an unusually large number of new differences when Phpstan is run with Php7.4 vs Php8.1. These are handled easily enough. But Reader/Xlsx seems very fragile; a change which would have eliminated one of the new errors seems to have caused Phpstan to go into a loop, as does an annotation without a code change, and, indeed, as does just about any change to that member. This bears watching, and it's a reason I will delay installing this.

* Deleting Phpstan Cache Helps

It lets me change Reader/Xlsx as I wished. Not a great resolution, but probably good enough. I will continue to think about it for a couple of days.

* Minor DocBlock Changes

Correct some PhpDocumentor problems.
2022-11-27 07:39:24 -08:00
oleibman 1fcfadc4b8 Fix Unintential Deprecated Calls - Everything Else (#3183)
* Fix Unintential Deprecated Calls - Everything Else

I think it's best to install these before PR #3166. This one, which I hope to be the last in this series, does have some minor changes to source code, as well as to doc-blocks and to test members which continue to inadvertently use calls to deprecated functions.

* Some Remaining Deprecations in Tests

Fix them now.

* Minor Docblock Updates

Worksheet::unprotectCellsByColumnAndRow was incorrect. Other changes are cosmetic, leading to slightly better documentation.

* Update Worksheet.php
2022-11-25 13:06:52 -08:00
oleibman a884013d00 Fix Unintential Deprecated Calls in Tests - FINANCIAL (#3180)
* Fix Unintential Deprecated Calls in Tests - FINANCIAL

I think it's best to install these before PR #3166. There are no changes to source code, only to doc-blocks and to test members which continue to inadvertently use calls to deprecated functions.

* Change Tests to Run in Spreadsheet Context

Found and fixed some problems with how MIRR handles errors.
2022-11-25 07:19:19 -08:00
oleibman ca1ff07fbe Fix Unintential Deprecated Calls in Tests - DATABASE (#3175)
* Fix Unintential Deprecated Calls in Tests - DATABASE

I think it's best to install these before PR #3166. There are no changes to source code, only to test members which continue to inadvertently use calls to deprecated functions.

* Fix deprecation Blocks

Deprecated->deprecated, adjust see and comments

* Fix Deliberate Deprecated Tests

Add annotations.

* Change Unit Tests to Run in Spreadsheet Context

... rather than as direct calls. The major difference is that specifying an invalid column should result in an Excel error, not null. Minor code changes were needed, including to Statistical/Conditional which sometimes calls Database.

* Correct Some DocBlocks

Null is no longer a possible output for most of these functions.

* 2 Overlooked Tests

Change to run in spreadsheet context.

* T Function Should Return Null-String, not Null

Fix it.
2022-11-23 06:54:51 -08:00
oleibman 26e17277e1 Eliminate Some Scrutinizer 'Major' Problems Part 5 (#3161)
* Eliminate Some Scrutinizer 'Major' Problems Part 5

More of the same. 2 or 3 of these still to go after this.

Note one deprecation. Shared/Drawing has a method imagecreatefrombmp. However, that was introduced as a native PHP function with 7.2, so the method is no longer needed.

* More Silliness

Keep trying.

* If At First You Don't Succeed

Try, try again.
2022-11-21 15:31:13 -08:00
oleibman bbfaa0c336 Eliminate Some Scrutinizer 'Major' Problems Part 4 (#3154)
* Eliminate Some Scrutinizer 'Major' Problems Part 4

Mostly docblock changes and annotations. Some code changes. A few more of these to go still.

* Missed a Couple

Fix them now.
2022-11-08 18:04:48 -08:00
oleibman fac0e46c91 MATCH Problems with Int/Float Compare and Wildcards (#3142)
* MATCH Problems with Int/Float Compare and Wildcards

Fix #3141. Function matchSmallestValue did not recognize that an integer could match a float. Adding test cases, it seems that matchFirstValue had the same problem. However, matchLargestValue seemed to handle things correctly - but see below.

In addition, the wildcard logic in matchFirstValue is faulty. It ignored tilde as a wildcard character. Although it would have been easy to just add that, I think it was wrong to determine on its own if a wildcard was in use. Just using the already available wildcard functions whenever comparing two strings is sufficient.

I note that Excel doesn't seem to follow its own rules for MATCH (https://support.microsoft.com/en-us/office/match-function-e8dffd45-c762-47d6-bf89-533f4a37673a?ns=excel&version=90&syslcid=1033&uilcid=1033&appver=zxl900&helpid=xlmain11.chm60112&ui=en-us&rs=en-us&ad=us). PhpSpreadsheet's results match Excel's, so no problem. However, when match_type is not zero, the match array is supposed to be sorted, so I would expect `#N/A` when it isn't; but that's not how Excel operates. I have no idea what Excel is doing. If `MATCH(2,{2,0,4,3},1)` isn't `#N/A` because of the unsorted array, then surely it should be `1` (item 1 of the array is the largest number less than or equal to the lookup value); but Excel and PhpSpreadsheet (before and after changes) return `2`. I have moved this example to be the first of the test cases.

One would think strings would behave similarly. But, no - see the second test case. This time Excel does look for an exact match. But the existing logic doesn't get the matching result in PhpSpreadsheet. It requires a whole new block of code, one which doesn't work correctly for numeric lookup value. Ugh.

LibreOffice doesn't always agree with Excel. It seems that it will use wildcard matching even when the match type is not zero (Excel documentation says wildcards are only for type zero, which is just as well because I don't really know what greater/less mean when wildcards are involved). I have not attempted to duplicate this behavior. For the record, Gnumeric agrees with Excel here.

* More Changes - LibreOffice

Add support for LibreOffice matching wildcard strings when type is not zero. Add support for type to be specified as integer other than 0/1/-1, or as float, or as numeric string; non-numeric string should case `#VALUE!` error.

I have found an example of undefined behavior (unsorted array where type is non-zero) where PhpSpreadsheet does not produce the same result as Excel. It is present as a new `incomplete` test case. I can fix it, but not without breaking other tests where the proper behavior is undefined. IMO, this is not a problem we should be concerned about.

Many test cases are added. Chances are I will add some more before merging this change.
2022-11-04 15:51:00 -07:00
oleibman c16d86d996 Eliminate Some Scrutinizer 'Major' Problems Part 3 (#3131)
* Eliminate Some Scrutinizer 'Major' Problems Part 3

Continuing the work of PR #3109 and PR #3122. Nothing unusual about the changes in this ticket. I expect 4 or 5 more after it will be needed to finish the job.

* Scrutinzer Strikes Again

A couple of new false positives.

* Tidy Up Earlier Change

Conform to a better approach we figured out later.
2022-10-27 00:25:52 -07:00
oleibman e4e99b8a73 Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121)
* Permit Date/Time Entered on Spreadsheet to be Calculated as Float

Fix #1416. I do not entirely understand the use case for this old issue, but resolving it seems straightforward. Issue complains that user-entered date/time fields may be interpreted as either float or int when PhpSpreadsheet reads them. Issue suggests getCalculatedValue treat all date/time fields as float; that seems like a breaking change. However, adding an option to permit it seems okay. That option might be implemented as either a property of Calculation, or a static property of Cell. Since the changed logic is found in Cell (and Shared/Date), I opted for the latter.

In Cell, the property `$parent` is incorrectly described in doc block as `Cells`, and should be `?Cells`. This change eliminates some Phpstan and Scrutinizer problems, and should allow the elimination of some try/catch blocks - I have not done an exhaustive search for those.

Calls to `isDateTime` could have affected activeSheet and selectedCells; they no longer can. Optional parameters are added to it and the functions it calls to accommodate the new functionality; the defaults for the new parameters will, of course, return the same result as the earlier versions of the functions would have returned.

* Scrutinizer - Self-inflicted

Tests used constant which I deprecated.
2022-10-18 18:58:38 -07:00
oleibman 31d0a2e9f9 Eliminate Some Scrutinizer 'Major' Problems (#3109)
Almost all of these are handled through annotations. This shouldn't be our "go-to" solution, but it becomes necessary because Scrutinizer's analysis is often incorrect. Here is a typical example, from Cells.php.
```php
         if ($this->currentCellIsDirty && isset($this->currentCoordinate, $this->currentCell)) {
            $this->currentCell->detach();
```
Scrutinizer complains that `$this->currentCell` can be null here, but the `isset` condition guarantees that it must be non-null. Perhaps Scrutinizer is worried that `isset` might be overridden, and will accept only an explicit equality test for null for each of the isset arguments. Changing the code to do this seems riskier than just adding the annotation.

A far more common, and more frustrating, example is:
```php
foreach ($simpleXmlElement as $element) {
    var_dump($element->method());
}
```
Scrutinizer complains that element might be null. I don't think it can. I have previously added code in places to eliminate the objection, and that may be a practical solution when `$element` is used many times in the loop. But, when it's used only once, annotating the objection away seems like a better solution (less overhead, clearer code). Many of the changes in this PR fall into this category.
2022-10-13 07:37:07 -07:00
oleibman befbc564f4 Fix Remainder of Calculation vs. Phpstan Issues (#3108)
* Fix Remainder of Calculation vs. Phpstan Issues

I had tried to include these changes as part of an earlier effort, but something about them broke Phpstan. I removed them until I could determine the actual cause, which is ...

The array `$phpSpreadsheetFunctions` is a very large and very complicated array, typehinted as `array`. It is declared as private static; however, its content never changes (at least not now - there are some outstanding proposals that might change that). I have had some success with changing unmodifiable private static to private const. However, such a change here causes Phpstan to perform a lot more processing and eventually time out. So, leave it as static.

Having identified the cause of the problem, none of the other changes were problematic, so this PR applies the rest of them.

* Scrutinizer

One problem.

* Scrutinizer False Positives Without Suggested Annotation

See if minor code changes can make these go away.

* Scrutinizer Still Experimenting

Trying again.
2022-10-12 23:28:08 -07:00
MarkBaker f602f8c585 Merge with current master, and resolve conflicts 2022-10-11 10:50:33 +02:00
MarkBaker 123952767c Merge branch 'master' into Table-Reader-for-Xlsx
# Conflicts:
#	phpstan-baseline.neon
#	src/PhpSpreadsheet/Reader/Xlsx.php
#	src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
#	src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
2022-10-11 10:29:14 +02:00
oleibman 66695881e4 Calculation suppressFormulaErrors - Minor Break and Deprecation (#3092)
Fix #1531. This is a replacement for PR #3081 (see last paragraph below), which I will close.

Calculation has a property `suppressFormulaErrors`, which really doesn't work as one might expect. If a calculation throws an exception, the setting of this property might prevent the Exception from being thrown, but it will still trigger an Error. I do not think this makes sense, and will change it so the calculation will return `false`, which is part of the original design but which would essentially never happen. This allows the user to save a corrupt spreadsheet, but this was already possible through the use of `setPreCalculateFormulas(false)` on the Writer, so this doesn't really open any new exposures. It nevertheless might be considered a breaking change because of the difference in behavior.

Deprecation - the visibility of the existing property is public, which means it can be changed directly. A new private property is added with a public setter/getter. The new property will be used when the existing property is null (default), which will allow the existing property to be deprecated.

Function getFunctions is changed to static - the array which it returns is static. Existing callers using it as non-static will still function correctly.

Although I am enabling this ability, I don't necessarily think it's a good idea to make use of it. See the original issue for a discussion of why. It is not mentioned in the official documentation, and I will not be adding documentation for it. The originator discovered it by reading the code, and I think that is sufficient for what will often be an ill-advised choice.

Many of the large number of problems with Calculation.php in phpstan baseline are addressed. PR 3081 ran afoul of something in phpstan. The changes in this ticket are more limited, adding a number of doc blocks but leaving executable code unchanged.
2022-10-01 08:40:27 -07:00
oleibman 35b42cc180 Phpstan Baseline Fixes 2022-09-21 (#3080)
* Phpstan Baseline Fixes 2022-09-21

Eliminate about 200 more lines from Phpstan baseline. For Helper/Sample and Helper/Html and others, many properties are declared as protected despite the fact that the classes do not extend any other class, and there are no classes which extend them. They are changed to private; this could be a breaking change in circumstances for which I cannot think of a use case (user extends class for some reason).

* Slightly Botched Merge Commit

Hope this fixes phpstan.
2022-09-30 09:00:13 -07:00
oleibman a193f36f31 More Carets in composer.json (#3090)
* More Carets in composer.json

Following up on PR #3086, there are 3 additional items in the require-dev section that should have carets. I probably accidentally removed them for tcpdf and mitoteam, which point to the current release anyhow. Dependabot appears to be responsible for mpdf, which is not pointing to the current release, but I have tested with current successfully.

* Minor Fix for Change Made Earlier Today

"Scrutinizer Tweak" causes a Phpstan error. Fix baseline to correct it.
2022-09-27 22:13:19 -07:00
MarkBaker b9ded919fc Minor cosmetic changes 2022-09-21 15:37:51 +02:00
MarkBaker 6e93505cf5 Minor cosmetic changes 2022-09-21 14:43:24 +02:00
oleibman 53e0828d49 Sync composer.lock (#3075)
When I cloned this morning, composer gave me a message that the lock file was not up to date with the latest changes in composer.json. I do not understand why, but it suggested to run `composer update`, which I did. This led to a handful of problems with php-cs-fixer, all fixed with changes to doc-blocks, and phpstan (only Writer/Xls/Worksheet required a change to code). We would presumably have had these problems at the start of next month when dependabot did its thing, so fix them now.
2022-09-20 08:37:00 -07:00
oleibman b5f70de61d More Scrutinizer Catch Up (#3050)
* More Scrutinizer Catch Up

Continue the work of PR #3043 by attending to the 12 remaining 'new' issues.

* Php 8.1 Problem

One new null-instead-of-string problem.
2022-09-09 07:56:11 -07:00
oleibman 57a72037b5 Phpstan and Xlsx Reader (#3044)
Eliminate most Phpstan messages in Xlsx Reader. In combination with similar changes to Xlsx Writer, baseline will shrink to just over 3,000 lines.
2022-09-04 09:45:29 -07:00
oleibman 5f33ec0eea Phpstan Baseline < 4000 Lines Part 3 (#3041)
The last of these changes for now. No remaining Phpstan complaints in any Writer/Xlsx. Number of lines remaining in Phpstan baseline is now below 3500.
2022-09-03 19:00:01 -07:00
oleibman 4f8aa806bc Phpstan Baseline < 4000 Lines Part 2 Html (#3037)
Continue to reduce the size of Phpstan Baseline by fixing problems reported for Writer/Html.
2022-08-30 22:34:20 -07:00
oleibman 9eb5e7e976 Phpstan Baseline < 4000 Lines Part 1 (#3023)
A lot of easily fixed problems throughout Writer/Xlsx/*, mostly supplying int rather than string as input to WriteAttribute/WriteElement. There are, in fact, so many opportunities, that I will split it over 2 or 3 PRs. But this first one will get Phpstan baseline down to the goal on its own.

Some of the other problems are also easily fixed. In particular, the docBlocks in Style/ConditionalFormatting/ConditionalDataBar do not allow for null values, and should.
2022-08-29 22:15:50 -07:00
MarkBaker e67de6f300 Support for SimpleCache Interface versions 1.0, 2.0 and 3.0; to stop people moaning; even though it requires a second implementation of the Memory cache for Cells 2022-08-20 21:27:05 +02:00
MarkBaker b0f7e83dc2 Fix phpstan baseline 2022-08-15 06:33:31 +02:00
MarkBaker 71b2c5ae89 Expand [PR #2964](https://github.com/PHPOffice/PhpSpreadsheet/pull/2964) to cover all arithmetic operators, not just multiplication, and both left and right side values 2022-08-07 13:59:26 +02:00
oleibman eb76c3c0ff Code Coverage >90% (#2973)
No source code changes, just additional tests. FormulaParser appears unused, replaced by newer code in Calculation. However, it's a public interface, so probably shouldn't be deleted without first deprecating it. I have no strong feelings about whether that should happen. However, as long as it's part of the package, we may as well have some formal unit tests for it.
2022-08-06 17:56:30 -07:00
Jonathan Goode 7f0ca404fc Ensure multiplication is performed on a non-array value (#2964)
* Ensure multiplication is performed on a non-array value

* Simplify formula
Numbers should be numbers

* Provide test coverage for SUM combined with INDEX/MATCH

* PHPStan
2022-08-06 17:28:26 -07:00