Skip to content

[dead-code] Add RemoveNullArgOnNullDefaultParamRector#7562

Merged
TomasVotruba merged 3 commits into
mainfrom
tv-remove-null-to-default-pass
Oct 24, 2025
Merged

[dead-code] Add RemoveNullArgOnNullDefaultParamRector#7562
TomasVotruba merged 3 commits into
mainfrom
tv-remove-null-to-default-pass

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Oct 24, 2025

Kicking off here. Will need more work like case where null is not the last parameter:

public function someMethod($first = null, $second = 100)
{
}

@TomasVotruba TomasVotruba merged commit 885315a into main Oct 24, 2025
53 checks passed
@TomasVotruba TomasVotruba deleted the tv-remove-null-to-default-pass branch October 24, 2025 10:39

$hasChanged = false;

foreach ($node->getArgs() as $position => $arg) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The loop can be from last position, to avoid jump removed args, if early no default, not null/named/unpack, stop loop early.

I will create new PR for improvement.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants