szepeviktor / phpstan-wordpress

WordPress extensions for PHPStan ⛏️
https://packagist.org/packages/szepeviktor/phpstan-wordpress
MIT License
262 stars 26 forks source link

WP_CLI::error() doesn't always terminate #213

Open johnbillion opened 6 months ago

johnbillion commented 6 months ago

The WP_CLI::error() method is marked as an early terminating method, but it doesn't terminate if the $exit parameter is set to false.

Its entry in the earlyTerminatingMethodCalls config should be removed and replaced with something else that's conditional, but I'm not sure what.

szepeviktor commented 6 months ago

I tell you not to use that $exit parameter. Just like https://github.com/szepeviktor/phpstan-wordpress/blob/f7ff091331bc00c5688fe4ce0c4d51d06fa61553/README.md?plain=1#L119

It feels really-really bad to handle these parts of WordPress. That is all I could contribute.

herndlm commented 6 months ago

a conditional return type using https://phpstan.org/writing-php-code/phpdoc-types#bottom-type in stubs might work 🤔 https://phpstan.org/r/cf63373b-41ba-4298-9639-26051d6eb5fb