Skip to content

[depre] Deprecate YamlToAttributeDoctrineMappingRector - #492

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-yaml-to-attribute-mapping
Jul 31, 2026
Merged

[depre] Deprecate YamlToAttributeDoctrineMappingRector#492
TomasVotruba merged 1 commit into
mainfrom
deprecate-yaml-to-attribute-mapping

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

YamlToAttributeDoctrineMappingRector covers only a fraction of YAML mapping features. Anything beyond the basic cases silently produces incomplete or wrong attributes - e.g. missing nullable, dropped cascade/fetch options, lost lifecycle callbacks and custom types.

YAML mapping is project specific by nature, so a custom rule tailored to the actual mapping is a safer path than a generic half-covering rule.

What the rule does now

final class YamlToAttributeDoctrineMappingRector extends AbstractRector implements DeprecatedInterface
{
    public function refactor(Node $node): ?Node
    {
        throw new ShouldNotHappenException(sprintf(
            '"%s" is deprecated and should not be used anymore. Remove it from your config files.',
            self::class,
        ));
    }
}

Removed services

The rule was the only consumer of these, so they go with it:

  • 20 classes in rules/CodeQuality/AttributeTransformer/
  • EntityMappingResolver, ValueObject/EntityMapping
  • Contract/ClassAttributeTransformerInterface, Contract/PropertyAttributeTransformerInterface
  • orphaned helpers: Helper/NodeValueNormalizer, NodeFactory/AttributeFactory, Utils/CaseStringHelper

BC

DoctrineSetList::YAML_TO_ANNOTATIONS and its config file are kept, the config is now empty. Existing configs referencing the set keep loading.

The rule covers only a fraction of YAML mapping features and silently
produces incomplete or wrong attributes on anything beyond the basics.
Handle YAML to attribute mapping with custom rules tailored to the
project mapping instead.

Rule now implements DeprecatedInterface and throws on use. All services
it exclusively used are removed: 20 attribute transformers, entity
mapping resolver, value object, contracts and helpers.
@TomasVotruba
TomasVotruba merged commit 125eaf1 into main Jul 31, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-yaml-to-attribute-mapping branch July 31, 2026 20:33
TomasVotruba added a commit that referenced this pull request Aug 3, 2026
It was only needed by YamlToAttributeDoctrineMappingRector, deprecated in #492.
There is no Symfony\Component\Yaml usage left in the package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant