Make WordPress Core

Changeset 63426


Ignore:
Timestamp:
09/01/2026 06:26:20 PM (5 weeks ago)
Author:
westonruter
Message:

Code Quality: Fix PHPStan-identified static analysis regressions from the 7.1 cycle.

These are the errors trunk reports that a baseline generated from 7.0.0's src does not, restricted to those where the symbol whose type provoked the error was itself changed after the 7.0 tag.

Four annotations are corrected:

  • On WP_Comment, $comment_ID and $comment_post_ID widen to numeric-string|int, since the numeric-string added in r62640 is contradicted by get_comment_to_edit(), which has replaced both with integers in place since long before.
  • On term_exists(), the conditional return added in r62680 promises int|null for the empty-$taxonomy branch, which actually returns a cast string.
  • On WP_Block_Type::__get(), the union narrowed in r62178 omits the arrays returned for the variations and uses_context names.
  • On WP_Theme_JSON::get_feature_declarations_for_node(), both parameters have been annotated object since r56058 but only ever receive arrays, and the by-reference $node propagated the wrong type back to callers.

The remaining four are code rather than annotations:

  • The users screen gains the $wpdb global that the queries added in r62688 read without importing.
  • An isset() check on $block_type->selectors is dropped, since the property is declared with a non-null default in r62453.
  • An isset() check paired with ! empty() is dropped in the posts list table, where r62838 left both guarding the same property.
  • In WP_View_Config_Data::merge_properties(), an array() !== $current check is redundant after ! array_is_list( $current ), which already implies non-empty.

One report is suppressed rather than fixed: PHPStan reads substr_compare()'s $length from its pre-8.0 functionMap.php, which dropped the parameter's implicit nullability, so a correct call is reported as invalid on every version WordPress supports. That belongs in ignoreErrors rather than a baseline, since a baseline entry records work still to be done and there is none.

Baselines are regenerated, clearing 49 entries and 81 errors across six files.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13064.
Follow-up to r56058, r62178, r62453, r62640, r62680, r62688, r62834, r62838, r63383, r63384.

See #65817.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpstan.neon.dist

    r63384 r63426  
    125125                        path: src/wp-includes/compat.php
    126126                        reportUnmatched: false
     127
     128                # Level 5:
     129                # substr_compare()'s $length has always accepted null, meaning "compare the full length". PHP 7.4 spelled
     130                # that `int $length = null`, where the null default makes the parameter implicitly nullable, and PHP 8.0
     131                # only made it explicit as `?int $length = null`. The behavior never differed: verified on PHP 7.4 that
     132                # passing null compares the whole string rather than coercing to a length of 0.
     133                #
     134                # PHPStan reads the two spellings from two sources and only one is right. Its PHP 8 stub carries `?int`,
     135                # but the pre-8.0 `resources/functionMap.php` records the type as plain `int`, having dropped the implicit
     136                # nullability when it was transcribed from the old manual. Because `phpVersion.min` is 70400, the legacy
     137                # map wins and null is reported as invalid.
     138                #
     139                # This lives here rather than in a baseline because a baseline entry records work still to be done, and
     140                # there is none: the call is correct on every version WordPress supports, and the fault is in PHPStan's
     141                # data. Passing an explicit length purely to satisfy it would change working code to suit a tooling bug.
     142                # `reportUnmatched: false` so this entry lapses quietly if PHPStan corrects the map.
     143                -
     144                        message: '#^Parameter \#4 \$length of function substr_compare expects int, null given\.$#'
     145                        path: src/wp-includes/html-api/class-wp-html-tag-processor.php
     146                        reportUnmatched: false
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r62868 r63426  
    11361136         */
    11371137        protected function get_primary_column_aria_label( $item ) {
    1138                 return isset( $item->post_title ) && ! empty( $item->post_title ) ? $item->post_title : __( 'no title' );
     1138                return ! empty( $item->post_title ) ? $item->post_title : __( 'no title' );
    11391139        }
    11401140
  • trunk/src/wp-admin/users.php

    r62688 r63426  
    340340                <ul>
    341341                <?php
     342                /**
     343                 * @global wpdb $wpdb WordPress database abstraction object.
     344                 */
     345                global $wpdb;
     346
    342347                $go_delete          = 0;
    343348                $users_have_content = false;
  • trunk/src/wp-includes/block-supports/states.php

    r62720 r63426  
    400400function wp_get_block_state_style_rules( $state_styles, $block_type, $rules_group = null ) {
    401401        $css_rules       = array();
    402         $block_selectors = isset( $block_type->selectors ) && is_array( $block_type->selectors )
     402        $block_selectors = is_array( $block_type->selectors )
    403403                ? $block_type->selectors
    404404                : array();
  • trunk/src/wp-includes/class-wp-block-type.php

    r63320 r63426  
    358358         *
    359359         * @param string $name Deprecated property name.
    360          * @return string|string[]|null The value read from the new property if the first item in the array provided,
    361          *                              null when value not found or when unknown property name provided.
     360         * @return string|string[]|array[]|null The value read from the new property if the first item in the array
     361         *                                      provided, the variations or uses context arrays for those two names,
     362         *                                      null when value not found or when unknown property name provided.
    362363         */
    363364        public function __get( $name ) {
  • trunk/src/wp-includes/class-wp-comment.php

    r63354 r63426  
    6464         * Comment ID.
    6565         *
    66          * A numeric string, for compatibility reasons.
    67          *
    68          * @since 4.4.0
    69          * @var string
    70          * @phpstan-var numeric-string
     66         * A numeric string, for compatibility reasons. Note that {@see get_comment_to_edit()}
     67         * replaces it with an integer in place.
     68         *
     69         * @since 4.4.0
     70         * @var string|int
     71         * @phpstan-var numeric-string|int
    7172         */
    7273        public $comment_ID;
    … …  
    7576         * ID of the post the comment is associated with.
    7677         *
    77          * A numeric string, for compatibility reasons.
    78          *
    79          * @since 4.4.0
    80          * @var string
    81          * @phpstan-var numeric-string
     78         * A numeric string, for compatibility reasons. Note that {@see get_comment_to_edit()}
     79         * replaces it with an integer in place.
     80         *
     81         * @since 4.4.0
     82         * @var string|int
     83         * @phpstan-var numeric-string|int
    8284         */
    8385        public $comment_post_ID = '0';
  • trunk/src/wp-includes/class-wp-theme-json.php

    r63384 r63426  
    56735673         * @since 6.3.0
    56745674         *
    5675          * @param object $metadata The related block metadata containing selectors.
    5676          * @param object $node     A merged theme.json node for block or variation.
     5675         * @param array $metadata The related block metadata containing selectors.
     5676         * @param array $node     A merged theme.json node for block or variation. Features
     5677         *                        promoted to their own selector are removed from it.
    56775678         * @return array The style declarations for the node's features with custom
    56785679         *               selectors.
  • trunk/src/wp-includes/class-wp-view-config-data.php

    r62973 r63426  
    524524                        // merge() and replace() alike. An empty array is shape-ambiguous and
    525525                        // exempt, so replace() with an empty list can still clear a list.
    526                         if ( array() !== $incoming && is_array( $current ) && ! array_is_list( $current ) && array() !== $current ) {
     526                        if ( array() !== $incoming && is_array( $current ) && ! array_is_list( $current ) ) {
    527527                                _doing_it_wrong(
    528528                                        __METHOD__,
  • trunk/src/wp-includes/taxonomy.php

    r63420 r63426  
    15991599 *     $term is null ? null : (
    16001600 *         $term is 0 ? 0 : (
    1601  *             $taxonomy is '' ? int|null : (
     1601 *             $taxonomy is '' ? numeric-string|null : (
    16021602 *                 array{
    16031603 *                     term_id: numeric-string,
  • trunk/tests/phpstan/baselines/argument.type.neon

    r63420 r63426  
    3030                        path: ../../../src/wp-admin/admin-header.php
    3131                -
     32                        message: '#^Parameter \#1 \$position of function wp_comment_reply expects int, string given\.$#'
     33                        identifier: argument.type
     34                        count: 1
     35                        path: ../../../src/wp-admin/edit-comments.php
     36                -
     37                        message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
     38                        identifier: argument.type
     39                        count: 2
     40                        path: ../../../src/wp-admin/edit-form-advanced.php
     41                -
     42                        message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
     43                        identifier: argument.type
     44                        count: 1
     45                        path: ../../../src/wp-admin/edit-form-comment.php
     46                -
     47                        message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
     48                        identifier: argument.type
     49                        count: 2
     50                        path: ../../../src/wp-admin/edit-link-form.php
     51                -
     52                        message: '#^Parameter \#3 \$name of function submit_button expects string, null given\.$#'
     53                        identifier: argument.type
     54                        count: 1
     55                        path: ../../../src/wp-admin/edit-tag-form.php
     56                -
    3257                        message: '#^Parameter \#1 \$post of function get_edit_post_link expects int\|WP_Post, string given\.$#'
    3358                        identifier: argument.type
    3459                        count: 1
    35                         path: ../../../src/wp-admin/comment.php
    36                 -
    37                         message: '#^Parameter \#1 \$post of function get_post_status expects int\|WP_Post\|null, string given\.$#'
    38                         identifier: argument.type
    39                         count: 1
    40                         path: ../../../src/wp-admin/comment.php
    41                 -
    42                         message: '#^Parameter \#1 \$post of function get_the_title expects int\|WP_Post, string given\.$#'
    43                         identifier: argument.type
    44                         count: 2
    45                         path: ../../../src/wp-admin/comment.php
    46                 -
    47                         message: '#^Parameter \#1 \$position of function wp_comment_reply expects int, string given\.$#'
    48                         identifier: argument.type
    49                         count: 1
    50                         path: ../../../src/wp-admin/edit-comments.php
    51                 -
    52                         message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
    53                         identifier: argument.type
    54                         count: 2
    55                         path: ../../../src/wp-admin/edit-form-advanced.php
    56                 -
    57                         message: '#^Parameter \#1 \$post of function get_edit_post_link expects int\|WP_Post, string given\.$#'
    58                         identifier: argument.type
    59                         count: 1
    60                         path: ../../../src/wp-admin/edit-form-comment.php
    61                 -
    62                         message: '#^Parameter \#1 \$post of function get_the_title expects int\|WP_Post, string given\.$#'
    63                         identifier: argument.type
    64                         count: 2
    65                         path: ../../../src/wp-admin/edit-form-comment.php
    66                 -
    67                         message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
    68                         identifier: argument.type
    69                         count: 1
    70                         path: ../../../src/wp-admin/edit-form-comment.php
    71                 -
    72                         message: '#^Parameter \#1 \$screen of function do_meta_boxes expects string\|WP_Screen, null given\.$#'
    73                         identifier: argument.type
    74                         count: 2
    75                         path: ../../../src/wp-admin/edit-link-form.php
    76                 -
    77                         message: '#^Parameter \#3 \$name of function submit_button expects string, null given\.$#'
    78                         identifier: argument.type
    79                         count: 1
    80                         path: ../../../src/wp-admin/edit-tag-form.php
    81                 -
    82                         message: '#^Parameter \#1 \$post of function get_edit_post_link expects int\|WP_Post, string given\.$#'
    83                         identifier: argument.type
    84                         count: 1
    8560                        path: ../../../src/wp-admin/edit.php
    8661                -
    … …  
    9570                        path: ../../../src/wp-admin/includes/ajax-actions.php
    9671                -
    97                         message: '#^Parameter \#1 \$comment_id of function _wp_ajax_delete_comment_response expects int, string given\.$#'
    98                         identifier: argument.type
    99                         count: 2
     72                        message: '#^Parameter \#2 \$compare_from of function wp_get_revision_ui_diff expects int, string given\.$#'
     73                        identifier: argument.type
     74                        count: 1
    10075                        path: ../../../src/wp-admin/includes/ajax-actions.php
    10176                -
    102                         message: '#^Parameter \#2 \$compare_from of function wp_get_revision_ui_diff expects int, string given\.$#'
     77                        message: '#^Parameter \#3 \$compare_to of function wp_get_revision_ui_diff expects int, string given\.$#'
    10378                        identifier: argument.type
    10479                        count: 1
    10580                        path: ../../../src/wp-admin/includes/ajax-actions.php
    10681                -
    107                         message: '#^Parameter \#3 \$compare_to of function wp_get_revision_ui_diff expects int, string given\.$#'
    108                         identifier: argument.type
    109                         count: 1
    110                         path: ../../../src/wp-admin/includes/ajax-actions.php
    111                 -
    11282                        message: '#^Parameter \#2 \$gmt of function current_time expects bool, int given\.$#'
    11383                        identifier: argument.type
    … …  
    140110                        path: ../../../src/wp-admin/includes/class-wp-automatic-updater.php
    141111                -
    142                         message: '#^Parameter \#1 \$post of function post_password_required expects int\|WP_Post\|null, string given\.$#'
    143                         identifier: argument.type
    144                         count: 1
    145                         path: ../../../src/wp-admin/includes/class-wp-comments-list-table.php
    146                 -
    147                         message: '#^Parameter \#3 \$post of function get_comment_class expects int\|WP_Post\|null, string given\.$#'
    148                         identifier: argument.type
    149                         count: 1
    150                         path: ../../../src/wp-admin/includes/class-wp-comments-list-table.php
    151                 -
    152112                        message: '#^Parameter \#3 \$number of function _nx expects int, float given\.$#'
    153113                        identifier: argument.type
    … …  
    179139                        count: 1
    180140                        path: ../../../src/wp-admin/includes/class-wp-upgrader.php
    181                 -
    182                         message: '#^Parameter \#1 \$post of function _draft_or_post_title expects int\|WP_Post, string given\.$#'
    183                         identifier: argument.type
    184                         count: 1
    185                         path: ../../../src/wp-admin/includes/dashboard.php
    186                 -
    187                         message: '#^Parameter \#1 \$post of function get_the_permalink expects int\|WP_Post, string given\.$#'
    188                         identifier: argument.type
    189                         count: 1
    190                         path: ../../../src/wp-admin/includes/dashboard.php
    191                 -
    192                         message: '#^Parameter \#1 \$post of function post_password_required expects int\|WP_Post\|null, string given\.$#'
    193                         identifier: argument.type
    194                         count: 1
    195                         path: ../../../src/wp-admin/includes/dashboard.php
    196141                -
    197142                        message: '#^Parameter \#3 \$name of function submit_button expects string, false given\.$#'
    … …  
    480425                        path: ../../../src/wp-content/themes/twentyeleven/functions.php
    481426                -
    482                         message: '#^Parameter \#1 \$comment of function get_comment_link expects int\|WP_Comment\|null, string given\.$#'
    483                         identifier: argument.type
    484                         count: 1
    485                         path: ../../../src/wp-content/themes/twentyeleven/functions.php
    486                 -
    487427                        message: '#^Parameter \#1 \$size of function next_image_link expects array\<int\>\|string, false given\.$#'
    488428                        identifier: argument.type
    … …  
    620560                        path: ../../../src/wp-content/themes/twentyten/functions.php
    621561                -
    622                         message: '#^Parameter \#1 \$comment of function get_comment_link expects int\|WP_Comment\|null, string given\.$#'
     562                        message: '#^Parameter \#1 \$wp_head_callback of function add_custom_image_header expects callable\(\)\: mixed, '''' given\.$#'
    623563                        identifier: argument.type
    624564                        count: 1
    625565                        path: ../../../src/wp-content/themes/twentyten/functions.php
    626566                -
    627                         message: '#^Parameter \#1 \$wp_head_callback of function add_custom_image_header expects callable\(\)\: mixed, '''' given\.$#'
    628                         identifier: argument.type
    629                         count: 1
    630                         path: ../../../src/wp-content/themes/twentyten/functions.php
    631                 -
    632567                        message: '#^Parameter \#1 \$author_id of function get_author_posts_url expects int, string given\.$#'
    633568                        identifier: argument.type
    … …  
    690625                        path: ../../../src/wp-content/themes/twentytwelve/functions.php
    691626                -
    692                         message: '#^Parameter \#1 \$comment of function get_comment_link expects int\|WP_Comment\|null, string given\.$#'
    693                         identifier: argument.type
    694                         count: 1
    695                         path: ../../../src/wp-content/themes/twentytwelve/functions.php
    696                 -
    697627                        message: '#^Parameter \#1 \$size of function next_image_link expects array\<int\>\|string, false given\.$#'
    698628                        identifier: argument.type
    … …  
    789719                        count: 1
    790720                        path: ../../../src/wp-includes/class-wp-block-parser.php
    791                 -
    792                         message: '#^Parameter \#1 \$child_id of method WP_Comment\:\:get_child\(\) expects int, string given\.$#'
    793                         identifier: argument.type
    794                         count: 1
    795                         path: ../../../src/wp-includes/class-wp-comment-query.php
    796                 -
    797                         message: '#^Parameter \#1 \$ids of function _prime_post_caches expects array\<int\>, list\<string\> given\.$#'
    798                         identifier: argument.type
    799                         count: 1
    800                         path: ../../../src/wp-includes/class-wp-comment-query.php
    801721                -
    802722                        message: '#^Parameter \#1 \$ajax_message of method WP_Customize_Manager\:\:wp_die\(\) expects string\|WP_Error, int given\.$#'
    … …  
    915835                        path: ../../../src/wp-includes/class-wp-site.php
    916836                -
    917                         message: '#^Parameter \#1 \$metadata of method WP_Theme_JSON\:\:get_feature_declarations_for_node\(\) expects object, array given\.$#'
    918                         identifier: argument.type
    919                         count: 4
    920                         path: ../../../src/wp-includes/class-wp-theme-json.php
    921                 -
    922                         message: '#^Parameter \#1 \$node of method WP_Theme_JSON\:\:process_pseudo_selectors\(\) expects array, object given\.$#'
    923                         identifier: argument.type
    924                         count: 2
    925                         path: ../../../src/wp-includes/class-wp-theme-json.php
    926                 -
    927                         message: '#^Parameter \#1 \$styles of static method WP_Theme_JSON\:\:compute_style_properties\(\) expects array, object given\.$#'
    928                         identifier: argument.type
    929                         count: 3
    930                         path: ../../../src/wp-includes/class-wp-theme-json.php
    931                 -
    932837                        message: '#^Parameter \#2 \$data of method WP_Theme\:\:cache_add\(\) expects array\|string, int given\.$#'
    933838                        identifier: argument.type
    … …  
    950855                        path: ../../../src/wp-includes/class-wp-widget.php
    951856                -
    952                         message: '#^Parameter \#1 \$post of function get_the_title expects int\|WP_Post, string given\.$#'
     857                        message: '#^Parameter \#1 \$postarr of function wp_insert_post expects array\{ID\?\: int, post_author\?\: int, post_date\?\: string, post_date_gmt\?\: string, post_content\?\: string, post_content_filtered\?\: string, post_title\?\: string, post_excerpt\?\: string, \.\.\., \.\.\.\}, array\{post_author\: int, post_date\: int\|string, post_date_gmt\: int\|string, post_content\: string, post_title\: string, post_category\: array\<string\>\|string, post_status\: ''draft''\|''publish''\} given\.$#'
    953858                        identifier: argument.type
    954859                        count: 1
    955860                        path: ../../../src/wp-includes/class-wp-xmlrpc-server.php
    956861                -
    957                         message: '#^Parameter \#1 \$postarr of function wp_insert_post expects array\{ID\?\: int, post_author\?\: int, post_date\?\: string, post_date_gmt\?\: string, post_content\?\: string, post_content_filtered\?\: string, post_title\?\: string, post_excerpt\?\: string, \.\.\., \.\.\.\}, array\{post_author\: int, post_date\: int\|string, post_date_gmt\: int\|string, post_content\: string, post_title\: string, post_category\: array\<string\>\|string, post_status\: ''draft''\|''publish''\} given\.$#'
     862                        message: '#^Parameter \#1 \$term_id of method wp_xmlrpc_server\:\:get_term_custom_fields\(\) expects int, string given\.$#'
    958863                        identifier: argument.type
    959864                        count: 1
    960865                        path: ../../../src/wp-includes/class-wp-xmlrpc-server.php
    961866                -
    962                         message: '#^Parameter \#1 \$term_id of method wp_xmlrpc_server\:\:get_term_custom_fields\(\) expects int, string given\.$#'
     867                        message: '#^Parameter \#1 \$user_id of function get_userdata expects int, string given\.$#'
    963868                        identifier: argument.type
    964869                        count: 1
    … …  
    967872                        message: '#^Parameter \#1 \$user_id of function get_userdata expects int, string given\.$#'
    968873                        identifier: argument.type
    969                         count: 1
    970                         path: ../../../src/wp-includes/class-wp-xmlrpc-server.php
     874                        count: 2
     875                        path: ../../../src/wp-includes/comment-template.php
    971876                -
    972877                        message: '#^Parameter \#1 \$comment_id of function get_page_of_comment expects int, string given\.$#'
    973878                        identifier: argument.type
    974879                        count: 1
    975                         path: ../../../src/wp-includes/comment-template.php
    976                 -
    977                         message: '#^Parameter \#1 \$post of function get_permalink expects int\|WP_Post, string given\.$#'
    978                         identifier: argument.type
    979                         count: 1
    980                         path: ../../../src/wp-includes/comment-template.php
    981                 -
    982                         message: '#^Parameter \#1 \$post of function post_password_required expects int\|WP_Post\|null, string given\.$#'
    983                         identifier: argument.type
    984                         count: 1
    985                         path: ../../../src/wp-includes/comment-template.php
     880                        path: ../../../src/wp-includes/comment.php
     881                -
     882                        message: '#^Parameter \#1 \$comments of function update_comment_cache expects array\<WP_Comment\>, list\<stdClass\>\|null given\.$#'
     883                        identifier: argument.type
     884                        count: 1
     885                        path: ../../../src/wp-includes/comment.php
     886                -
     887                        message: '#^Parameter \#1 \$content of function pingback expects string, null given\.$#'
     888                        identifier: argument.type
     889                        count: 1
     890                        path: ../../../src/wp-includes/comment.php
     891                -
     892                        message: '#^Parameter \#2 \$meta_id of function delete_metadata_by_mid expects int, string\|null given\.$#'
     893                        identifier: argument.type
     894                        count: 1
     895                        path: ../../../src/wp-includes/comment.php
     896                -
     897                        message: '#^Parameter \#1 \$gmt_time of function spawn_cron expects int, float given\.$#'
     898                        identifier: argument.type
     899                        count: 1
     900                        path: ../../../src/wp-includes/cron.php
     901                -
     902                        message: '#^Parameter \#1 \$container_context of method WP_Customize_Partial\:\:render\(\) expects array, null given\.$#'
     903                        identifier: argument.type
     904                        count: 1
     905                        path: ../../../src/wp-includes/customize/class-wp-customize-selective-refresh.php
     906                -
     907                        message: '#^Parameter \#1 \$response of method WP_REST_Server\:\:response_to_data\(\) expects WP_REST_Response, WP_HTTP_Response given\.$#'
     908                        identifier: argument.type
     909                        count: 1
     910                        path: ../../../src/wp-includes/embed.php
    986911                -
    987912                        message: '#^Parameter \#1 \$user_id of function get_userdata expects int, string given\.$#'
    988913                        identifier: argument.type
    989                         count: 2
    990                         path: ../../../src/wp-includes/comment-template.php
    991                 -
    992                         message: '#^Parameter \#1 \$comment of function get_comment_link expects int\|WP_Comment\|null, string given\.$#'
    993                         identifier: argument.type
    994                         count: 1
    995                         path: ../../../src/wp-includes/comment.php
    996                 -
    997                         message: '#^Parameter \#1 \$comment_id of function add_comment_meta expects int, string given\.$#'
    998                         identifier: argument.type
    999                         count: 5
    1000                         path: ../../../src/wp-includes/comment.php
    1001                 -
    1002                         message: '#^Parameter \#1 \$comment_id of function delete_comment_meta expects int, string given\.$#'
    1003                         identifier: argument.type
    1004                         count: 8
    1005                         path: ../../../src/wp-includes/comment.php
    1006                 -
    1007                         message: '#^Parameter \#1 \$comment_id of function get_comment_text expects int\|WP_Comment, string given\.$#'
    1008                         identifier: argument.type
    1009                         count: 1
    1010                         path: ../../../src/wp-includes/comment.php
    1011                 -
    1012                         message: '#^Parameter \#1 \$comment_id of function get_page_of_comment expects int, string given\.$#'
    1013                         identifier: argument.type
    1014                         count: 1
    1015                         path: ../../../src/wp-includes/comment.php
    1016                 -
    1017                         message: '#^Parameter \#1 \$comments of function update_comment_cache expects array\<WP_Comment\>, list\<stdClass\>\|null given\.$#'
    1018                         identifier: argument.type
    1019                         count: 1
    1020                         path: ../../../src/wp-includes/comment.php
    1021                 -
    1022                         message: '#^Parameter \#1 \$content of function pingback expects string, null given\.$#'
    1023                         identifier: argument.type
    1024                         count: 1
    1025                         path: ../../../src/wp-includes/comment.php
    1026                 -
    1027                         message: '#^Parameter \#1 \$ids of function clean_comment_cache expects array\|int, string given\.$#'
    1028                         identifier: argument.type
    1029                         count: 2
    1030                         path: ../../../src/wp-includes/comment.php
    1031                 -
    1032                         message: '#^Parameter \#1 \$post_id of function wp_update_comment_count expects int\|null, string given\.$#'
    1033                         identifier: argument.type
    1034                         count: 2
    1035                         path: ../../../src/wp-includes/comment.php
    1036                 -
    1037                         message: '#^Parameter \#2 \$meta_id of function delete_metadata_by_mid expects int, string\|null given\.$#'
    1038                         identifier: argument.type
    1039                         count: 1
    1040                         path: ../../../src/wp-includes/comment.php
    1041                 -
    1042                         message: '#^Parameter \#2 \$object_ids of function update_meta_cache expects array\<int\>\|string, list\<string\> given\.$#'
    1043                         identifier: argument.type
    1044                         count: 1
    1045                         path: ../../../src/wp-includes/comment.php
    1046                 -
    1047                         message: '#^Parameter \#1 \$gmt_time of function spawn_cron expects int, float given\.$#'
    1048                         identifier: argument.type
    1049                         count: 1
    1050                         path: ../../../src/wp-includes/cron.php
    1051                 -
    1052                         message: '#^Parameter \#1 \$container_context of method WP_Customize_Partial\:\:render\(\) expects array, null given\.$#'
    1053                         identifier: argument.type
    1054                         count: 1
    1055                         path: ../../../src/wp-includes/customize/class-wp-customize-selective-refresh.php
    1056                 -
    1057                         message: '#^Parameter \#1 \$response of method WP_REST_Server\:\:response_to_data\(\) expects WP_REST_Response, WP_HTTP_Response given\.$#'
    1058                         identifier: argument.type
    1059914                        count: 1
    1060915                        path: ../../../src/wp-includes/embed.php
    1061916                -
    1062                         message: '#^Parameter \#1 \$user_id of function get_userdata expects int, string given\.$#'
    1063                         identifier: argument.type
    1064                         count: 1
    1065                         path: ../../../src/wp-includes/embed.php
    1066                 -
    1067917                        message: '#^Parameter \#1 \$post_id of function get_post_comments_feed_link expects int, string given\.$#'
    1068918                        identifier: argument.type
    … …  
    1074924                        count: 1
    1075925                        path: ../../../src/wp-includes/feed-rss2.php
    1076                 -
    1077                         message: '#^Parameter \#1 \$post of function get_the_guid expects int\|WP_Post, string given\.$#'
    1078                         identifier: argument.type
    1079                         count: 1
    1080                         path: ../../../src/wp-includes/feed.php
    1081926                -
    1082927                        message: '#^Parameter \#2 \$message of class WP_Error constructor expects string, list\<string\> given\.$#'
    … …  
    11701015                        path: ../../../src/wp-includes/html-api/class-wp-html-processor.php
    11711016                -
    1172                         message: '#^Parameter \#4 \$length of function substr_compare expects int, null given\.$#'
    1173                         identifier: argument.type
    1174                         count: 1
    1175                         path: ../../../src/wp-includes/html-api/class-wp-html-tag-processor.php
    1176                 -
    11771017                        message: '#^Parameter \#1 \$user_id of function get_userdata expects int, string given\.$#'
    11781018                        identifier: argument.type
    … …  
    12751115                        path: ../../../src/wp-includes/pluggable.php
    12761116                -
    1277                         message: '#^Parameter \#1 \$post of function get_edit_post_link expects int\|WP_Post, string given\.$#'
    1278                         identifier: argument.type
    1279                         count: 1
    1280                         path: ../../../src/wp-includes/pluggable.php
    1281                 -
    1282                         message: '#^Parameter \#1 \$post of function get_permalink expects int\|WP_Post, string given\.$#'
    1283                         identifier: argument.type
    1284                         count: 4
    1285                         path: ../../../src/wp-includes/pluggable.php
    1286                 -
    12871117                        message: '#^Parameter \#1 \$user of function user_can expects int\|WP_User, string given\.$#'
    12881118                        identifier: argument.type
    … …  
    14201250                        path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
    14211251                -
    1422                         message: '#^Parameter \#1 \$comment_id of function get_comment_type expects int\|WP_Comment, string given\.$#'
    1423                         identifier: argument.type
    1424                         count: 2
    1425                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1426                 -
    1427                         message: '#^Parameter \#1 \$comment_id of function wp_delete_comment expects int\|WP_Comment, string given\.$#'
    1428                         identifier: argument.type
    1429                         count: 1
    1430                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1431                 -
    1432                         message: '#^Parameter \#1 \$comment_id of function wp_trash_comment expects int\|WP_Comment, string given\.$#'
    1433                         identifier: argument.type
    1434                         count: 1
    1435                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1436                 -
    1437                         message: '#^Parameter \#1 \$object_id of method WP_REST_Meta_Fields\:\:get_value\(\) expects int, string given\.$#'
    1438                         identifier: argument.type
    1439                         count: 1
    1440                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1441                 -
    1442                         message: '#^Parameter \#2 \$comment_id of method WP_REST_Comments_Controller\:\:handle_status_param\(\) expects int, string given\.$#'
    1443                         identifier: argument.type
    1444                         count: 2
    1445                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1446                 -
    1447                         message: '#^Parameter \#2 \$object_id of method WP_REST_Meta_Fields\:\:update_value\(\) expects int, string given\.$#'
    1448                         identifier: argument.type
    1449                         count: 1
    1450                         path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    1451                 -
    14521252                        message: '#^Parameter \#2 \$value of method WP_HTTP_Response\:\:header\(\) expects string, int given\.$#'
    14531253                        identifier: argument.type
    … …  
    16241424                        count: 1
    16251425                        path: ../../../src/wp-includes/widgets.php
    1626                 -
    1627                         message: '#^Parameter \#1 \$post of function get_the_title expects int\|WP_Post, string given\.$#'
    1628                         identifier: argument.type
    1629                         count: 1
    1630                         path: ../../../src/wp-includes/widgets/class-wp-widget-recent-comments.php
  • trunk/tests/phpstan/baselines/assign.propertyType.neon

    r63420 r63426  
    1919parameters:
    2020        ignoreErrors:
    21                 -
    22                         message: '#^Property WP_Comment\:\:\$comment_ID \(numeric\-string\) does not accept int\.$#'
    23                         identifier: assign.propertyType
    24                         count: 1
    25                         path: ../../../src/wp-admin/includes/comment.php
    26                 -
    27                         message: '#^Property WP_Comment\:\:\$comment_post_ID \(numeric\-string\) does not accept int\.$#'
    28                         identifier: assign.propertyType
    29                         count: 1
    30                         path: ../../../src/wp-admin/includes/comment.php
    3121                -
    3222                        message: '#^Property WP_Block_Template\:\:\$author \(int\|null\) does not accept string\.$#'
  • trunk/tests/phpstan/baselines/isset.property.neon

    r63023 r63426  
    3030                        path: ../../../src/wp-admin/includes/class-walker-nav-menu-edit.php
    3131                -
    32                         message: '#^Property WP_Post\:\:\$post_title \(string\) in isset\(\) is not nullable\.$#'
    33                         identifier: isset.property
    34                         count: 1
    35                         path: ../../../src/wp-admin/includes/class-wp-posts-list-table.php
    36                 -
    3732                        message: '#^Property WP_Screen\:\:\$post_type \(string\) in isset\(\) is not nullable\.$#'
    3833                        identifier: isset.property
    … …  
    8984                        count: 1
    9085                        path: ../../../src/wp-includes/block-editor.php
    91                 -
    92                         message: '#^Property WP_Block_Type\:\:\$selectors \(array\) in isset\(\) is not nullable\.$#'
    93                         identifier: isset.property
    94                         count: 1
    95                         path: ../../../src/wp-includes/block-supports/states.php
    9686                -
    9787                        message: '#^Property WP_Customize_Control\:\:\$settings \(array\) in isset\(\) is not nullable\.$#'
  • trunk/tests/phpstan/baselines/notIdentical.alwaysTrue.neon

    r63301 r63426  
    3030                        path: ../../../src/wp-includes/class-wp-rewrite.php
    3131                -
    32                         message: '#^Strict comparison using \!\=\= between array\{\} and non\-empty\-array\<mixed, mixed\> will always evaluate to true\.$#'
    33                         identifier: notIdentical.alwaysTrue
    34                         count: 1
    35                         path: ../../../src/wp-includes/class-wp-view-config-data.php
    36                 -
    3732                        message: '#^Strict comparison using \!\=\= between ''Etc'' and ''Africa''\|''America''\|''Antarctica''\|''Arctic''\|''Asia''\|''Atlantic''\|''Australia''\|''Europe''\|''Indian''\|''Pacific'' will always evaluate to true\.$#'
    3833                        identifier: notIdentical.alwaysTrue
  • trunk/tests/phpstan/baselines/return.type.neon

    r63360 r63426  
    4949                        count: 1
    5050                        path: ../../../src/wp-includes/class-wp-block-processor.php
    51                 -
    52                         message: '#^Method WP_Block_Type\:\:__get\(\) should return array\<string\>\|string\|null but returns array\<array\>\.$#'
    53                         identifier: return.type
    54                         count: 1
    55                         path: ../../../src/wp-includes/class-wp-block-type.php
    5651                -
    5752                        message: '#^Method WP_Image_Editor_Imagick\:\:set_imagick_time_limit\(\) should return int\|null but returns float\.$#'
    … …  
    150145                        path: ../../../src/wp-includes/revision.php
    151146                -
    152                         message: '#^Function term_exists\(\) should return array\{term_id\: numeric\-string, term_taxonomy_id\: numeric\-string\}\|int\|null but returns string\.$#'
    153                         identifier: return.type
    154                         count: 1
    155                         path: ../../../src/wp-includes/taxonomy.php
    156                 -
    157147                        message: '#^Function _wp_get_current_user\(\) should return WP_User but returns null\.$#'
    158148                        identifier: return.type
  • trunk/tests/phpstan/baselines/variable.undefined.neon

    r63019 r63426  
    585585                        path: ../../../src/wp-admin/users.php
    586586                -
    587                         message: '#^Variable \$wpdb might not be defined\.$#'
    588                         identifier: variable.undefined
    589                         count: 6
    590                         path: ../../../src/wp-admin/users.php
    591                 -
    592587                        message: '#^Variable \$title might not be defined\.$#'
    593588                        identifier: variable.undefined
Note: See TracChangeset for help on using the changeset viewer.