Skip to content

Commit

Permalink
Documenting a solution for missing classes
Browse files Browse the repository at this point in the history
  • Loading branch information
liarco authored Sep 15, 2021
1 parent ae01efe commit fd9fdda
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion build/target-repository/docs/static_reflection_and_autoload.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,19 @@ If the false positive still happen, you can skip the rule applied as last resort
__DIR__ . '/src/HasChildClass.php',
],
]);
```
```

### Dealing with "Class ... was not found while trying to analyse it..."
Sometimes you may encounter this error ([see here for an example](https://github.com/rectorphp/rector/issues/6688)) even if the class is there and it seems to work properly with other tools (e.g. PHPStan).

In this case you may want to try one of the following solutions:
```php
$parameters->set(Option::AUTOLOAD_PATHS, [
// the path to the exact class file
__DIR__ . '/vendor/acme/my-custom-dependency/src/Your/Own/Namespace/TheAffectedClass.php',
// or you can specify a wider scope
__DIR__ . '/vendor/acme/my-custom-dependency/src',
// WARNING: beware of performances, try to narrow down the path
// as much as you can or you will slow down each run
]);
```

0 comments on commit fd9fdda

Please sign in to comment.