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

[EarlyReturn][Php80] Fix used along tweak between Php8ResourceReturnToObjectRector+ChangeOrIfReturnToEarlyReturnRector #1984

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

samsonasik
Copy link
Member

Previously, when Php8ResourceReturnToObjectRector and ChangeOrIfReturnToEarlyReturnRector, it requires tweak:

private function isMaybeUsedAlongWithResourceToObjectRector(BooleanOr $booleanOr): bool
{
if ($booleanOr->left instanceof FuncCall) {
if (! $this->nodeNameResolver->isName($booleanOr->left, 'is_resource')) {
return false;
}
return $booleanOr->right instanceof Instanceof_;
}
if ($booleanOr->right instanceof FuncCall) {
if (! $this->nodeNameResolver->isName($booleanOr->right, 'is_resource')) {
return false;
}
return $booleanOr->left instanceof Instanceof_;
}
return false;
}

and

if ($this->isMaybeUsedAlongWithResourceToObjectRector($node->cond)) {
return null;
}

This PR remove it, by check BooleanOr left or right is an Instanceof_ object.

By this PR, I think Refresh PHPStan tweak issue mostly fixed in rector-src code base.

Fixes rectorphp/rector#6723
Closes #1297

…turnToObjectRector+ChangeOrIfReturnToEarlyReturnRector
@samsonasik
Copy link
Member Author

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

@samsonasik samsonasik changed the title [Core]EarlyReturn][Php80] Fix used along tweak between Php8ResourceReturnToObjectRector+ChangeOrIfReturnToEarlyReturnRector EarlyReturn][Php80] Fix used along tweak between Php8ResourceReturnToObjectRector+ChangeOrIfReturnToEarlyReturnRector Apr 1, 2022
@samsonasik samsonasik changed the title EarlyReturn][Php80] Fix used along tweak between Php8ResourceReturnToObjectRector+ChangeOrIfReturnToEarlyReturnRector [EarlyReturn][Php80] Fix used along tweak between Php8ResourceReturnToObjectRector+ChangeOrIfReturnToEarlyReturnRector Apr 1, 2022
@TomasVotruba
Copy link
Member

Thanks 👍

@TomasVotruba TomasVotruba merged commit 3596755 into main Apr 1, 2022
@TomasVotruba TomasVotruba deleted the fix-used-along-change-or-fi branch April 1, 2022 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants