Skip to content

#143 - Type the remaining untyped task options - #254

Merged
njoubert-cleverage merged 1 commit into
mainfrom
143-option-types
Oct 9, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
143-option-types

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Refs #143. Follow-up of the PHPStan level 9/10 analysis (see #253): typing these options does not need v6.0, as no value that works today is rejected.

Task options declared without type validation (the other ones were typed in #228; mode is already typed in AbstractCsvTask):

  • split_character of CsvWriterTask and SplitJoinLineTask: setAllowedTypes(['string']). A wrong type used to fail later with a TypeError (implode() / explode() under strict_types), it is now an InvalidOptionsException when the options are resolved;
  • write_headers of CsvWriterTask and log_empty_lines of CsvReaderTask: cast to bool by a normalizer. They are only read in a condition, so any value (1, 0, 'yes'…) used to be evaluated as a boolean: it is cast instead of being rejected, to keep it working.

Tests added in OptionAllowedTypesTest (invalid and valid split_character, bool cast of write_headers and log_empty_lines). On main, the 6 new cases fail. PHPStan, PHPUnit (846 tests), PHP-CS-Fixer and Rector pass.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: a non-string split_character already failed (later, with a TypeError), and boolean options accept any value as before.

🤖 Generated with Claude Code

…er of CsvWriterTask and SplitJoinLineTask must be a string, write_headers of CsvWriterTask and log_empty_lines of CsvReaderTask are cast to bool

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 23a667b into main Oct 9, 2026
17 checks passed
@njoubert-cleverage
njoubert-cleverage deleted the 143-option-types branch October 9, 2026 10:06
@njoubert-cleverage njoubert-cleverage mentioned this pull request Oct 9, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant