Make WordPress Core

Changeset 63510


Ignore:
Timestamp:
09/07/2026 12:10:14 AM (24 hours ago)
Author:
westonruter
Message:

Build/Test Tools: Update PHPStan to 2.2.13.

Recent PHPStan releases bring substantial performance improvements. The baselines are regenerated for the new version.

The docblock of _wp_die_process_input() is also corrected to admit the integer message that wp_die() accepts for the legacy Ajax responses, which the helper passes through untouched. This removes a baseline entry for a guard in _default_wp_die_handler() that the incomplete type made look unreachable.

Developed in https://github.com/WordPress/wordpress-develop/pull/13410.
Follow-up to r44666, r53144, r62703, r62798.

Props markusstaab, westonruter.
See #65817.
Fixes #66051.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/composer.json

    r63167 r63510  
    5252                "wp-coding-standards/wpcs": "~3.4.1",
    5353                "phpcompatibility/phpcompatibility-wp": "~2.1.3",
    54                 "phpstan/phpstan": "2.2.5",
     54                "phpstan/phpstan": "2.2.13",
    5555                "phpstan/phpstan-phpunit": "2.0.18",
    5656                "yoast/phpunit-polyfills": "^1.1.0"
  • trunk/src/wp-includes/formatting.php

    r63491 r63510  
    48494849                $regex,
    48504850                static function ( $matches ) {
    4851                         if ( ! isset( $matches[0] ) ) {
    4852                                 return '';
    4853                         }
    4854 
    48554851                        if ( isset( $matches['non_cdata'] ) ) {
    48564852                                // escape HTML entities in the non-CDATA Section.
  • trunk/src/wp-includes/functions.php

    r63509 r63510  
    43614361 * @access private
    43624362 *
    4363  * @param string|WP_Error $message Error message or WP_Error object.
    4364  * @param string          $title   Optional. Error title. Default empty string.
    4365  * @param string|array    $args    Optional. Arguments to control behavior. Default empty array.
     4363 * @param string|WP_Error|int $message Error message, WP_Error object, or integer response.
     4364 * @param string              $title   Optional. Error title. Default empty string.
     4365 * @param string|array        $args    Optional. Arguments to control behavior. Default empty array.
    43664366 * @return array {
    43674367 *     Processed arguments.
    43684368 *
    4369  *     @type string $0 Error message.
    4370  *     @type string $1 Error title.
    4371  *     @type array  $2 Arguments to control behavior.
     4369 *     @type string|int $0 Error message, or integer response.
     4370 *     @type string     $1 Error title.
     4371 *     @type array      $2 Arguments to control behavior.
    43724372 * }
    43734373 */
  • trunk/tests/phpstan/baselines/argument.type.neon

    r63461 r63510  
    775775                        path: ../../../src/wp-includes/class-wp-embed.php
    776776                -
     777                        message: '#^Parameter \#1 \$handle of function curl_getinfo expects resource, \(resource\|false\) given\.$#'
     778                        identifier: argument.type
     779                        count: 2
     780                        path: ../../../src/wp-includes/class-wp-http-curl.php
     781                -
    777782                        message: '#^Parameter \#3 \$value of function curl_setopt expects int, string given\.$#'
    778783                        identifier: argument.type
     
    929934                        count: 1
    930935                        path: ../../../src/wp-includes/formatting.php
     936                -
     937                        message: '#^Parameter \#1 \$finfo of function finfo_file expects resource, resource\|false given\.$#'
     938                        identifier: argument.type
     939                        count: 2
     940                        path: ../../../src/wp-includes/functions.php
    931941                -
    932942                        message: '#^Parameter \#1 \$prefix of function uniqid expects string, int\<0, max\> given\.$#'
  • trunk/tests/phpstan/baselines/empty.variable.neon

    r63019 r63510  
    2424                        count: 1
    2525                        path: ../../../src/wp-admin/includes/class-wp-posts-list-table.php
    26                 -
    27                         message: '#^Variable \$title in empty\(\) always exists and is always falsy\.$#'
    28                         identifier: empty.variable
    29                         count: 1
    30                         path: ../../../src/wp-admin/includes/plugin.php
    3126                -
    3227                        message: '#^Variable \$parent_file in empty\(\) always exists and is not falsy\.$#'
  • trunk/tests/phpstan/baselines/function.alreadyNarrowedType.neon

    r63023 r63510  
    2525                        path: ../../../src/wp-admin/includes/ajax-actions.php
    2626                -
    27                         message: '#^Call to function is_wp_error\(\) with WP_Error will always evaluate to true\.$#'
    28                         identifier: function.alreadyNarrowedType
    29                         count: 1
    30                         path: ../../../src/wp-admin/includes/ajax-actions.php
    31                 -
    3227                        message: '#^Call to function method_exists\(\) with ''ParagonIE_Sodium…'' and ''runtime_speed_test'' will always evaluate to true\.$#'
    3328                        identifier: function.alreadyNarrowedType
     
    4944                        count: 1
    5045                        path: ../../../src/wp-admin/includes/plugin.php
    51                 -
    52                         message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#'
    53                         identifier: function.alreadyNarrowedType
    54                         count: 1
    55                         path: ../../../src/wp-includes/block-editor.php
    5646                -
    5747                        message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#'
     
    8070                        path: ../../../src/wp-includes/functions.php
    8171                -
     72                        message: '#^Call to function is_scalar\(\) with int\|string will always evaluate to true\.$#'
     73                        identifier: function.alreadyNarrowedType
     74                        count: 3
     75                        path: ../../../src/wp-includes/functions.php
     76                -
    8277                        message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#'
    8378                        identifier: function.alreadyNarrowedType
  • trunk/tests/phpstan/baselines/if.alwaysFalse.neon

    r63157 r63510  
    3333                        identifier: if.alwaysFalse
    3434                        count: 1
    35                         path: ../../../src/wp-includes/load.php
    36                 -
    37                         message: '#^If condition is always false\.$#'
    38                         identifier: if.alwaysFalse
    39                         count: 1
    4035                        path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    4136                -
  • trunk/tests/phpstan/baselines/property.notFound.neon

    r63488 r63510  
    177177                        message: '#^Access to an undefined property WP_Theme\:\:\$version\.$#'
    178178                        identifier: property.notFound
    179                         count: 5
     179                        count: 6
    180180                        path: ../../../src/wp-admin/includes/class-wp-debug-data.php
    181181                -
Note: See TracChangeset for help on using the changeset viewer.