Skip to content

#200 - Fix GenericTransformer - #211

Merged
njoubert-cleverage merged 3 commits into
mainfrom
200
Sep 28, 2026
Merged

njoubert-cleverage merged 3 commits into
mainfrom
200

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #200.

A contextual option of a generic transformer declared with required: false and no default (nor default_is_null) cannot be used at all: it is neither required nor defined in the transformer options resolver, so passing it throws an UndefinedOptionsException, and omitting it throws a NoSuchOptionException when the placeholders are resolved.

This PR:

  • declare every contextual option with setDefined();
  • when an optional option without default is omitted, replace its placeholders by null;
  • add unit tests for GenericTransformer (required option, option with default, optional option provided / omitted);
  • update docs/reference/transformers/generic_transformer.md (Notes) and docs/reference/03-generic_transformers_definition.md.

The new regression tests fail on main and pass with this fix. PHPUnit, PHPStan, PHP-CS-Fixer and Rector pass.

Requirements

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

Breaking changes

None: such an option currently always fails.

🤖 Generated with Claude Code

…lared with `required: false` and no default can now be used; its placeholders are replaced by `null` when omitted. Update documentation, add tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
njoubert-cleverage and others added 2 commits September 28, 2026 13:59
…ng risky tests when coverage is enabled

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 7426dca into main Sep 28, 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.

GenericTransformer: an optional contextual option without default value cannot be used

1 participant