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

[CodeQuality] Add Variable support on class arg on InlineIsAInstanceOfRector #3261

Merged
merged 3 commits into from
Jan 2, 2023

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Jan 1, 2023

Per @staabm comment on PR:

This PR add Variable support on transforming is_a to instanceof on InlineIsAInstanceOfRector, ref https://3v4l.org/WUiel

@samsonasik
Copy link
Member Author

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

*/
public function run(object $object, string $type)
{
return is_a($object, $type);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need another test which verifies that is_a() with a non-class-string 2nd arg is skipped

Copy link
Member Author

Choose a reason for hiding this comment

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

That's not needed, all variables seems fine

Copy link
Member Author

Choose a reason for hiding this comment

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

If there is a bug on variable usage for 2nd arg (class arg) after transformation, then the bug is on the original is_a

@TomasVotruba
Copy link
Member

Very nice improvement :) thanks!

@TomasVotruba TomasVotruba merged commit 47fa234 into main Jan 2, 2023
@TomasVotruba TomasVotruba deleted the add-variable-class-support branch January 2, 2023 11:54
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