wp/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
--- a/wp/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php	Tue Sep 27 16:37:53 2022 +0200
@@ -53,12 +53,18 @@
 	 * Gets a URL list for a post type sitemap.
 	 *
 	 * @since 5.5.0
+	 * @since 5.9.0 Renamed `$post_type` to `$object_subtype` to match parent class
+	 *              for PHP 8 named parameter support.
 	 *
-	 * @param int    $page_num  Page of results.
-	 * @param string $post_type Optional. Post type name. Default empty.
-	 * @return array Array of URLs for a sitemap.
+	 * @param int    $page_num       Page of results.
+	 * @param string $object_subtype Optional. Post type name. Default empty.
+	 *
+	 * @return array[] Array of URL information for a sitemap.
 	 */
-	public function get_url_list( $page_num, $post_type = '' ) {
+	public function get_url_list( $page_num, $object_subtype = '' ) {
+		// Restores the more descriptive, specific name for use within this method.
+		$post_type = $object_subtype;
+
 		// Bail early if the queried post type is not supported.
 		$supported_types = $this->get_object_subtypes();
 
@@ -69,14 +75,14 @@
 		/**
 		 * Filters the posts URL list before it is generated.
 		 *
-		 * Passing a non-null value will effectively short-circuit the generation,
+		 * Returning a non-null value will effectively short-circuit the generation,
 		 * returning that value instead.
 		 *
 		 * @since 5.5.0
 		 *
-		 * @param array  $url_list  The URL list. Default null.
-		 * @param string $post_type Post type name.
-		 * @param int    $page_num  Page of results.
+		 * @param array[]|null $url_list  The URL list. Default null.
+		 * @param string       $post_type Post type name.
+		 * @param int          $page_num  Page of results.
 		 */
 		$url_list = apply_filters(
 			'wp_sitemaps_posts_pre_url_list',
@@ -142,15 +148,20 @@
 	 * Gets the max number of pages available for the object type.
 	 *
 	 * @since 5.5.0
+	 * @since 5.9.0 Renamed `$post_type` to `$object_subtype` to match parent class
+	 *              for PHP 8 named parameter support.
 	 *
-	 * @param string $post_type Optional. Post type name. Default empty.
+	 * @param string $object_subtype Optional. Post type name. Default empty.
 	 * @return int Total number of pages.
 	 */
-	public function get_max_num_pages( $post_type = '' ) {
-		if ( empty( $post_type ) ) {
+	public function get_max_num_pages( $object_subtype = '' ) {
+		if ( empty( $object_subtype ) ) {
 			return 0;
 		}
 
+		// Restores the more descriptive, specific name for use within this method.
+		$post_type = $object_subtype;
+
 		/**
 		 * Filters the max number of pages before it is generated.
 		 *