-
Notifications
You must be signed in to change notification settings - Fork 3
Simplify PHPStan configuration #3
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
Conversation
Signed-off-by: Viktor Szépe <viktor@szepe.net>
|
Thanks again @szepeviktor Merging here on |
|
Hi @szepeviktor , I finally merged your simplification into Running into an issue with phpstan that I cannot figure, as far as I can tell it properly pulls in the WordPress stubs but it seems to be confused about number of parameters: It's not complaining about all WordPress functions, only some. For now I am ignoring these specific errors so I can see the real issues being brought up. Any idea where is this coming from? Some extra libraries being imported unnecessarily? Thanks in advance Link to phpstan.neon.dist |
|
Investigating 🏃🏻♂️ |
|
On PHP 7.4 I get |
|
I was getting the errors when running locally, either: grunt shell:phpstanor directly: ./vendor/bin/phpstan analyze |
|
Try clearing composer cache, removing |
|
clearing the cache made no difference :-( |
|
I see. All I can see static analysis here on GitHub Actions recognizes those functions. |
|
Thanks, your help is much appreciated. Will try on a different computer with a clean state. |
|
I wish you to keep all of your computers clean all the time. |
|
On a clean computer it works as expected, thanks for your help. Yes, I have to figure what exactly is messing with phpstan. |
|
Really puzzling, still running into this error on one computer:
Since I am seeing the error in a brand new git clone the cause must reside outside of the git repo folder. Beyond phpstan and composer caches not sure what it can be. I also nuked the Also, using |
From the extension's configuration: https://github.com/szepeviktor/phpstan-wordpress/blob/master/extension.neon#L116 |
So that's under |
No, it is loaded from the extension. |
|
Maybe I am looking at it the wrong way and it's not a caching issue, what would generate an error like:
How does phpstan determine that admin_url requires 0 parameters? I checked the stub and the stub has the expected signature which is: function admin_url($path = '', $scheme = 'admin')
{
} |
|
Search for |
$ find . -name \*.php -exec grep -iHn "function admin_url" {} \;
./vendor/php-stubs/wordpress-stubs/wordpress-stubs.php:110462: function admin_url($path = '', $scheme = 'admin')
./wordpress/wp-includes/link-template.php:3522:function admin_url( $path = '', $scheme = 'admin' ) {
./wordpress/wp-admin/includes/noop.php:80:function admin_url() {}This is the suspicious one: I deleted the whole Questions:
|
|
Answering question 2, on the machine where phpstan worked, there is also the exact same |
|
|
|
Here is our perpetrator!!! Line 65 in e842276
|
|
The content of parameters:
level: 5
inferPrivatePropertyTypeFromConstructor: true
bootstrapFiles:
- tests/phpstan-bootstrap.php
paths:
- hello-login.php
- includes/ |
|
The cause is in the previous comment! |
So on some machines classes are loaded in some order and on other machines in a different one? |
That makes the difference. |
Yes, removing |
I don't think it's that, running |
|
adding: excludePaths:
- wordpress/also works, yay! |
|
köszönöm szépen |
All Submissions: