PhpSpreadsheet/samples/Autofilter
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
..
10_Autofilter.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
10_Autofilter_dynamic_dates.php Autofilter Part 1 2021-06-02 20:46:14 -07:00
10_Autofilter_selection_1.php Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121) 2022-10-18 18:58:38 -07:00
10_Autofilter_selection_2.php Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121) 2022-10-18 18:58:38 -07:00
10_Autofilter_selection_display.php Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121) 2022-10-18 18:58:38 -07:00