-
-
Notifications
You must be signed in to change notification settings - Fork 21
Add @phpstan-return never #110
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Thank you. Do we still need szepeviktor/phpstan-wordpress#201? |
Yes. The extension handles wp_die. This PR handles functions that call eg wp_die. |
Is it possible to add some exceptions to this rule? For example And now PHPStan complains that my widget's |
Does adding a return type |
It does not. Adding |
We could have an exception list for everything. And we just go crazy 🤯 "thanks" to (governance-less) WordPress. My contribution to the WordPress ecosystem should stop and my related packages be abandoned. |
Please add this error to your ignore list. |
Yeah that's what I did now |
Viktor we know how you think about WordPress, but please don't forget that the users here are most likely the ones that want to make things better or are somewhat aware of the bad sides of WordPress :) |
I know that, Martin. |
BTW We cannot make WordPress better, John and Ian is sending PR-s here, not to core! |
I just refuse to learn how to deal with this Core Trac thing. Getting old and inflexible. Regarding |
This is simple. |
I've just seen the abandon warning 😧 |
Here is a special viktor-smiley for you
" # ~~`"`~~ |
Hi @szepeviktor, thanks for your hard work on this, it is highly appreciated! This seems to be caused issues for me as well. In particular I now get |
Hello Tobias! 👋🏻 We could have an exception list for this new feature. |
If "function Class_Name::methode_name() must be overridden in a subclass." is the standard way of dying for methods that must be overridden, we can exclude all those dying methods. |
These are affected:
|
@szepeviktor, I totally understand that you are frustrated, and I'm really sorry about that. |
Thank you for your helpful attitude. |
We seem to have the same issue some are having here.
So the current solution is to add these to the ignored errors? (which is weird since #133 seems to fix this issue 🤔) Note: I try to spread the word about potential sponsors, I've seen your notice yesterday. |
🤦 |
This PR adds
@phpstan-return never
to functions/methods that will never return a value, and always terminate with a call todie
/exit
,wp_die
,wp_send_json
,wp_send_json_success
orwp_send_json_error
.There are some functions that are not covered yet. Cases that are not covered are:
wp_die()
that uses a variable as 3rd argument (e.g. wp_nonce_ays()),wp_die()
that explicitly sets the default value for 'exit' (e.g.wp_die('', '', ['exit' => true])
).Related to #36
List of functions/methods affected