Use an AST to validate use statements
nusje2000 opened this issue · comments
nusje2000/phpstan-monolith uses PHP Stan to validate use statements in source code based on the composer.json, but this currently has a few limitations:
- It is build with PHP Stan so the error's cannot be fixed automatically with an autofixer
- PHP Stan is significantly slower when using the extension
- Errors can be confusing to read since one missing package can lead to hundreds of errors
- Due to the caching that phpstan uses, updating the composer.json will not resolve the errors because the cached errors are shown
This should not be difficult to achieve using the nikic/PHP-Parser package.
This should also come with a feature to generate a baseline for the errors that occur to be fixed later.