Skip to content

#365 - array_element / array_last without warning, documentation gaps - #366

Merged
njoubert-cleverage merged 2 commits into
mainfrom
365
Oct 23, 2026
Merged

njoubert-cleverage merged 2 commits into
mainfrom
365

Conversation

@njoubert-cleverage

@njoubert-cleverage njoubert-cleverage commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes #365.

  • ArrayElementTransformer (array_element): null when the index is outside the array, at either end. After the end, there is no more "Undefined array key" PHP warning (an exception in debug mode, null in production); before the start (negative index), the first element is no longer returned (what array_slice() gives).
  • ArrayLastTransformer (array_last): null for an empty array, without warning.
  • InputCsvReaderTask (input_csv_reader): an input that is not a path (e.g. null) throws an explicit UnexpectedValueException ("The input of the input_csv_reader task must be the path of the file to read, "null" given."), instead of an "Undefined array key "file_path"" PHP warning followed by a TypeError (dirname()).
  • Documentation: rate n/a items/s of advanced_stat_counter, headers: [] of csv_reader / input_csv_reader (UnexpectedValueException), optional $accessor of ConditionTrait, ParsedExpression accepted by the condition of rules.
  • Tests: ArrayElementTransformerTest, ArrayLastTransformerTest, CsvReaderTaskTest (they fail with the PHP warnings without the fix, failOnWarning).

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

Behaviour change, to be mentioned in the UPGRADE.md section of the release: in debug mode, array_element / array_last outside the array return null instead of failing; a negative index of array_element before the start of the array returns null instead of the first element.

🤖 Generated with Claude Code

njoubert-cleverage and others added 2 commits October 23, 2026 11:21
…ut warning; documentation gaps (advanced_stat_counter rate, CSV headers: [], ConditionTrait accessor, rules ParsedExpression)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…a path (null), instead of a PHP warning and a TypeError

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 2c0efb6 into main Oct 23, 2026
17 checks passed
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.

Documentation gaps of a few tasks and transformers, array_element / array_last without warning

1 participant