-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Scoped allowCount
to fully qualified class name
#90
Conversation
After running this on my project, I think what I'm trying to do is not possible at all:
I can solve this by running without parallel processing using
To solve this, I think we need to directly use the Cache provided by PHPStan. This could solve problem 2, but I don't know if it will work with parallel processing. It feels that I'm trying to solve a problem that PHPStan was not created for. Maybe @ondrejmirtes has an insight? 🙏 |
Hi, I think you can approximate the same feature by using Let a rule report every error, and then tell PHPStan that X reports per file are okay with ignoreErrors. |
The problem is, I want the opposite. I want to allow Maybe I should have a Rule that puts the error on the source file ( But, that means that whenever a new class is generated, a new entry should be added to the |
After thinking more about this problem and how I'm trying to solve it, I came to the conclusion that PHPStan is not the best tool to do this type of blocking. I decided to solve it differently. Thanks for the feedback @ondrejmirtes |
I think this could now be solved by using PHPStan's new collectors feature. First collect all usages and counts over multiple threads. And then have another rule that uses those consolidated counts to report the errors. |
Yes, definitely! The collectors are really easy :) |
Fixes #89
See the updated readme. That should explain how the feature works now. Does it make sense?
For me it does, as I now have the following configuration in my project:
This now works with the ±20 generated Query classes we have. And it correctly errors 5 times where 1
Generated\GraphQL\Query\SomeQuery
was used 6 times.