Skip to content

[ctor] Skip Doctrine entities with #[ORM\Entity] attribute in NewOverSettersRule - #307

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-entity-attribute-new-over-setters
Sep 23, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
skip-entity-attribute-new-over-setters

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Entities marked with #[ORM\Entity] are usually set/get magically, so symplify.newOverSetters should not push their setters into the constructor.

Entity skipping already existed but relied on a raw string match:

str_contains($fileContents, '@ORM\Entity') || str_starts_with($fileContents, '#[Entity]')

The second branch was dead (files start with <?php) and missed the #[ORM\Entity] attribute form entirely.

Now detection reads attribute reflection for Doctrine\ORM\Mapping\Entity, with the @ORM\Entity annotation kept as fallback. Added a source + fixture covering the attribute form.

@TomasVotruba
TomasVotruba merged commit 73263cf into main Sep 23, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the skip-entity-attribute-new-over-setters branch September 23, 2026 12:14
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.

1 participant