Skip to content

Add generics to AbstractRector, RectorInterface and ConfigurableRectorInterface - #8330

Open
mspirkov wants to merge 4 commits into
rectorphp:mainfrom
mspirkov:improve-abstract-rector
Open

Add generics to AbstractRector, RectorInterface and ConfigurableRectorInterface#8330
mspirkov wants to merge 4 commits into
rectorphp:mainfrom
mspirkov:improve-abstract-rector

Conversation

@mspirkov

@mspirkov mspirkov commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

I’m developing an extension for Rector and I’ve come across some PHPStan errors:

image

I propose solving this as follows:

  1. Add generics to AbstractRector, RectorInterface, and ConfigurableRectorInterface.
  2. Specify the return type as list for getNodeTypes, since it is essentially always list.

This will also make the code more concise and clear, in my opinion.

@mspirkov
mspirkov marked this pull request as ready for review August 9, 2026 17:07
@mspirkov

mspirkov commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

I see that rector-laravel also has this error, but it’s simply ignored: https://github.com/driftingly/rector-laravel/blob/2636a2af80ecb35fff8dd1e5d67ff939becb2673/phpstan.neon#L23

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.

1 participant