diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e2e72fb367482..27c00a45cfa6e 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -133,3 +133,23 @@ parameters: message: '#^PHPDoc tag @throws with type InvalidArgumentException\|ValueError is not subtype of Throwable$#' path: src/wp-includes/compat.php reportUnmatched: false + + # Level 5: + # substr_compare()'s $length has always accepted null, meaning "compare the full length". PHP 7.4 spelled + # that `int $length = null`, where the null default makes the parameter implicitly nullable, and PHP 8.0 + # only made it explicit as `?int $length = null`. The behavior never differed: verified on PHP 7.4 that + # passing null compares the whole string rather than coercing to a length of 0. + # + # PHPStan reads the two spellings from two sources and only one is right. Its PHP 8 stub carries `?int`, + # but the pre-8.0 `resources/functionMap.php` records the type as plain `int`, having dropped the implicit + # nullability when it was transcribed from the old manual. Because `phpVersion.min` is 70400, the legacy + # map wins and null is reported as invalid. + # + # This lives here rather than in a baseline because a baseline entry records work still to be done, and + # there is none: the call is correct on every version WordPress supports, and the fault is in PHPStan's + # data. Passing an explicit length purely to satisfy it would change working code to suit a tooling bug. + # `reportUnmatched: false` so this entry lapses quietly if PHPStan corrects the map. + - + message: '#^Parameter \#4 \$length of function substr_compare expects int, null given\.$#' + path: src/wp-includes/html-api/class-wp-html-tag-processor.php + reportUnmatched: false diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 8a319986766b8..bb8382569dbaa 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -1135,7 +1135,7 @@ protected function _column_title( $post, $classes, $data, $primary ) { * @return string The post title, or 'no title' if no title. */ protected function get_primary_column_aria_label( $item ) { - return isset( $item->post_title ) && ! empty( $item->post_title ) ? $item->post_title : __( 'no title' ); + return ! empty( $item->post_title ) ? $item->post_title : __( 'no title' ); } /** diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php index a94a9eff4a9cf..1a2177a21dbf7 100644 --- a/src/wp-admin/users.php +++ b/src/wp-admin/users.php @@ -339,6 +339,11 @@