Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/wp-includes/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,8 @@ function wp_load_translations_early() {
* Omit this parameter if you only want to fetch the current status.
* @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
* report whether WP was in installing mode prior to the change to `$is_installing`.
*
* @phpstan-impure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@westonruter this isn’t related to this PR, but just like with WPCS “ignore” comments I find these to be a bit distracting in the code. it’s like we’re polluting our code to cover the deficiencies of a tool we happen to be using right now.

can these functions and methods not be defined as impure in external config files for PHPStan? if we could do that, it would keep the code clean while making up for the fact that PHPStan didn’t infer the purity aspect properly.

*/
function wp_installing( $is_installing = null ) {
static $installing = null;
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ function is_comment_feed() {
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool Whether the query is for the front page of the site.
*
* @phpstan-impure
*/
function is_front_page() {
global $wp_query;
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -3155,6 +3155,8 @@ function _remove_theme_support( $feature ) {
* of possible values.
* @param mixed ...$args Optional extra arguments to be checked against certain features.
* @return bool True if the active theme supports the feature, false otherwise.
*
* @phpstan-impure
*/
function current_theme_supports( $feature, ...$args ) {
global $_wp_theme_features;
Expand Down
5 changes: 0 additions & 5 deletions tests/phpstan/baselines/booleanAnd.leftAlwaysTrue.neon
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ parameters:
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../src/wp-includes/block-template-utils.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../src/wp-includes/canonical.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
Expand Down
10 changes: 0 additions & 10 deletions tests/phpstan/baselines/booleanNot.alwaysTrue.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

parameters:
ignoreErrors:
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../src/wp-admin/includes/class-custom-image-header.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
Expand Down Expand Up @@ -53,8 +48,3 @@ parameters:
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../src/wp-includes/general-template.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../src/wp-includes/option.php
Loading