Skip to content

Conversation

@Wohlie
Copy link
Contributor

@Wohlie Wohlie commented Sep 21, 2022

Hi, the downgraded version create a fatal error for RemoveDeadInstanceOfRector:
https://getrector.org/demo/fdba3d0f-4f97-4d01-9512-9dd71cb6730a

Because the type of null|array|If_ will be converted to ?array for processMayDeadInstanceOf.

This is just a quick fix, but I think on downgrades the real type should be used and not the doc types. But maybe the type came from PhpStan, I don't know.

@Wohlie Wohlie force-pushed the fix/crash-of-remove-dead-instance-of-rector branch from caf433c to c78aa97 Compare September 21, 2022 19:51
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.

The real bug possibly came from DowngradeUnionTypeDeclarationRector:

https://github.com/rectorphp/rector-downgrade-php/blob/d75c674779ffbbb96e2b02074b1e2877dc37781d/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php#L93

but this can be the solution for now while we can create a real patch in different PR for the use case like this

I am ok with this 👍

@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit f846afc into rectorphp:main Sep 22, 2022
@Wohlie Wohlie deleted the fix/crash-of-remove-dead-instance-of-rector branch September 30, 2022 21:09
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.

4 participants