Make WordPress Core

Changeset 63191


Ignore:
Timestamp:
08/12/2026 12:21:45 AM (3 months ago)
Author:
westonruter
Message:

Build/Test Tools: Treat DB_COLLATE and WP_DEVELOPMENT_MODE as dynamic in PHPStan.

The DB_COLLATE and WP_DEVELOPMENT_MODE constants both vary per installation, but neither was listed in dynamicConstantNames, so PHPStan resolved each to the empty string it is handed during analysis. Every conditional guarding either constant was therefore reported as having a constant result, accounting for two ternary.alwaysFalse errors in class-wp-debug-data.php and one booleanAnd.rightAlwaysFalse error in class-wpdb.php. Listing both constants as dynamic resolves all three errors and empties their baselines, which are deleted along with their includes entries in phpstan.neon.dist.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/12958.
Follow-up to r61699, r63023.

Props callumbw95.
See #65817.

Location:
trunk
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpstan.neon.dist

    r63181 r63191  
    3232        - tests/phpstan/baselines/booleanAnd.alwaysTrue.neon
    3333        - tests/phpstan/baselines/booleanAnd.leftAlwaysTrue.neon
    34         - tests/phpstan/baselines/booleanAnd.rightAlwaysFalse.neon
    3534        - tests/phpstan/baselines/booleanAnd.rightAlwaysTrue.neon
    3635        - tests/phpstan/baselines/booleanNot.alwaysFalse.neon
    … …  
    8988        - tests/phpstan/baselines/smallerOrEqual.alwaysTrue.neon
    9089        - tests/phpstan/baselines/staticClassAccess.privateMethod.neon
    91         - tests/phpstan/baselines/ternary.alwaysFalse.neon
    9290        - tests/phpstan/baselines/ternary.alwaysTrue.neon
    9391        - tests/phpstan/baselines/varTag.noVariable.neon
  • trunk/tests/phpstan/base.neon

    r63019 r63191  
    8080                - COOKIEPATH
    8181                - CUSTOM_TAGS
     82                - DB_COLLATE
    8283                - DISALLOW_FILE_EDIT
    8384                - DISALLOW_UNFILTERED_HTML
    … …  
    105106                - WP_DEBUG_DISPLAY
    106107                - WP_DEBUG_LOG
     108                - WP_DEVELOPMENT_MODE
    107109                - WP_LANG_DIR
    108110                - WP_NETWORK_ADMIN
Note: See TracChangeset for help on using the changeset viewer.