Skip to content

[perf] Skip RemoveNullTagValueNodeRector for nodes without a docblock - #8625

Merged
TomasVotruba merged 2 commits into
mainfrom
perf-remove-null-tag-skip-nondoc
Oct 11, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
perf-remove-null-tag-skip-nondoc

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to the RenameClassRector phpdoc-guard optimization.

RemoveNullTagValueNodeRector subscribes to ClassMethod, Function_, Expression and Property, building a PhpDocInfo for every visited node to strip null @param/@return/@var tags. Those tags only exist in a docblock, so a single top-level getDocComment() !== null guard covers all four branches. Every branch already no-ops when the tag is absent, so behaviour is identical.

Tests: rules-tests/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector (6) green, ECS + PHPStan level 8 clean.

TomasVotruba and others added 2 commits October 11, 2026 18:42
The rule subscribes to ClassMethod, Function_, Expression and Property and built a PhpDocInfo for every node to look for null param/return/var tags. Those tags only exist inside a docblock, so guard all branches with a single getDocComment() check. Each branch already no-ops when the tag is absent, so behaviour is unchanged.
@TomasVotruba
TomasVotruba merged commit 7a010f2 into main Oct 11, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the perf-remove-null-tag-skip-nondoc branch October 11, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants