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

[code-quality] Skip complex new instance with args assigns in InlineArrayReturnAssignRector #6762

Merged
merged 1 commit into from
Mar 2, 2025

Conversation

TomasVotruba
Copy link
Member

No description provided.

@TomasVotruba TomasVotruba changed the title [code-quaity] Skip complex new instance with args assigns in InlineArrayReturnAssignRector [code-quality] Skip complex new instance with args assigns in InlineArrayReturnAssignRector Mar 2, 2025
@TomasVotruba TomasVotruba merged commit 5a833e0 into main Mar 2, 2025
44 checks passed
@TomasVotruba TomasVotruba deleted the tv-skip-array-dim-assign branch March 2, 2025 15:24
@@ -187,6 +188,12 @@ private function areAssignExclusiveToDimFetch(array $stmts): bool
}

$assign = $stmt->expr;

// skip new X instance with args to keep complex assign readable
if ($assign->expr instanceof New_ && $assign->expr->getArgs() !== []) {
Copy link
Member

Choose a reason for hiding this comment

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

isFirstClassCallable() need to be checked, or just use direct count($assign->expr->args) > 0 since getArgs() use assert

Copy link
Member

Choose a reason for hiding this comment

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

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