Skip to content

Remove WP_CLI::error from earlyTerminatingMethodCalls config#284

Merged
szepeviktor merged 1 commit intoszepeviktor:2.xfrom
lipemat:patch-1
Jul 3, 2025
Merged

Remove WP_CLI::error from earlyTerminatingMethodCalls config#284
szepeviktor merged 1 commit intoszepeviktor:2.xfrom
lipemat:patch-1

Conversation

@lipemat
Copy link
Copy Markdown
Contributor

@lipemat lipemat commented Jun 21, 2025

WP_CLI::error supports an $exit parameter to disable terminating.

Fixes: #213

`WP_CLI::error` supports an `$exit` parameter to disable terminating.

Fixes: #213
@szepeviktor
Copy link
Copy Markdown
Owner

Thank you!

@szepeviktor
Copy link
Copy Markdown
Owner

@johnbillion Will it be a nicer day with this change?

@johnbillion
Copy link
Copy Markdown
Contributor

I don't think this is right approach because the method terminates by default. It needs to be a conditional rule based on the value of the $exit parameter.

@szepeviktor
Copy link
Copy Markdown
Owner

szepeviktor commented Jun 21, 2025

@lipemat Could you make John's wish come true?
I think it needs a PHPStan extension.

@lipemat
Copy link
Copy Markdown
Contributor Author

lipemat commented Jun 21, 2025

Ideally we would remove both WP_CLI: from earlyTerminatingMethodCalls in this extension in favor of having the proper @return types in the WP_CLI stubs.

We have an effort to add proper types happening over here. Until the earlyTerminatingMethodCalls are removed from the phpstan-wordpress extension, the new @phpstan-return type will not work.

@lipemat
Copy link
Copy Markdown
Contributor Author

lipemat commented Jul 3, 2025

The proper types made it into the main branch on wp-cli.

@szepeviktor
Copy link
Copy Markdown
Owner

Very nice.
I merge this one.

Let's hope the Internet won't blow up!

@szepeviktor szepeviktor merged commit f9c2366 into szepeviktor:2.x Jul 3, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WP_CLI::error() doesn't always terminate

3 participants