Commit 062e32939f for wordpress.org

commit 062e32939ff3971b127856264104e4c48121594a
Author: westonruter <westonruter@git.wordpress.org>
Date:   Mon Nov 30 18:43:59 2026 +0000

    Code Quality: Resolve the `property.defaultValue` PHPStan errors.

    In each case the default value is intended, so the documented type is corrected to include it, as was done in r65218. This empties the baseline, so it is removed, along with the `empty.property` errors that the previous `callable` type of `$active_callback` caused.

    The exception is `WP_Term::$term_group`, whose empty string default was a mistake, and which now defaults to `0`. This only affects a `WP_Term` constructed from an object without a `term_group`, since terms from the database always provide one.

    The corrected types expose existing level 10 errors where a `$meta_query` is read before the query runs, and where an `$active_callback` is called. These are left for a follow-up.

    Developed in https://github.com/WordPress/wordpress-develop/pull/16263.
    Follow-up to r13802, r29051, r34997, r63022, r65218.

    Props mukesh27, westonruter.
    See #66739.

    Built from https://develop.svn.wordpress.org/trunk@65830


    git-svn-id: http://core.svn.wordpress.org/trunk@64859 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php
index 1f9bd6bfdd..919f8ad813 100644
--- a/wp-includes/class-walker-nav-menu.php
+++ b/wp-includes/class-walker-nav-menu.php
@@ -19,7 +19,8 @@ class Walker_Nav_Menu extends Walker {
 	 * What the class handles.
 	 *
 	 * @since 3.0.0
-	 * @var string
+	 * @var string[]
+	 * @phpstan-var list<non-empty-string>
 	 *
 	 * @see Walker::$tree_type
 	 */
diff --git a/wp-includes/class-wp-block.php b/wp-includes/class-wp-block.php
index 8baf0f99ba..17e3706f4e 100644
--- a/wp-includes/class-wp-block.php
+++ b/wp-includes/class-wp-block.php
@@ -68,8 +68,11 @@ class WP_Block {
 	/**
 	 * List of inner blocks (of this same class)
 	 *
+	 * This is an empty array when the block has no inner blocks.
+	 *
 	 * @since 5.5.0
-	 * @var WP_Block_List
+	 * @var WP_Block_List|array
+	 * @phpstan-var WP_Block_List|array{}
 	 */
 	public $inner_blocks = array();

diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php
index ad706ba532..c8e6347579 100644
--- a/wp-includes/class-wp-comment-query.php
+++ b/wp-includes/class-wp-comment-query.php
@@ -28,8 +28,10 @@ class WP_Comment_Query {
 	/**
 	 * Metadata query container
 	 *
+	 * This is false until the query is run.
+	 *
 	 * @since 3.5.0
-	 * @var WP_Meta_Query A meta query instance.
+	 * @var WP_Meta_Query|false A meta query instance.
 	 */
 	public $meta_query = false;

@@ -69,8 +71,10 @@ class WP_Comment_Query {
 	/**
 	 * Date query container
 	 *
+	 * This is false until a query with a `date_query` argument runs.
+	 *
 	 * @since 3.7.0
-	 * @var WP_Date_Query A date query instance.
+	 * @var WP_Date_Query|false A date query instance.
 	 */
 	public $date_query = false;

diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php
index 859958a2f6..33da1d5db1 100644
--- a/wp-includes/class-wp-customize-control.php
+++ b/wp-includes/class-wp-customize-control.php
@@ -157,14 +157,18 @@ class WP_Customize_Control {
 	/**
 	 * Callback.
 	 *
+	 * This is an empty string by default, which the constructor replaces with
+	 * {@see WP_Customize_Control::active_callback()}.
+	 *
 	 * @since 4.0.0
 	 *
 	 * @see WP_Customize_Control::active()
 	 *
-	 * @var callable Callback is called with one argument, the instance of
-	 *               WP_Customize_Control, and returns bool to indicate whether
-	 *               the control is active (such as it relates to the URL
-	 *               currently being previewed).
+	 * @var callable|string Callback is called with one argument, the instance of
+	 *                      {@see WP_Customize_Control}, and returns bool to indicate whether
+	 *                      the control is active (such as it relates to the URL
+	 *                      currently being previewed).
+	 * @phpstan-var (callable( WP_Customize_Control ): bool)|''
 	 */
 	public $active_callback = '';

diff --git a/wp-includes/class-wp-customize-panel.php b/wp-includes/class-wp-customize-panel.php
index 9607358bd2..0a63a98c99 100644
--- a/wp-includes/class-wp-customize-panel.php
+++ b/wp-includes/class-wp-customize-panel.php
@@ -78,7 +78,7 @@ class WP_Customize_Panel {
 	 * Theme features required to support the panel.
 	 *
 	 * @since 4.0.0
-	 * @var mixed[]
+	 * @var string|string[]
 	 */
 	public $theme_supports = '';

@@ -125,14 +125,18 @@ class WP_Customize_Panel {
 	/**
 	 * Active callback.
 	 *
+	 * This is an empty string by default, which the constructor replaces with
+	 * {@see WP_Customize_Panel::active_callback()}.
+	 *
 	 * @since 4.1.0
 	 *
-	 * @see WP_Customize_Section::active()
+	 * @see WP_Customize_Panel::active()
 	 *
-	 * @var callable Callback is called with one argument, the instance of
-	 *               WP_Customize_Section, and returns bool to indicate whether
-	 *               the section is active (such as it relates to the URL currently
-	 *               being previewed).
+	 * @var callable|string Callback is called with one argument, the instance of
+	 *                      {@see WP_Customize_Panel}, and returns bool to indicate whether
+	 *                      the panel is active (such as it relates to the URL currently
+	 *                      being previewed).
+	 * @phpstan-var (callable( WP_Customize_Panel ): bool)|''
 	 */
 	public $active_callback = '';

@@ -152,7 +156,7 @@ class WP_Customize_Panel {
 	 *                                            of panels and sections. Default 160.
 	 *     @type string          $capability      Capability required for the panel.
 	 *                                            Default `edit_theme_options`.
-	 *     @type mixed[]         $theme_supports  Theme features required to support the panel.
+	 *     @type string|string[] $theme_supports  Theme features required to support the panel.
 	 *     @type string          $title           Title of the panel to show in UI.
 	 *     @type string          $description     Description to show in the UI.
 	 *     @type string          $type            Type of the panel.
diff --git a/wp-includes/class-wp-customize-section.php b/wp-includes/class-wp-customize-section.php
index d2ef51ab0c..1502c7669d 100644
--- a/wp-includes/class-wp-customize-section.php
+++ b/wp-includes/class-wp-customize-section.php
@@ -120,14 +120,18 @@ class WP_Customize_Section {
 	/**
 	 * Active callback.
 	 *
+	 * This is an empty string by default, which the constructor replaces with
+	 * {@see WP_Customize_Section::active_callback()}.
+	 *
 	 * @since 4.1.0
 	 *
 	 * @see WP_Customize_Section::active()
 	 *
-	 * @var callable Callback is called with one argument, the instance of
-	 *               WP_Customize_Section, and returns bool to indicate whether
-	 *               the section is active (such as it relates to the URL currently
-	 *               being previewed).
+	 * @var callable|string Callback is called with one argument, the instance of
+	 *                      {@see WP_Customize_Section}, and returns bool to indicate whether
+	 *                      the section is active (such as it relates to the URL currently
+	 *                      being previewed).
+	 * @phpstan-var (callable( WP_Customize_Section ): bool)|''
 	 */
 	public $active_callback = '';

diff --git a/wp-includes/class-wp-customize-setting.php b/wp-includes/class-wp-customize-setting.php
index 77a544bfba..3d3c19b4d4 100644
--- a/wp-includes/class-wp-customize-setting.php
+++ b/wp-includes/class-wp-customize-setting.php
@@ -86,24 +86,33 @@ class WP_Customize_Setting {
 	/**
 	 * Server-side validation callback for the setting's value.
 	 *
+	 * An empty string means there is no callback.
+	 *
 	 * @since 4.6.0
-	 * @var callable
+	 * @var callable|string
+	 * @phpstan-var (callable( WP_Error, mixed, WP_Customize_Setting ): mixed)|''
 	 */
 	public $validate_callback = '';

 	/**
 	 * Callback to filter a Customize setting value in un-slashed form.
 	 *
+	 * An empty string means there is no callback.
+	 *
 	 * @since 3.4.0
-	 * @var callable
+	 * @var callable|string
+	 * @phpstan-var (callable( mixed, WP_Customize_Setting ): mixed)|''
 	 */
 	public $sanitize_callback = '';

 	/**
 	 * Callback to convert a Customize PHP setting value to a value that is JSON serializable.
 	 *
+	 * An empty string means there is no callback.
+	 *
 	 * @since 3.4.0
-	 * @var callable
+	 * @var callable|string
+	 * @phpstan-var (callable( mixed, WP_Customize_Setting ): mixed)|''
 	 */
 	public $sanitize_js_callback = '';

diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php
index 0c07cb26bf..30ba5ee376 100644
--- a/wp-includes/class-wp-query.php
+++ b/wp-includes/class-wp-query.php
@@ -49,16 +49,20 @@ class WP_Query {
 	/**
 	 * Metadata query container.
 	 *
+	 * This is false until the query is run.
+	 *
 	 * @since 3.2.0
-	 * @var WP_Meta_Query A meta query instance.
+	 * @var WP_Meta_Query|false A meta query instance.
 	 */
 	public $meta_query = false;

 	/**
 	 * Date query container.
 	 *
+	 * This is false until a query with a `date_query` argument runs.
+	 *
 	 * @since 3.7.0
-	 * @var WP_Date_Query A date query instance.
+	 * @var WP_Date_Query|false A date query instance.
 	 */
 	public $date_query = false;

diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php
index aab8b511fc..fdf64be6c5 100644
--- a/wp-includes/class-wp-site-query.php
+++ b/wp-includes/class-wp-site-query.php
@@ -43,8 +43,10 @@ class WP_Site_Query {
 	/**
 	 * Metadata query container.
 	 *
+	 * This is false until the query is run.
+	 *
 	 * @since 5.1.0
-	 * @var WP_Meta_Query
+	 * @var WP_Meta_Query|false
 	 */
 	public $meta_query = false;

@@ -59,8 +61,10 @@ class WP_Site_Query {
 	/**
 	 * Date query container.
 	 *
+	 * This is false until a query with a `date_query` argument runs.
+	 *
 	 * @since 4.6.0
-	 * @var WP_Date_Query A date query instance.
+	 * @var WP_Date_Query|false A date query instance.
 	 */
 	public $date_query = false;

diff --git a/wp-includes/class-wp-term-query.php b/wp-includes/class-wp-term-query.php
index 179a8decd7..13e768c52d 100644
--- a/wp-includes/class-wp-term-query.php
+++ b/wp-includes/class-wp-term-query.php
@@ -29,8 +29,10 @@ class WP_Term_Query {
 	/**
 	 * Metadata query container.
 	 *
+	 * This is false until the query is run.
+	 *
 	 * @since 4.6.0
-	 * @var WP_Meta_Query A meta query instance.
+	 * @var WP_Meta_Query|false A meta query instance.
 	 */
 	public $meta_query = false;

diff --git a/wp-includes/class-wp-term.php b/wp-includes/class-wp-term.php
index a9a58da875..e34fc1a93d 100644
--- a/wp-includes/class-wp-term.php
+++ b/wp-includes/class-wp-term.php
@@ -47,7 +47,7 @@ final class WP_Term {
 	 * @since 4.4.0
 	 * @var int
 	 */
-	public $term_group = '';
+	public $term_group = 0;

 	/**
 	 * Term Taxonomy ID.
diff --git a/wp-includes/class-wp-user-query.php b/wp-includes/class-wp-user-query.php
index 61fc3edbc8..27990ea6dc 100644
--- a/wp-includes/class-wp-user-query.php
+++ b/wp-includes/class-wp-user-query.php
@@ -44,8 +44,10 @@ class WP_User_Query {
 	/**
 	 * Metadata query container.
 	 *
+	 * This is false until the query is run.
+	 *
 	 * @since 4.2.0
-	 * @var WP_Meta_Query
+	 * @var WP_Meta_Query|false
 	 */
 	public $meta_query = false;

diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php
index 2c40984119..068ac4c745 100644
--- a/wp-includes/class-wp-walker.php
+++ b/wp-includes/class-wp-walker.php
@@ -17,7 +17,7 @@ class Walker {
 	 * What the class handles.
 	 *
 	 * @since 2.1.0
-	 * @var string
+	 * @var string|string[]
 	 */
 	public $tree_type;

diff --git a/wp-includes/version.php b/wp-includes/version.php
index 5927594826..a7af7cd497 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.3-alpha-65829';
+$wp_version = '7.3-alpha-65830';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.