Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting a solution for missing classes #889

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
]);
```