Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created August 13, 2026 18:11
Show Gist options
  • Select an option

  • Save westonruter/14318a8cd871ebdf1bbe04e79e53dcb8 to your computer and use it in GitHub Desktop.

Select an option

Save westonruter/14318a8cd871ebdf1bbe04e79e53dcb8 to your computer and use it in GitHub Desktop.
Claude Opus 5 analysis of wordpress-develop

New PHPStan errors in trunk since 7.0.0 (rule levels 1-5)

Generated by analyzing trunk against a PHPStan baseline built from 7.0.0's src, holding the analyzer constant (trunk's tests/phpstan tooling and phpstan.neon.dist) so that only code changes are measured.

  • 163 errors across 73 files, in 20 identifiers.
  • All 163 are new at levels 1-5; none appear at level 0.
  • 161 are in files that already existed at 7.0.0; only 2 are in new files.

Summary

Errors Identifier Distinct messages
79 argument.type 36
20 return.missing 18
14 staticClassAccess.privateMethod 7
8 deadCode.unreachable 1
6 assign.propertyType 4
5 isset.property 4
5 return.type 5
4 booleanNot.alwaysFalse 1
3 property.nonObject 3
3 variable.undefined 2
3 property.notFound 2
3 if.alwaysTrue 1
2 function.alreadyNarrowedType 2
2 argument.unresolvableType 1
1 identical.alwaysTrue 1
1 return.unusedType 1
1 booleanAnd.leftAlwaysTrue 1
1 ternary.alwaysTrue 1
1 notIdentical.alwaysTrue 1
1 binaryOp.invalid 1

Details

argument.type (79)

  • x10 Parameter #1 $text of function esc_attr expects string, int given
    • src/wp-admin/users.php:427, 427, 428, 431, 431, 432, 434, 578
    • src/wp-content/themes/twentytwenty/functions.php:324, 325
  • x8 Parameter #2 $meta_id of function delete_metadata_by_mid expects int, string|null given
    • src/wp-admin/includes/ms.php:203
    • src/wp-admin/includes/user.php:446
    • src/wp-includes/comment.php:1599
    • src/wp-includes/functions.php:914
    • src/wp-includes/ms-site.php:266
    • src/wp-includes/post.php:3942, 6886
    • src/wp-includes/taxonomy.php:2190
  • x8 Parameter #1 $text of function esc_attr expects string, int<min, -1>|int<1, max> given
    • src/wp-admin/network/site-info.php:170
    • src/wp-admin/network/site-settings.php:120
    • src/wp-admin/network/site-themes.php:241, 247
    • src/wp-admin/network/site-users.php:313, 319, 338, 375
  • x5 Parameter #1 $text of function esc_attr expects string, int<0, max> given
    • src/wp-admin/edit-form-advanced.php:238
    • src/wp-admin/includes/ajax-actions.php:2321
    • src/wp-admin/includes/class-walker-nav-menu-edit.php:69
    • src/wp-admin/includes/post.php:2544
    • src/wp-includes/class-wp-customize-control.php:629
  • x4 Parameter #1 $text of function esc_attr expects string, float|int given
    • src/wp-admin/includes/class-custom-image-header.php:937, 937, 942, 943
  • x4 Parameter #1 $post_id of function wp_delete_post expects int, string|null given
    • src/wp-admin/includes/ms.php:185
    • src/wp-admin/includes/nav-menu.php:1389
    • src/wp-admin/includes/user.php:411
    • src/wp-includes/post.php:8380
  • x3 Parameter #1 $user_id of function switch_to_user_locale expects int, string given
    • src/wp-admin/includes/privacy-tools.php:604
    • src/wp-includes/user.php:4502, 4911
  • x2 Parameter #1 $link_id of function wp_delete_link expects int, string|null given
    • src/wp-admin/includes/ms.php:193
    • src/wp-admin/includes/user.php:420
  • x2 Parameter #2 $fallback_title of function sanitize_title expects string, int<0, max> given
    • src/wp-admin/includes/post.php:1482, 1490
  • x2 Parameter #2 $user_id of function get_the_author_meta expects int|false, ''|numeric-string given
    • src/wp-admin/includes/revision.php:229
    • src/wp-includes/post-template.php:1982
  • x2 Parameter #1 $text of function esc_html expects string, int<1, max> given
    • src/wp-content/themes/twentyfourteen/image.php:32, 32
  • x2 Parameter #1 $metadata of method WP_Theme_JSON::get_feature_declarations_for_node() expects object, array given
    • src/wp-includes/class-wp-theme-json.php:3844, 3904
  • x2 Parameter #1 $node of method WP_Theme_JSON::process_pseudo_selectors() expects array, object given
    • src/wp-includes/class-wp-theme-json.php:3871, 3921
  • x2 Parameter #1 $post of function get_post expects int|numeric-string|WP_Post|null, stdClass given
    • src/wp-includes/post.php:3849, 6823
  • x2 Parameter #1 $comment_id of function wp_delete_comment expects int|WP_Comment, string|null given
    • src/wp-includes/post.php:3932, 6879
  • Parameter #1 $term of function get_term expects int|object, string given
    • src/wp-admin/includes/export.php:201
  • Parameter #1 $callback of function array_map expects (callable(stdClass): mixed)|null, 'get_comment' given
    • src/wp-admin/includes/export.php:691
  • Parameter #1 $post of function clean_post_cache expects int|WP_Post, string|null given
    • src/wp-admin/includes/user.php:428
  • Parameter #1 $bookmark_id of function clean_bookmark_cache expects int, string|null given
    • src/wp-admin/includes/user.php:435
  • Parameter #1 $comment of function get_comment_link expects int|WP_Comment|null, string given
    • src/wp-content/themes/twentytwelve/functions.php:500
  • Parameter #1 $ids of function _prime_post_caches expects array, list<string|null> given
    • src/wp-includes/class-wp-query.php:3445
  • Parameter #1 $pages of function get_page_hierarchy expects array<WP_Post>, list|null given
    • src/wp-includes/class-wp-rewrite.php:432
  • Parameter #1 $styles of static method WP_Theme_JSON::compute_style_properties() expects array, object given
    • src/wp-includes/class-wp-theme-json.php:4047
  • Parameter #1 $comments of function update_comment_cache expects array<WP_Comment>, list|null given
    • src/wp-includes/comment.php:3819
  • Parameter #4 $length of function substr_compare expects int, null given
    • src/wp-includes/html-api/class-wp-html-tag-processor.php:5040
  • Parameter #2 $callback of function array_walk expects callable(non-empty-string|null, int<0, max>): mixed, 'clean_post_cache' given
    • src/wp-includes/ms-functions.php:303
  • Parameter #2 $callback of function array_walk expects callable(non-empty-string|null, int<0, max>): mixed, 'clean_bookmark_cache' given
    • src/wp-includes/ms-functions.php:308
  • Parameter #1 $attachment of function is_attachment expects array<int|string>|int|string, WP_Post given
    • src/wp-includes/post-template.php:541
  • Parameter #1 $revision of function wp_delete_post_revision expects int|WP_Post, string|null given
    • src/wp-includes/post.php:3919
  • Parameter #1 $post of function clean_post_cache expects int|WP_Post, stdClass given
    • src/wp-includes/post.php:4002
  • Parameter #1 $posts of function update_post_cache expects array<WP_Post>, list given
    • src/wp-includes/post.php:8503
  • Parameter #1 $object_id of function wp_remove_object_terms expects int, string|null given
    • src/wp-includes/taxonomy.php:2156
  • Parameter #1 $object_ids of function wp_get_object_terms expects array|int, string|null given
    • src/wp-includes/taxonomy.php:2161
  • Parameter #1 $object_id of function wp_set_object_terms expects int, string|null given
    • src/wp-includes/taxonomy.php:2179
  • Parameter #1 $terms of function update_term_cache expects array<WP_Term>, list|null given
    • src/wp-includes/taxonomy.php:4167
  • Parameter #1 $post_id of function update_post_meta expects int, string|null given
    • src/wp-includes/taxonomy.php:4603

return.missing (20)

  • x2 Method WP_Widget_Tag_Cloud::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-tag-cloud.php:195, 199
  • x2 Method WP_Widget_Text::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-text.php:488, 515
  • Method Twenty_Eleven_Ephemera_Widget::form() should return string|null but return statement is missing
    • src/wp-content/themes/twentyeleven/inc/widgets.php:204
  • Method Twenty_Fourteen_Ephemera_Widget::form() should return string|null but return statement is missing
    • src/wp-content/themes/twentyfourteen/inc/widgets.php:313
  • Method WP_Nav_Menu_Widget::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-nav-menu-widget.php:204
  • Method WP_Widget_Archives::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-archives.php:243
  • Method WP_Widget_Block::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-block.php:211
  • Method WP_Widget_Calendar::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-calendar.php:101
  • Method WP_Widget_Categories::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-categories.php:218
  • Method WP_Widget_Custom_HTML::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-custom-html.php:253
  • Method WP_Widget_Links::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-links.php:184
  • Method WP_Widget_Media::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-media.php:345
  • Method WP_Widget_Meta::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-meta.php:139
  • Method WP_Widget_Pages::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-pages.php:181
  • Method WP_Widget_Recent_Comments::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-recent-comments.php:198
  • Method WP_Widget_Recent_Posts::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-recent-posts.php:180
  • Method WP_Widget_RSS::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-rss.php:184
  • Method WP_Widget_Search::form() should return string|null but return statement is missing
    • src/wp-includes/widgets/class-wp-widget-search.php:73

staticClassAccess.privateMethod (14)

  • x4 Unsafe call to private method WP_Theme_JSON::update_button_width_declarations() through static::
    • src/wp-includes/class-wp-theme-json.php:993, 3831, 3850, 3906
  • x3 Unsafe call to private method WP_Theme_JSON::sanitize_viewport_settings() through static::
    • src/wp-includes/class-wp-theme-json.php:721, 1460, 5017
  • x2 Unsafe call to private method WP_Theme_JSON::update_paragraph_text_indent_selector() through static::
    • src/wp-includes/class-wp-theme-json.php:3847, 3905
  • x2 Unsafe call to private method WP_Theme_JSON::get_block_name_from_metadata_path() through static::
    • src/wp-includes/class-wp-theme-json.php:3867, 4684
  • Unsafe call to private method WP_Theme_JSON::is_valid_viewport_breakpoint_size() through static::
    • src/wp-includes/class-wp-theme-json.php:791
  • Unsafe call to private method WP_Theme_JSON::get_viewport_breakpoint_value_in_pixels() through static::
    • src/wp-includes/class-wp-theme-json.php:834
  • Unsafe call to private method WP_Theme_JSON::get_feature_selector() through static::
    • src/wp-includes/class-wp-theme-json.php:2512

deadCode.unreachable (8)

  • x8 Unreachable statement - code above always terminates
    • src/wp-admin/includes/ajax-actions.php:98, 2729, 2874
    • src/wp-admin/post.php:128, 248
    • src/wp-includes/html-api/class-wp-html-processor.php:6390
    • src/wp-includes/pluggable.php:1396
    • src/wp-includes/sitemaps/class-wp-sitemaps.php:187

assign.propertyType (6)

  • x2 Property WP_Query::$posts (array<int|WP_Post>|null) does not accept list<string|null>
    • src/wp-includes/class-wp-query.php:3321, 3443
  • x2 Property WP_Query::$posts (array<int|WP_Post>|null) does not accept list|null
    • src/wp-includes/class-wp-query.php:3344, 3450
  • Property WP_Comment::$comment_ID (numeric-string) does not accept int
    • src/wp-admin/includes/comment.php:200
  • Property WP_Comment::$comment_post_ID (numeric-string) does not accept int
    • src/wp-admin/includes/comment.php:201

isset.property (5)

  • x2 Property WP_Post::$ID (int<0, max>) in isset() is not nullable
    • src/wp-includes/class-wp-query.php:3820
    • src/wp-includes/nav-menu.php:1069
  • Property WP_Post::$post_title (string) in isset() is not nullable
    • src/wp-admin/includes/class-wp-posts-list-table.php:1138
  • Property WP_Block_Type::$selectors (array) in isset() is not nullable
    • src/wp-includes/block-supports/states.php:402
  • Property WP_Post::$post_status (string) in isset() is not nullable
    • src/wp-includes/link-template.php:351

return.type (5)

  • Method WP_Block_Type::__get() should return array|string|null but returns array
    • src/wp-includes/class-wp-block-type.php:366
  • Function _upgrade_cron_array() should return array{version: 2, ...<int, array<string, array<string, array{schedule: string|false, args: array, interval?: int<0, max>}>>>} but returns non-empty-array<'version'|int, array<string, array{schedule: string|false, args: array, interval?: int<0, max>}>|int>
    • src/wp-includes/cron.php:1333
  • Function wp_post_revision_title() should return string|false but returns null
    • src/wp-includes/post-template.php:1933
  • Function wp_post_revision_title_expanded() should return string|false but returns null
    • src/wp-includes/post-template.php:1975
  • Function term_exists() should return array{term_id: numeric-string, term_taxonomy_id: numeric-string}|int|null but returns string
    • src/wp-includes/taxonomy.php:1683

booleanNot.alwaysFalse (4)

  • x4 Negated boolean expression is always false
    • src/wp-admin/link-manager.php:91
    • src/wp-admin/network/users.php:23, 50
    • src/wp-admin/plugins.php:93

property.nonObject (3)

  • Cannot access property $link on int|string|WP_Term
    • src/wp-admin/includes/ajax-actions.php:1236
  • Cannot access property $id on int|string|WP_Term
    • src/wp-admin/includes/ajax-actions.php:1237
  • Cannot access property $infinite_scrolling on WP_User|false
    • src/wp-admin/user-edit.php:383

variable.undefined (3)

  • x2 Variable $wpdb might not be defined
    • src/wp-admin/users.php:386, 387
  • Variable $plugin_name might not be defined
    • src/wp-admin/includes/class-wp-plugins-list-table.php:1285

property.notFound (3)

  • x2 Access to an undefined property WP_Post::$_wp_attachment_image_alt
    • src/wp-admin/includes/image.php:557, 559
  • Access to an undefined property WP_Post::$front_or_home
    • src/wp-admin/includes/nav-menu.php:459

if.alwaysTrue (3)

  • x3 If condition is always true
    • src/wp-admin/my-sites.php:141
    • src/wp-admin/upload.php:214, 421

function.alreadyNarrowedType (2)

  • Call to function is_wp_error() with WP_Error will always evaluate to true
    • src/wp-admin/includes/ajax-actions.php:2242
  • Call to function wp_die() with arguments non-falsy-string, mixed and array{exit: false, code: 'mysql_not_found'} will always evaluate to true
    • src/wp-includes/load.php:226

argument.unresolvableType (2)

  • x2 Parameter #1 $array_arg of function uksort contains unresolvable type
    • src/wp-includes/cron.php:206, 328

identical.alwaysTrue (1)

  • Strict comparison using === between 'themezip' and 'themezip' will always evaluate to true
    • src/wp-admin/includes/class-file-upload-upgrader.php:85

return.unusedType (1)

  • Function _fix_attachment_links() never returns WP_Error so it can be removed from the return type
    • src/wp-admin/includes/post.php:1154

booleanAnd.leftAlwaysTrue (1)

  • Left side of && is always true
    • src/wp-admin/network/users.php:188

ternary.alwaysTrue (1)

  • Ternary operator condition is always true
    • src/wp-admin/theme-install.php:53

notIdentical.alwaysTrue (1)

  • Strict comparison using !== between array{} and non-empty-array<mixed, mixed> will always evaluate to true
    • src/wp-includes/class-wp-view-config-data.php:526

binaryOp.invalid (1)

  • Binary operation "+" between array<int<0, max>|WP_Comment>|int<1, max> and 1 results in an error
    • src/wp-includes/comment.php:1221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment