Repository navigation
[v6] #280 - TransformerRegistry: require the code tag attribute and remove eager transformer registration - #515
Merged
Merged
Conversation
… eager transformer registration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #280 (v6.0 step of #276): the code of a transformer is only given by the
codeattribute of itscleverage.transformertag, or by#[AsTransformer(code: '...')], and the eager registration deprecated in 5.4 is removed:TransformerLocatorCompilerPass: a service taggedcleverage.transformerwithout anycodefails the container compilation with an explicit message (a dedicated one for a transformer of the bundle redeclared by the application, which loses the tag of the bundle). The code-less tag added by the autoconfiguration ofTransformerInterfaceis ignored next to the tag of#[AsTransformer]. An abstract definition is skipped without code and rejected with a code (its children must be tagged);TransformerRegistry:addTransformer()is removed, the service locator is a required constructor argument,getTransformer()/hasTransformer()/getTransformers()only give the transformers of the locator (in its order), the check "code of the locator ===getCode()" is removed.TransformerRegistryInterface::getTransformerCodes(): list<string>gives the codes without instantiating the transformers (getTransformers()is kept);TransformerInterface::getCode()is removed, as well as thegetCode()method of the 37 transformers of the bundle (GenericTransformerandUnavailableTransformerkeep their own, outside of the interface);UnavailableServicesCompilerPassonly reads the code of the tag (no more reflection ongetCode()): a definition tagged without code is kept (the locator pass fails), an untagged one is replaced with its class as code;RegistryCompilerPassand its test are removed;TransformerCodesTest), non-regression with the real autoconfiguration (TransformerAutoconfigurationTest), compiler passes and registry cases;#[\Override]/parent::getCode(),addTransformer()in tests with aServiceLocator, new interface method, subclasses of the registry).Also covers items of #292 (eager registration,
RegistryCompilerPass,getCode(), reflection fallback ofUnavailableServicesCompilerPass);CheckSerializerCompilerPassand the$deprecatedCodesargument stay in #292.Bridges: only soap-process-bundle has a transformer, already tagged with its code; its own
getCode()(without#[\Override]) still works. Follow-up when the bridges support the core v6: soap comments/test still referring togetCode().Checked locally: tests with pcov coverage (no risky test), PHPStan, PHP-CS-Fixer and Rector OK.
Requirements
Breaking changes
cleverage.transformerwithoutcode(e.g. a transformer autoconfigured without#[AsTransformer]) fails the container compilation.TransformerInterface::getCode(), thegetCode()method of the transformers of the bundle,TransformerRegistry::addTransformer()andRegistryCompilerPassare removed; the locator is required by theTransformerRegistryconstructor;TransformerRegistryInterfacedeclaresgetTransformerCodes().See
UPGRADE.md.🤖 Generated with Claude Code