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
2.x Update PHPStan setup #2630
2.x Update PHPStan setup #2630
Conversation
I suspect these are fine packages :) |
@szepeviktor Well, they apparently were made by someone who knows his stuff 😉💪 |
I contacted Elliot and he was happy about docblock fixes but refused them. Fixing those could be also be done with |
I would gladly apply a patch on top the released stubs if you provide me one fixing functions in |
@szepeviktor Thanks for your insights!
I see 🙃.
Yes, I saw that :). I’m not familiar enough with
So, you mean I could provide you with a |
All right! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work 💎
I decided to go the easy way and just use |
# Conflicts: # src/Post.php
Issue
There are some PHP libraries we can use to provide function stubs for PHPStan instead of adding them ourselves.
Solution
Use php-stubs/acf-pro-stubs and php-stubs/wp-cli-stubs.
For now, this isn’t working because the function signature for
acf_get_field_type()
in php-stubs/acf-pro-stubs.I guess it’s because ACF uses a return type of
n/a
in the DocBlock foracf_get_field_type()
, which is translated tovoid
. But actually it should returnmixed
, when we look at the underlyingacf()->fields->get_field_type()
function.For an easy fix, we could switch to using
acf()->fields->get_field_type()
instead ofacf_get_field_type()
, but maybe this is an issue that can be fixed in the php-stubs/acf-pro-stubs library.I hope that @szepeviktor can help us out here 😊.
Impact
Less code to manage.
Usage Changes
None.