Skip to content

[Cleanup] Remove write-only CallLikeThisBoundClosureArgsNodeVisitor and its unread attribute - #8373

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-remove-dead-node-visitors
Aug 25, 2026
Merged

[Cleanup] Remove write-only CallLikeThisBoundClosureArgsNodeVisitor and its unread attribute#8373
TomasVotruba merged 1 commit into
mainfrom
tv-remove-dead-node-visitors

Conversation

@TomasVotruba

@TomasVotrubaTomasVotruba commented Aug 25, 2026

Copy link
Copy Markdown
Member

CallLikeThisBoundClosureArgsNodeVisitor sets the AST attribute IS_CLOSURE_USES_THIS ('has_this_closure') which is never read anywhere — not in src/, rules/, nor any sibling dev-main package (rector-downgrade-php, rector-symfony, rector-phpunit, ...). The only hasAttribute on the key sits inside the visitor's own guard; nothing consumes it.

It runs on every traversal via DECORATING_NODE_VISITOR_CLASSES yet produces nothing — pure overhead.

Removes:

  • CallLikeThisBoundClosureArgsNodeVisitor
  • CallLikeExpectsThisBoundClosureArgsAnalyzer (only that visitor used it)
  • the unread AttributeKey::IS_CLOSURE_USES_THIS constant
  • its registration + import in LazyContainerFactory

Pure deletion, 147 lines, no behavior change:

 private const array DECORATING_NODE_VISITOR_CLASSES = [
...
ClassConstFetchNodeVisitor::class,
- CallLikeThisBoundClosureArgsNodeVisitor::class,
ArgNotAcceptingClosureNodeVisitor::class,
];

Note: PhpVersionConditionNodeVisitor was in an earlier revision of this PR but is kept — its PHP_VERSION_CONDITIONED attribute is read cross-package by DowngradeHashAlgorithmXxHashRector in rector-downgrade-php.

@TomasVotruba
TomasVotrubaforce-pushed the tv-remove-dead-node-visitors branch from c778948 to b887698CompareAugust 25, 2026 07:22
@TomasVotrubaTomasVotruba changed the title [Cleanup] Remove 2 write-only decorating node visitors and their unread attributes[Cleanup] Remove write-only CallLikeThisBoundClosureArgsNodeVisitor and its unread attributeAug 25, 2026
@TomasVotruba
TomasVotruba merged commit e8e1c7a into mainAug 25, 2026
43 of 44 checks passed
@TomasVotruba
TomasVotruba deleted the tv-remove-dead-node-visitors branch August 25, 2026 07:26
Sign up for freeto 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.

1 participant

@TomasVotruba