From f379ff7d72590420ec7d3bb6fce2d6040d25c9e4 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:49:27 +0530 Subject: [PATCH 01/14] Code Quality: Correct the type of `Walker::$tree_type`. `Walker_Nav_Menu` has set `$tree_type` to an array of the item types it handles since r13802, but both it and `Walker` documented the property as a string. The parent now allows a string or an array of strings, and `Walker_Nav_Menu` documents its array. This removes the `Walker_Nav_Menu` entry from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r13802, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-walker-nav-menu.php | 2 +- src/wp-includes/class-wp-walker.php | 2 +- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php index 1f9bd6bfdd536..f462ad772ab7c 100644 --- a/src/wp-includes/class-walker-nav-menu.php +++ b/src/wp-includes/class-walker-nav-menu.php @@ -19,7 +19,7 @@ class Walker_Nav_Menu extends Walker { * What the class handles. * * @since 3.0.0 - * @var string + * @var string[] * * @see Walker::$tree_type */ diff --git a/src/wp-includes/class-wp-walker.php b/src/wp-includes/class-wp-walker.php index 2c40984119165..068ac4c7451ad 100644 --- a/src/wp-includes/class-wp-walker.php +++ b/src/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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 5c7ebe5274920..6554f211e5e29 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,11 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property Walker_Nav_Menu\:\:\$tree_type \(string\) does not accept default value of type array\\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-walker-nav-menu.php - message: '#^Property WP_Block\:\:\$inner_blocks \(WP_Block_List\) does not accept default value of type array\.$#' identifier: property.defaultValue From 446c0d70585250a6044a1ea92982c1ae8e689110 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:50:02 +0530 Subject: [PATCH 02/14] Code Quality: Document `WP_Block::$inner_blocks` as possibly empty. Since `WP_Block` was introduced in r48159, `$inner_blocks` has defaulted to an empty array, and `refresh_parsed_block_dependents()` only replaces it with a `WP_Block_List` when the parsed block has inner blocks. Its `@var` tag omitted the empty array. It is now documented as `WP_Block_List|array{}`, which removes the `WP_Block` entry from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r48159, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-block.php | 4 +++- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php index 8baf0f99bacde..199eba4f41c82 100644 --- a/src/wp-includes/class-wp-block.php +++ b/src/wp-includes/class-wp-block.php @@ -68,8 +68,10 @@ 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{} */ public $inner_blocks = array(); diff --git a/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 6554f211e5e29..515e0f0dd78dd 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,11 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property WP_Block\:\:\$inner_blocks \(WP_Block_List\) does not accept default value of type array\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-block.php - message: '#^Property WP_Comment_Query\:\:\$date_query \(WP_Date_Query\) does not accept default value of type false\.$#' identifier: property.defaultValue From a04b85c8c259d2b9740f60d8576cb626b09fbbb0 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:50:57 +0530 Subject: [PATCH 03/14] Code Quality: Default `WP_Term::$term_group` to `0`. Since `WP_Term` was introduced in r34997, `$term_group` has been documented as an integer, but it defaulted to an empty string. The other integer properties of the class default to `0`, as does the `term_group` column, and `sanitize_term_field()` casts the value to an integer. The default is now `0`, which removes the `WP_Term` entry from the `property.defaultValue` baseline. This only affects a `WP_Term` constructed from an object without a `term_group`, since the constructor copies every property it is given. Follow-up to r34997, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-term.php | 2 +- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-term.php b/src/wp-includes/class-wp-term.php index a9a58da875e4a..e34fc1a93d067 100644 --- a/src/wp-includes/class-wp-term.php +++ b/src/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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 515e0f0dd78dd..e82209a91548a 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -88,11 +88,6 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-term-query.php - - - message: '#^Property WP_Term\:\:\$term_group \(int\) does not accept default value of type string\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-term.php - message: '#^Property WP_User_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' identifier: property.defaultValue From 6d982a71ad5b03630b42ffd703b1b1ec7df2e117 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:53:23 +0530 Subject: [PATCH 04/14] Code Quality: Document the query containers of `WP_Query` as possibly false. `WP_Query::$meta_query` and `WP_Query::$date_query` default to false. `get_posts()` only sets `$meta_query` to a `WP_Meta_Query` when the query runs, and only sets `$date_query` to a `WP_Date_Query` when the query has a `date_query` argument, but their `@var` tags omitted false. Adding it removes two entries from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r25139, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-query.php | 8 ++++++-- tests/phpstan/baselines/property.defaultValue.neon | 10 ---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 0c07cb26bf71d..913738319c769 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/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 unless the query has a `date_query` argument. + * * @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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index e82209a91548a..73d6050b33bf2 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -63,16 +63,6 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_Query\:\:\$date_query \(WP_Date_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-query.php - - - message: '#^Property WP_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-query.php - message: '#^Property WP_Site_Query\:\:\$date_query \(WP_Date_Query\) does not accept default value of type false\.$#' identifier: property.defaultValue From d95e244ccbc36153a21df7aa4e355dcd90e1c9bc Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:53:26 +0530 Subject: [PATCH 05/14] Code Quality: Document the query containers of `WP_Comment_Query` as possibly false. `WP_Comment_Query::$meta_query` and `WP_Comment_Query::$date_query` default to false. `get_comments()` only sets `$meta_query` to a `WP_Meta_Query` when the query runs, and `get_comment_ids()` only sets `$date_query` to a `WP_Date_Query` when the query has a `date_query` argument, but their `@var` tags omitted false. Adding it removes two entries from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r25139, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-comment-query.php | 8 ++++++-- tests/phpstan/baselines/property.defaultValue.neon | 10 ---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index ad706ba532114..c1a77ee591e45 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/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 unless the query has a `date_query` argument. + * * @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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 73d6050b33bf2..bfce3c45e21bf 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,16 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property WP_Comment_Query\:\:\$date_query \(WP_Date_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-comment-query.php - - - message: '#^Property WP_Comment_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-comment-query.php - message: '#^Property WP_Customize_Control\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' identifier: property.defaultValue From 888cbe66335f2c2e1f8c8b14bc78d69c3ee2b646 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:53:45 +0530 Subject: [PATCH 06/14] Code Quality: Document the query containers of `WP_Site_Query` as possibly false. `WP_Site_Query::$meta_query` and `WP_Site_Query::$date_query` default to false. `get_sites()` only sets `$meta_query` to a `WP_Meta_Query` when the query runs, and `get_site_ids()` only sets `$date_query` to a `WP_Date_Query` when the query has a `date_query` argument, but their `@var` tags omitted false. Adding it removes two entries from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r37477, r43010, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-site-query.php | 8 ++++++-- tests/phpstan/baselines/property.defaultValue.neon | 10 ---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/class-wp-site-query.php b/src/wp-includes/class-wp-site-query.php index aab8b511fcf83..b2e90f7d9812b 100644 --- a/src/wp-includes/class-wp-site-query.php +++ b/src/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 unless the query has a `date_query` argument. + * * @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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index bfce3c45e21bf..55ca35c26dd17 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -53,16 +53,6 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_Site_Query\:\:\$date_query \(WP_Date_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-site-query.php - - - message: '#^Property WP_Site_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-site-query.php - message: '#^Property WP_Term_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' identifier: property.defaultValue From d37a8e8fceae80d21fa5e52cb38d8630f3a843aa Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:53:48 +0530 Subject: [PATCH 07/14] Code Quality: Document `WP_Term_Query::$meta_query` as possibly false. `WP_Term_Query::$meta_query` defaults to false, and `get_terms()` only sets it to a `WP_Meta_Query` when the query runs, but its `@var` tag omitted false. Adding it removes the `WP_Term_Query` entry from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r37572, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-term-query.php | 4 +++- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-term-query.php b/src/wp-includes/class-wp-term-query.php index 179a8decd7e55..13e768c52de87 100644 --- a/src/wp-includes/class-wp-term-query.php +++ b/src/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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 55ca35c26dd17..7ca2ddec13c15 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -53,11 +53,6 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_Term_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-term-query.php - message: '#^Property WP_User_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' identifier: property.defaultValue From 1dc98225fcd162852b837443c4b3e41536f6b19f Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:53:51 +0530 Subject: [PATCH 08/14] Code Quality: Document `WP_User_Query::$meta_query` as possibly false. `WP_User_Query::$meta_query` defaults to false, and `prepare_query()` only sets it to a `WP_Meta_Query` when the query is prepared, but its `@var` tag omitted false. Adding it removes the `WP_User_Query` entry from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-user-query.php | 4 +++- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-user-query.php b/src/wp-includes/class-wp-user-query.php index 61fc3edbc8ef9..27990ea6dcff9 100644 --- a/src/wp-includes/class-wp-user-query.php +++ b/src/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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 7ca2ddec13c15..9f3afc4778003 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -53,8 +53,3 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_User_Query\:\:\$meta_query \(WP_Meta_Query\) does not accept default value of type false\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-user-query.php From a1539314c4c9137e0a1ec7c19892acbc8b46abc7 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:55:22 +0530 Subject: [PATCH 09/14] Code Quality: Correct the type of `WP_Customize_Panel::$theme_supports`. `WP_Customize_Panel::$theme_supports` defaults to an empty string, and `check_capabilities()` casts it to an array before passing it to `current_theme_supports()`, but it was documented as `mixed[]`. It is now documented as a string or an array of strings, as `WP_Customize_Section::$theme_supports` and `WP_Customize_Setting::$theme_supports` already are, along with the matching constructor argument. This removes the `theme_supports` entry from the `property.defaultValue` baseline. There is no runtime change. Follow-up to r29487, r53877, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-customize-panel.php | 4 ++-- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/class-wp-customize-panel.php b/src/wp-includes/class-wp-customize-panel.php index 9607358bd220b..010200ba0648a 100644 --- a/src/wp-includes/class-wp-customize-panel.php +++ b/src/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 = ''; @@ -152,7 +152,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/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 9f3afc4778003..4f7fcdd050873 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -28,11 +28,6 @@ parameters: identifier: property.defaultValue count: 1 path: ../../../src/wp-includes/class-wp-customize-panel.php - - - message: '#^Property WP_Customize_Panel\:\:\$theme_supports \(array\\) does not accept default value of type string\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-panel.php - message: '#^Property WP_Customize_Section\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' identifier: property.defaultValue From d4746f421f7e15a7bd7fb26271e199e869c6c8a9 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:57:54 +0530 Subject: [PATCH 10/14] Code Quality: Document the default of `WP_Customize_Control::$active_callback`. `WP_Customize_Control::$active_callback` defaults to an empty string, which the constructor replaces with `WP_Customize_Control::active_callback()`, but it was documented as a callable only. The `@var` tag now includes the string, with an `@phpstan-var` tag for the exact `callable|''` type, and the description says what the empty string means. This removes the `WP_Customize_Control` entry from the `property.defaultValue` baseline. Since the `empty()` check in the constructor is no longer seen as always false, this also removes the matching entry from the `empty.property` baseline. There is no runtime change. Follow-up to r29051, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-customize-control.php | 12 ++++++++---- tests/phpstan/baselines/empty.property.neon | 5 ----- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/wp-includes/class-wp-customize-control.php b/src/wp-includes/class-wp-customize-control.php index 859958a2f6838..45cff6b38064c 100644 --- a/src/wp-includes/class-wp-customize-control.php +++ b/src/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 + * 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 + * 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|'' */ public $active_callback = ''; diff --git a/tests/phpstan/baselines/empty.property.neon b/tests/phpstan/baselines/empty.property.neon index 29c45b3128ea4..4f0f584e4f8ed 100644 --- a/tests/phpstan/baselines/empty.property.neon +++ b/tests/phpstan/baselines/empty.property.neon @@ -23,11 +23,6 @@ parameters: identifier: empty.property count: 1 path: ../../../src/wp-includes/blocks.php - - - message: '#^Property WP_Customize_Control\:\:\$active_callback \(callable\) in empty\(\) is not falsy\.$#' - identifier: empty.property - count: 1 - path: ../../../src/wp-includes/class-wp-customize-control.php - message: '#^Property WP_Customize_Manager\:\:\$nav_menus \(WP_Customize_Nav_Menus\) in empty\(\) is not falsy\.$#' identifier: empty.property diff --git a/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 4f7fcdd050873..ae23f216b9671 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,11 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property WP_Customize_Control\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-control.php - message: '#^Property WP_Customize_Panel\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' identifier: property.defaultValue From f90b9c5cc911d7adabf0cf1c092b7a8538a3e799 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:58:00 +0530 Subject: [PATCH 11/14] Code Quality: Document the default of `WP_Customize_Panel::$active_callback`. `WP_Customize_Panel::$active_callback` defaults to an empty string, which the constructor replaces with `WP_Customize_Panel::active_callback()`, but it was documented as a callable only. The `@var` tag now includes the string, with an `@phpstan-var` tag for the exact `callable|''` type, and the description says what the empty string means. This removes the `active_callback` entry for `WP_Customize_Panel` from the `property.defaultValue` baseline. Since the `empty()` check in the constructor is no longer seen as always false, this also removes the matching entry from the `empty.property` baseline. There is no runtime change. The docblock was copied from `WP_Customize_Section` and still referred to sections. It now refers to `WP_Customize_Panel::active()` and the panel instance that the callback receives. Follow-up to r30102, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-customize-panel.php | 14 +++++++++----- tests/phpstan/baselines/empty.property.neon | 5 ----- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/wp-includes/class-wp-customize-panel.php b/src/wp-includes/class-wp-customize-panel.php index 010200ba0648a..9a72956874ad0 100644 --- a/src/wp-includes/class-wp-customize-panel.php +++ b/src/wp-includes/class-wp-customize-panel.php @@ -125,14 +125,18 @@ class WP_Customize_Panel { /** * Active callback. * + * This is an empty string by default, which the constructor replaces with + * 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 + * 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|'' */ public $active_callback = ''; diff --git a/tests/phpstan/baselines/empty.property.neon b/tests/phpstan/baselines/empty.property.neon index 4f0f584e4f8ed..34a94ae69cbb7 100644 --- a/tests/phpstan/baselines/empty.property.neon +++ b/tests/phpstan/baselines/empty.property.neon @@ -33,11 +33,6 @@ parameters: identifier: empty.property count: 1 path: ../../../src/wp-includes/class-wp-customize-manager.php - - - message: '#^Property WP_Customize_Panel\:\:\$active_callback \(callable\) in empty\(\) is not falsy\.$#' - identifier: empty.property - count: 1 - path: ../../../src/wp-includes/class-wp-customize-panel.php - message: '#^Property WP_Customize_Section\:\:\$active_callback \(callable\) in empty\(\) is not falsy\.$#' identifier: empty.property diff --git a/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index ae23f216b9671..118cb03c7bfd1 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,11 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property WP_Customize_Panel\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-panel.php - message: '#^Property WP_Customize_Section\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' identifier: property.defaultValue From 77e85fcc3ba4a3ddd66a044269f83ad7221d6cb8 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:58:06 +0530 Subject: [PATCH 12/14] Code Quality: Document the default of `WP_Customize_Section::$active_callback`. `WP_Customize_Section::$active_callback` defaults to an empty string, which the constructor replaces with `WP_Customize_Section::active_callback()`, but it was documented as a callable only. The `@var` tag now includes the string, with an `@phpstan-var` tag for the exact `callable|''` type, and the description says what the empty string means. This removes the `WP_Customize_Section` entry from the `property.defaultValue` baseline. Since the `empty()` check in the constructor is no longer seen as always false, this also removes the matching entry from the `empty.property` baseline. There is no runtime change. Follow-up to r30102, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-customize-section.php | 12 ++++++++---- tests/phpstan/baselines/empty.property.neon | 5 ----- tests/phpstan/baselines/property.defaultValue.neon | 5 ----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/wp-includes/class-wp-customize-section.php b/src/wp-includes/class-wp-customize-section.php index d2ef51ab0c57f..7d463c0ee76dc 100644 --- a/src/wp-includes/class-wp-customize-section.php +++ b/src/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 + * 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 + * 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|'' */ public $active_callback = ''; diff --git a/tests/phpstan/baselines/empty.property.neon b/tests/phpstan/baselines/empty.property.neon index 34a94ae69cbb7..9040ec4efd952 100644 --- a/tests/phpstan/baselines/empty.property.neon +++ b/tests/phpstan/baselines/empty.property.neon @@ -33,11 +33,6 @@ parameters: identifier: empty.property count: 1 path: ../../../src/wp-includes/class-wp-customize-manager.php - - - message: '#^Property WP_Customize_Section\:\:\$active_callback \(callable\) in empty\(\) is not falsy\.$#' - identifier: empty.property - count: 1 - path: ../../../src/wp-includes/class-wp-customize-section.php - message: '#^Property WP_Customize_Manager\:\:\$nav_menus \(WP_Customize_Nav_Menus\) in empty\(\) is not falsy\.$#' identifier: empty.property diff --git a/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon index 118cb03c7bfd1..ba3e6ac452b33 100644 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ b/tests/phpstan/baselines/property.defaultValue.neon @@ -18,11 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Property WP_Customize_Section\:\:\$active_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-section.php - message: '#^Property WP_Customize_Setting\:\:\$sanitize_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' identifier: property.defaultValue From 43264a68bd3e9811eeb2909e9b193ed9ffdd20b9 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 15:58:10 +0530 Subject: [PATCH 13/14] Code Quality: Document the default of the `WP_Customize_Setting` callbacks. `WP_Customize_Setting::$validate_callback`, `$sanitize_callback`, and `$sanitize_js_callback` default to an empty string, which means there is no callback: the constructor only hooks each one when it is set. They were documented as callables only. Their `@var` tags now include the string, with `@phpstan-var` tags for the exact `callable|''` type, and the descriptions say what the empty string means. This empties the `property.defaultValue` baseline, so it is removed. There is no runtime change. Follow-up to r37476, r63022. See #66739. Co-Authored-By: Claude Opus 5.5 --- .../class-wp-customize-setting.php | 15 ++++++-- .../baselines/property.defaultValue.neon | 35 ------------------- 2 files changed, 12 insertions(+), 38 deletions(-) delete mode 100644 tests/phpstan/baselines/property.defaultValue.neon diff --git a/src/wp-includes/class-wp-customize-setting.php b/src/wp-includes/class-wp-customize-setting.php index 77a544bfbae0e..89d6322dbdc13 100644 --- a/src/wp-includes/class-wp-customize-setting.php +++ b/src/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|'' */ 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|'' */ 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|'' */ public $sanitize_js_callback = ''; diff --git a/tests/phpstan/baselines/property.defaultValue.neon b/tests/phpstan/baselines/property.defaultValue.neon deleted file mode 100644 index ba3e6ac452b33..0000000000000 --- a/tests/phpstan/baselines/property.defaultValue.neon +++ /dev/null @@ -1,35 +0,0 @@ -# PHPStan baseline for the `property.defaultValue` errors in WordPress core. -# -# https://phpstan.org/error-identifiers/property.defaultValue -# -# 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. -# -# Generated by `composer phpstan:baselines`. Do not edit by hand. Regenerate with: -# -# composer phpstan:baselines -- --identifier=property.defaultValue --config=phpstan.neon.dist -# -# This reruns the analysis with the baselines in this directory suppressed, so -# that their errors surface again, and rewrites only this file. - -parameters: - ignoreErrors: - - - message: '#^Property WP_Customize_Setting\:\:\$sanitize_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_Customize_Setting\:\:\$sanitize_js_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-setting.php - - - message: '#^Property WP_Customize_Setting\:\:\$validate_callback \(callable\(\)\: mixed\) does not accept default value of type ''''\.$#' - identifier: property.defaultValue - count: 1 - path: ../../../src/wp-includes/class-wp-customize-setting.php From 0d0c005d210ad72e8c71db6715e40299e5e52b2b Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 26 Nov 2026 18:34:07 +0530 Subject: [PATCH 14/14] Tests: Cover the default of `WP_Term::$term_group`. The existing tests only read `term_group` from terms loaded from the database, which always provide it. The new test constructs a `WP_Term` from an object without a `term_group` and checks that it defaults to the integer `0`, and that a provided value is kept. Follow-up to a04b85c8c2. See #66739. Co-Authored-By: Claude Opus 5.5 --- tests/phpunit/tests/term/wpTerm.php | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/phpunit/tests/term/wpTerm.php b/tests/phpunit/tests/term/wpTerm.php index 0eda866356514..9a6e3c7905f90 100644 --- a/tests/phpunit/tests/term/wpTerm.php +++ b/tests/phpunit/tests/term/wpTerm.php @@ -187,4 +187,34 @@ public static function data_get_instance_treats_a_poisoned_cache_value_as_a_cach 'a WP_Term without term_id' => array( new WP_Term( new stdClass() ) ), ); } + + /** + * Tests that `term_group` defaults to the integer 0 when the term data does not include it. + * + * @ticket 66739 + * + * @covers WP_Term::__construct + * + * @dataProvider data_term_group + * + * @param object $data Term data passed to the constructor. + * @param int $expected Expected term group. + */ + public function test_term_group( object $data, int $expected ): void { + $term = new WP_Term( $data ); + + $this->assertSame( $expected, $term->term_group ); + } + + /** + * Data provider. + * + * @return array + */ + public static function data_term_group(): array { + return array( + 'term data without term_group' => array( new stdClass(), 0 ), + 'term data with a term_group' => array( (object) array( 'term_group' => 2 ), 2 ), + ); + } }