Skip to content
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

[Php80] Handle constructor promotion on MixedTypeRector #3051

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Nov 11, 2022

Failing Test for MixedTypeRector

Discovered while working on doctrine/orm#9772
What happens currently is rector gets the order of the type and the visibility mixed (get it?) up.

Based on https://getrector.org/demo/a5d5e17c-d965-430d-81cb-750887599963

@samsonasik
Copy link
Member

Could you try provide a patch for it? The param probably require re-print on constructor promotion, on

$param->type = new Identifier('mixed');

something like:

$param->type = new Identifier("mixed");
if ($param->flags !== 0) {
    $param->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::ORIGINAL_NODE, null);
}

@greg0ire greg0ire force-pushed the patch-1 branch 2 times, most recently from 11b1901 to d753a7e Compare November 11, 2022 17:49
@samsonasik
Copy link
Member

Please update PR title to something like:

[Php80] Handle constructor promotion on MixedTypeRector

@greg0ire greg0ire changed the title Add failing test fixture for MixedTypeRector [Php80] Handle constructor promotion on MixedTypeRector Nov 11, 2022
@greg0ire greg0ire requested review from samsonasik and removed request for TomasVotruba November 11, 2022 17:55
Copy link
Member

@samsonasik samsonasik left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@samsonasik samsonasik merged commit a8fd5aa into rectorphp:main Nov 11, 2022
@samsonasik
Copy link
Member

Thank you @greg0ire

@greg0ire greg0ire deleted the patch-1 branch November 11, 2022 19:03
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.

2 participants