Skip to content

0.2.0

Compare
Choose a tag to compare
@BenMorel BenMorel released this 10 Oct 16:37
· 29 commits to master since this release

Breaking changes in CsvFileIterator:

  • now always skips empty lines; only the header line is not allowed to be empty when $headerRow is true
  • now throws an exception when $headerRow is true, and either or these statements is true:
    • the file is empty
    • the header row is an empty line
    • column names are not unique
    • column count of a non-empty line does not match header row's column count, unless either allowLessColumns() and/or allowMoreColumns() are configured, see below.

New methods in CsvFileIterator:

  • allowLessColumns() changes the behaviour of the iterator to not throw an exception if a row has less columns than the header row, and instead replace any missing column value with null, which was the default behaviour before this update
  • allowMoreColumns() changes the behaviour of the iterator to not throw an exception if a row has more columns than the header row, and instead ignore subsequent columns, which was the default behaviour before this update

This updates aims to harden the iterator by default, while allowing a more lenient parsing if a CSV file is known to be broken in terms of column count.