phpstan-wordpress icon indicating copy to clipboard operation
phpstan-wordpress copied to clipboard

WP_CLI::error() doesn't always terminate

Open johnbillion opened this issue 1 year ago • 5 comments

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.

johnbillion avatar Feb 26 '24 18:02 johnbillion

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.

szepeviktor avatar Feb 26 '24 18:02 szepeviktor

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

herndlm avatar Feb 26 '24 21:02 herndlm