PhpSpreadsheet/tests/PhpSpreadsheetTests/Reader
Owen Leibman ae80c12ef0 CSV Reader Enhancements
This PR came about as I pondered how feasible it was to change the default escape character from backslash to null string, since the latter emulates Excel's own actions. Also, surveying issues relating to CSV, it seems that people are often in a situation where the current defaults aren't optimal for them (e.g. they are in a region where semicolon rather than comma is a better default delimiter). My case and that case can both be handled by methods after a reader is constructed. However, the issues also show that many use `IOFactory::load` rather than `new Csv()`, and the methods to affect the defaults are not available in that case.

Adding a static callback that can be invoked by the constructor addresses all these problems. This can be set as part of the user application's normal initialization, and no special attention needs to be paid to CSV loads thereafter, no matter how they are invoked.

This also makes it feasible to use 'guess' as inputEncoding, by providing a new setFallbackEncoding (default CP1252) method to use if none of the heuristic tests pass. There was already the ability to guess the encoding before `$reader->load()`, but not before `IOFactory::load`.

Almost all typehints in Reader/Csv and Reader/Csv/Delimiter are now part of the function signature rather than in the DocBlock. The exceptions are one method in Delimiter which uses a `resource` parameter, and the `canRead` and `load` methods, which must match the signature in IOFactory. I will look into changing those later.

The Csv Reader tests are moved into their own directory. All Phpstan baseline entries involving Csv Reader are eliminated.
2021-05-16 06:05:02 -07:00
..
Csv CSV Reader Enhancements 2021-05-16 06:05:02 -07:00
Gnumeric Stricter visibility 2020-07-19 12:30:31 +09:00
Html Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Ods Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Security Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Xls Stricter visibility 2020-07-19 12:30:31 +09:00
Xlsx XLSX Reader and Empty Fill Tag (#2011) 2021-04-20 17:20:59 +02:00
Xml Extract Property and Style readers from the XML Reader into separate classes (#2009) 2021-04-20 15:27:44 +02:00
CondNumFmtTest.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
OddColumnReadFilter.php Fix column names if read filter calls in XLSX reader skip columns 2018-12-10 20:00:26 +11:00
SheetsXlsxChartTest.php Fix/sheets xlsx chart (#1761) 2021-01-31 18:53:54 +01:00
SlkTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
XlsTest.php Fix for bug #1592 (UPDATED) (#1623) 2020-12-17 19:41:07 +01:00
Xlsx2Test.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
XlsxTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00