Commit 4e3b99a771 for wordpress.org

commit 4e3b99a7714f3d82d0822bc0426f912535528ce0
Author: westonruter <westonruter@git.wordpress.org>
Date:   Mon Oct 26 22:20:47 2026 +0000

    Code Quality: Remove the global PHPStan type aliases.

    The `typeAliases` defined in `tests/phpstan/base.neon` only exist for core's own analysis, but the docblocks in `src/` that use them are read elsewhere too. A WordPress release package and the `WordPress/WordPress` repository only include `src/`, and the stubs generated from core (as used by `szepeviktor/phpstan-wordpress`) keep each reference to an alias while losing its definition. Anyone analyzing a plugin or theme against core then gets an unknown type at every use of an alias, unless they define each one themselves.

    The `Maybe_Callable` union is now written out at each of its uses, which are mostly functions, where an alias declared on a class cannot be imported. The `Block_Style_Properties` shape is declared with `@phpstan-type` on `WP_Block_Styles_Registry`, which the generated stubs keep, and imported into `WP_REST_Block_Types_Controller`. A note in `base.neon` explains why new aliases should be declared on a class as well, at least until PHPStan supports declaring one outside a class.

    Developed in https://github.com/WordPress/wordpress-develop/pull/14900.
    Follow-up to r63451, r63524.

    Props westonruter, marian1.
    See #65817.

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


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

diff --git a/wp-includes/class-wp-block-styles-registry.php b/wp-includes/class-wp-block-styles-registry.php
index 46ebc0c5a3..0afb410970 100644
--- a/wp-includes/class-wp-block-styles-registry.php
+++ b/wp-includes/class-wp-block-styles-registry.php
@@ -10,7 +10,23 @@
 /**
  * Class used for interacting with block styles.
  *
+ * The properties of a block style as the registry stores them are more than its register() hash
+ * accepts: `name` is required for a style to be registered at all, and `label` is filled in from
+ * the name when the caller omits it, so both are always present on the way back out. The shape
+ * stays open because the array is stored verbatim, so a caller's own keys survive, including
+ * into the REST response, which does not set `additionalProperties` to false.
+ *
  * @since 5.3.0
+ *
+ * @phpstan-type Block_Style_Properties array{
+ *     name: string,
+ *     label: string,
+ *     inline_style?: string,
+ *     style_handle?: string,
+ *     is_default?: bool,
+ *     style_data?: array<string, mixed>,
+ *     ...
+ * }
  */
 #[AllowDynamicProperties]
 final class WP_Block_Styles_Registry {
diff --git a/wp-includes/class-wp-hook.php b/wp-includes/class-wp-hook.php
index 9a4d4a2c5e..e1ead15a8d 100644
--- a/wp-includes/class-wp-hook.php
+++ b/wp-includes/class-wp-hook.php
@@ -201,7 +201,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
 	 *                                         a callback that may or may not exist.
 	 * @param int                   $priority  The exact priority used when adding the original filter callback.
 	 * @return bool Whether the callback existed before it was removed.
-	 * @phpstan-param Maybe_Callable $callback
+	 * @phpstan-param callable|string|array{0: string|object, 1: string} $callback
 	 */
 	public function remove_filter( $hook_name, $callback, $priority ) {
 		if ( null === $priority ) {
@@ -249,7 +249,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
 	 *                  of that hook is returned, or false if the function is not attached.
 	 *                  If `$callback` and `$priority` are both provided, a boolean is returned
 	 *                  for whether the specific function is registered at that priority.
-	 * @phpstan-param Maybe_Callable|false $callback
+	 * @phpstan-param callable|string|array{0: string|object, 1: string}|false $callback
 	 * @phpstan-return (
 	 *     $callback is false
 	 *         ? bool
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index a3e9afacdb..f09f6c264d 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -284,7 +284,7 @@ function apply_filters_ref_array( $hook_name, $args ) {
  *                  of that hook is returned, or false if the function is not attached.
  *                  If `$callback` and `$priority` are both provided, a boolean is returned
  *                  for whether the specific function is registered at that priority.
- * @phpstan-param Maybe_Callable|false $callback
+ * @phpstan-param callable|string|array{0: string|object, 1: string}|false $callback
  * @phpstan-return (
  *     $callback is false
  *         ? bool
@@ -324,7 +324,7 @@ function has_filter( $hook_name, $callback = false, $priority = false ) {
  * @param int                   $priority  Optional. The exact priority used when adding the original
  *                                         filter callback. Default 10.
  * @return bool Whether the function existed before it was removed.
- * @phpstan-param Maybe_Callable $callback
+ * @phpstan-param callable|string|array{0: string|object, 1: string} $callback
  */
 function remove_filter( $hook_name, $callback, $priority = 10 ) {
 	global $wp_filter;
@@ -606,7 +606,7 @@ function do_action_ref_array( $hook_name, $args ) {
  *                  of that hook is returned, or false if the function is not attached.
  *                  If `$callback` and `$priority` are both provided, a boolean is returned
  *                  for whether the specific function is registered at that priority.
- * @phpstan-param Maybe_Callable|false $callback
+ * @phpstan-param callable|string|array{0: string|object, 1: string}|false $callback
  * @phpstan-return (
  *     $callback is false
  *         ? bool
@@ -638,7 +638,7 @@ function has_action( $hook_name, $callback = false, $priority = false ) {
  * @param int                   $priority  Optional. The exact priority used when adding the original
  *                                         action callback. Default 10.
  * @return bool Whether the function is removed.
- * @phpstan-param Maybe_Callable $callback
+ * @phpstan-param callable|string|array{0: string|object, 1: string} $callback
  */
 function remove_action( $hook_name, $callback, $priority = 10 ) {
 	return remove_filter( $hook_name, $callback, $priority );
@@ -1019,7 +1019,7 @@ function _wp_call_all_hook( $args ) {
  * @param int                   $priority  Unused. The order in which the functions
  *                                         associated with a particular action are executed.
  * @return string|null Unique function ID for usage as array key, or null if it couldn't be determined.
- * @phpstan-param Maybe_Callable $callback
+ * @phpstan-param callable|string|array{0: string|object, 1: string} $callback
  * @phpstan-return non-decimal-int-string|null
  */
 function _wp_filter_build_unique_id( $hook_name, $callback, $priority ): ?string {
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
index fa2dfd10d3..a6b3192f52 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
@@ -13,6 +13,8 @@
  * @since 5.5.0
  *
  * @see WP_REST_Controller
+ *
+ * @phpstan-import-type Block_Style_Properties from WP_Block_Styles_Registry
  */
 class WP_REST_Block_Types_Controller extends WP_REST_Controller {

diff --git a/wp-includes/version.php b/wp-includes/version.php
index 4c997e4ed9..750599a167 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta1-64755';
+$wp_version = '7.2-beta1-64756';

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