-
Notifications
You must be signed in to change notification settings - Fork 146
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
add phpstan check to ci #201
add phpstan check to ci #201
Conversation
Hm, somethings is wrong, I don't see TravisCI was executed on this PR :/ |
Me neither... Is there any issue with the modifications on the |
Hm, try to add a new empty commit, e.g. |
According to https://travis-ci.org/knpuniversity/oauth2-client-bundle/requests it seems that something is wrong with the
|
1e11f8f
to
eed5625
Compare
travis-ci does not seem to support [ "$LINT" = 1 ] && ./vendor/bin/phpstan analyse by if [ "$LINT" = 1 ]; then ./vendor/bin/phpstan analyse; fi; Did not know that... Too bad... :/ |
Hey @brambaud! Thanks for the PR :). I would be interested in decreasing the level until there are a reasonable level of failures. And then yes, we would fix them in this PR to get things green. Then we could investigate increasing the level over time if we want. Cheers! |
The level has been decreased to level 1 :) The errors like We have 3 remains errors: ------ ------------------------------------------------------------------
Line DependencyInjection/Providers/GeocachingProviderConfigurator.php
------ ------------------------------------------------------------------
32 Class League\OAuth2\Client\Provider\Geocaching not found.
------ ------------------------------------------------------------------
------ -----------------------------------------------------------------
Line DependencyInjection/Providers/InstagramProviderConfigurator.php
------ -----------------------------------------------------------------
26 Class League\OAuth2\Client\Provider\Instagram not found.
------ -----------------------------------------------------------------
------ ------------------------------------------------------------
Line DependencyInjection/Providers/JiraProviderConfigurator.php
------ ------------------------------------------------------------
26 Class Mrjoops\OAuth2\Client\Provider\Jira not found.
------ ------------------------------------------------------------ IMHO they are false positive. Within the context using |
I guess? I've used libraries that have phpstan on them, but have never configured it myself. I'm not sure if there's a better way. |
… for those providers `::getProviderClass()` method
Since the error is very generic the other way I can think of is to write a custom error filter. |
Thanks @brambaud! If someone knows of a better way to ignore these errors (or even a change in the code itself to help), they can let us know. |
I'd be happy to take a look at these over the weekend. From a quick look, there only looks to be 8 or 9 actual distinct issues. Most of the 90+ issues with ResourceOwnerInterface is just the @return type causing PHPStan to complain. It's actually a mix of the error where the various ::class are not known yet, because they aren't required dependencies, but then also the comment on #33 about removing |
#204 is ready. It looks like some of the recent commits to Symfony/Symfony dev-master also removed the Treebuilder::root, so I've made those checks more robust as well. I'm happy to drop that, or some of the other commits, from the PR, if you think they are a little too strict. |
Ah, I commented about this, but now I understand better. That is by design - the deprecated |
I did take another look at this, and managed to do without the reversal. Take a look and let me know if there is anything else I can do (or, equally, drop) to finish this up. |
See issue #88
Here's a first try to integrate phpstan :)
With the higher phpstan level (the higher the stricter), i.e. 7, there is at this moment 221 errors detected.
Not all of them are relevant IMHO.
For instance there is a lot of "errors" like
Return typehint of method KnpU\OAuth2ClientBundle\Client\Provider\SlackClient::fetchUserFromToken() has invalid type AdamPaterson\OAuth2\Client\Provider\SlackResourceOwner.
that could be ignore.I'd like to have opinion of others about how to proceed about the detected errors.
Do we handle them in this PR?
Which errors should be ignored?
Should we decrease the phpstan level at first and increase it little by little?