diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 09987c1c557fb..075d92a649615 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -54,7 +54,6 @@ includes: - tests/phpstan/baselines/method.childParameterType.neon - tests/phpstan/baselines/method.unused.neon - tests/phpstan/baselines/notIdentical.alwaysTrue.neon - - tests/phpstan/baselines/nullCoalesce.property.neon - tests/phpstan/baselines/offsetAccess.nonOffsetAccessible.neon - tests/phpstan/baselines/offsetAccess.notFound.neon - tests/phpstan/baselines/offsetAssign.valueType.neon diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php index e18c0c4f1d897..a0533e5469a1f 100644 --- a/src/wp-includes/class-wp-locale.php +++ b/src/wp-includes/class-wp-locale.php @@ -118,7 +118,7 @@ class WP_Locale { * Default is 'words'. * * @since 6.2.0 - * @var string + * @var string|null */ public $word_count_type; diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 73178b9eca23b..fb53101244038 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -4980,7 +4980,7 @@ function paginate_links( $args = '' ) { $url_parts = explode( '?', $pagenum_link ); // Get max pages and current page out of the current query, if available. - $total = $wp_query->max_num_pages ?? 1; + $total = ! empty( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; /* diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php index 0a6638934693a..00338cefd59e3 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php @@ -258,7 +258,7 @@ public function prepare_item_for_response( $item, $request ) { } if ( rest_is_field_included( 'template', $fields ) ) { - $data['template'] = $post_type->template ?? array(); + $data['template'] = $post_type->template; } if ( rest_is_field_included( 'template_lock', $fields ) ) { diff --git a/tests/phpstan/baselines/nullCoalesce.property.neon b/tests/phpstan/baselines/nullCoalesce.property.neon deleted file mode 100644 index 431dd45d9d3c9..0000000000000 --- a/tests/phpstan/baselines/nullCoalesce.property.neon +++ /dev/null @@ -1,35 +0,0 @@ -# PHPStan baseline for the `nullCoalesce.property` errors in WordPress core. -# -# https://phpstan.org/error-identifiers/nullCoalesce.property -# -# Each entry is scoped to a single file and carries an exact occurrence count, -# so that a new instance is reported as a new error rather than being absorbed -# silently. Fixing an occurrence therefore means decrementing or removing its -# entry here as part of the same change. -# -# The goal is to empty this file and delete it, along with the `includes` entry -# for it in phpstan.neon.dist. -# -# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with -# -# composer phpstan:baselines -- --identifier=nullCoalesce.property -# -# which reruns the analysis with this file suppressed so the errors surface again. - -parameters: - ignoreErrors: - - - message: '#^Property WP_Locale\:\:\$word_count_type \(string\) on left side of \?\? is not nullable\.$#' - identifier: nullCoalesce.property - count: 1 - path: ../../../src/wp-includes/class-wp-locale.php - - - message: '#^Property WP_Query\:\:\$max_num_pages \(int\) on left side of \?\? is not nullable\.$#' - identifier: nullCoalesce.property - count: 1 - path: ../../../src/wp-includes/general-template.php - - - message: '#^Property WP_Post_Type\:\:\$template \(array\\) on left side of \?\? is not nullable\.$#' - identifier: nullCoalesce.property - count: 1 - path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php