You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generic transformers: the dashes of the codes of their transformers and contextual options are replaced by underscores #438
Since 5.7 (#412), the codes of the processes, of their tasks and of the generic transformers keep their dashes, and their former name (dashes replaced by underscores) is deprecated. But the keys of the transformers and contextual_options of a generic transformer are still normalized by the Symfony configuration:
a generic transformer referencing another generic transformer whose code has a dash, by its code as written, triggers the 5.7 deprecation of the former name: the user cannot fix it, and the reference will fail in v6.0;
a generic transformer referencing a transformer service whose code has a dash (#[AsTransformer(code: 'x-y')]) fails: No transformer with code x_y (before 5.7 as well);
a contextual option whose code has a dash is registered with an underscore: the option given with its dash is unknown, and {{ my-option }} is not replaced.
Actual: [ABC], with the deprecation Using the generic transformer "demo-upper" by the name "demo_upper", with underscores instead of dashes, is deprecated: use its code "demo-upper".
Expected: [ABC] without deprecation.
Tested on v5.8, PHP 8.5, Symfony 7.4.
Cause
Configuration::appendTransformerConfigDefinition(): the transformers and contextual_options nodes do not call normalizeKeys(false), unlike the generic_transformers, configurations and tasks nodes since 5.7.
Proposed fix
normalizeKeys(false) on the transformers and contextual_options nodes. The keys of the options of the processes and of the tasks are still normalized (unchanged: an option foo-bar may be read as foo_bar by a task).
Requirements
Documentation updates
Reference
Cookbooks
Changelog
Unit tests
Breaking changes
None for the transformers: a code written with a dash now references the transformer of this code (the former name of a generic transformer still works, with its deprecation). A contextual option written with a dash in contextual_options but given and referenced with an underscore ({{ my_option }}) must be written with an underscore.
Activity
Merge pull request #439 from cleverage/438