mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 16:30:51 +00:00
[Doc] Autoload Troubleshooting (#860)
* [Doc] Autoload Troubleshooting * more detailed usage * update to skip rector rule if children still not detected even with composer dump-autoload -o
This commit is contained in:
parent
40bd8926d3
commit
0c36bf8769
|
@ -52,3 +52,26 @@ Listed files will be executed like:
|
|||
```php
|
||||
include $filePath;
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Sometime, when we run Rector to class that detect children class, like `\Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector`, we may experience that parent class changed to final while it has children class, it because of the `PHPStan\Reflection\ReflectionProvider` cannot get all classes on scanning it on usage via `FamilyRelationsAnalyzer` service.
|
||||
|
||||
To avoid this issue, you may dump all classes via composer:
|
||||
|
||||
```bash
|
||||
composer dump-autoload -o
|
||||
```
|
||||
|
||||
before run the rector.
|
||||
|
||||
If the false positive still happen, you can skip the rule applied as last resort to do:
|
||||
|
||||
```php
|
||||
$parameters->set(Option::SKIP, [
|
||||
\Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class => [
|
||||
// classes that has children, and not detected even with composer dump-autoload -o
|
||||
__DIR__ . '/src/HasChildClass.php',
|
||||
],
|
||||
]);
|
||||
```
|
Loading…
Reference in New Issue
Block a user