Skip to content

Conversation

@IanDelMar
Copy link
Contributor

This PR removes the SAVEQUERIES constant from the dynamicConstantNames list in extension.neon, as it is not defined by WordPress (see this GitHub search).

Including SAVEQUERIES in the dynamicConstantNames list prevents PHPStan from reporting the following code:

if (SAVEQUERIES) {
    // do something
}

If SAVEQUERIES is not defined, this will trigger a fatal error in PHP 8+.

IanDelMar added a commit to IanDelMar/phpstan-wordpress that referenced this pull request Jul 7, 2025
This reverts commit 96deab8. It is handled separately in szepeviktor#287.
@szepeviktor
Copy link
Owner

szepeviktor commented Jul 7, 2025

Copy link
Contributor

@johnbillion johnbillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think that means that WP_CLI should be removed too though.

@johnbillion
Copy link
Contributor

Oh Ian beat me to it with #288.

@szepeviktor
Copy link
Owner

I would leave it as is.

@szepeviktor szepeviktor merged commit 7e96a48 into szepeviktor:2.x Jul 7, 2025
1 of 2 checks passed
@IanDelMar IanDelMar deleted the SAVEQUERIES branch July 7, 2025 19:11
szepeviktor pushed a commit that referenced this pull request Jul 25, 2025
* Fix handling of dynamic constants

* Remove SAVEQUERIES from dynamicConstantNames

* Revert "Remove SAVEQUERIES from dynamicConstantNames"

This reverts commit 96deab8. It is handled separately in #287.

* Readd WP_DEBUG_LOG to bootstrap.php

* Add tests for dynamic constants
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.

3 participants