Skip to content

[Php80] Make configurable to allow skip on model based classes on ClassPropertyAssignToConstructorPromotionRector #7043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2025

Conversation

samsonasik
Copy link
Member

To allow configure like this:

    $rectorConfig->ruleWithConfiguration(ClassPropertyAssignToConstructorPromotionRector::class, [
        ClassPropertyAssignToConstructorPromotionRector::ALLOW_MODEL_BASED_CLASSES => false,
    ]);

default to true.

Closes rectorphp/rector#9243

@samsonasik
Copy link
Member Author

implemented /cc @ruudk

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@ruudk
Copy link
Contributor

ruudk commented Jul 5, 2025

Amazing thanks so much ⚡️

@samsonasik samsonasik requested a review from TomasVotruba July 5, 2025 18:54
@samsonasik samsonasik changed the title [Php80] Make configurable to allow skip on model based classes [Php80] Make configurable to allow skip on model based classes on ClassPropertyAssignToConstructorPromotionRector Jul 5, 2025
@@ -46,12 +57,26 @@ public function resolveFromClass(Class_ $class, ClassMethod $constructClassMetho
continue;
}

if (! $allowModelBasedClasses && $this->hasModelTypeCheck($property, 'JMS\Serializer\Annotation\Type')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use class constant enum here , to keep classes separated and non-prefixed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, updated to use class name constant enum 2ad2fd5 👍

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 3d5ce61 into main Jul 6, 2025
46 checks passed
@samsonasik samsonasik deleted the allow-model-based branch July 6, 2025 03:13
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.

Allow passing AbstractRector instances to withRules or support callable in withSkip
3 participants