mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-20 06:38:46 +01:00
Fix dump rectors (#4059)
* fix missing Whatever rector * [rector] fix missing Whatever rector * [cs] fix missing Whatever rector Co-authored-by: rector-bot <tomas@getrector.org>
This commit is contained in:
parent
351e59fa3b
commit
07708488a2
@ -50,21 +50,11 @@ final class RectorsFinder
|
||||
|
||||
$rectors = [];
|
||||
foreach ($foundClasses as $class) {
|
||||
// not relevant for documentation
|
||||
if (is_a($class, PostRectorInterface::class, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// special case, because robot loader is case insensitive
|
||||
if ($class === ExceptionCorrector::class) {
|
||||
if ($this->shouldSkipClass($class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
if ($reflectionClass->isAbstract()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rector = $reflectionClass->newInstanceWithoutConstructor();
|
||||
if (! $rector instanceof RectorInterface) {
|
||||
// lowercase letter bug in RobotLoader
|
||||
@ -110,6 +100,27 @@ final class RectorsFinder
|
||||
return $classNames;
|
||||
}
|
||||
|
||||
private function shouldSkipClass(string $class): bool
|
||||
{
|
||||
// not relevant for documentation
|
||||
if (is_a($class, PostRectorInterface::class, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// special case, because robot loader is case insensitive
|
||||
if ($class === ExceptionCorrector::class) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// test fixture class
|
||||
if ($class === 'Rector\ModeratePackage\Rector\MethodCall\WhateverRector') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
return $reflectionClass->isAbstract();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RectorInterface[] $objects
|
||||
* @return RectorInterface[]
|
||||
|
Loading…
x
Reference in New Issue
Block a user