Skip to content

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

Development

Successfully merging this pull request may close these issues.

Refresh PHPStan types on each applied rules

3 participants