Skip to content

[dx] Make registration of custom NodeVisitor is easier#7669

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-shorter-class-name
Nov 26, 2025
Merged

[dx] Make registration of custom NodeVisitor is easier#7669
TomasVotruba merged 2 commits into
mainfrom
tv-shorter-class-name

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Nov 26, 2025

This feature is really useful https://getrector.com/documentation/creating-a-node-visitor,
but it's way too complicated to register. Let's make it simple 👍

Ref rectorphp/getrector-com#3455


Before

<?php

use Rector\Config\RectorConfig;
use My\Rector\Visitor\HelloVisitor;
use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface;

return RectorConfig::configure()
    ->registerService(HelloVisitor::class, null, ScopeResolverNodeVisitorInterface::class);

Now

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->registerDecoratingNodeVisitor(IsAssignedLeftNodeVisitor::class);

…plicit DecoratingNodeVisitorInterface, make its registration simple
@TomasVotruba TomasVotruba changed the title tv shorter class name [dx] Make registration of custom NodeVisitor is easier Nov 26, 2025
@TomasVotruba TomasVotruba merged commit 4722f41 into main Nov 26, 2025
54 checks passed
@TomasVotruba TomasVotruba deleted the tv-shorter-class-name branch November 26, 2025 10:51
@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 Apr 26, 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.

1 participant