From c1b46539f8064c35d381dea451942d458f91c253 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Feb 2026 14:09:06 -0800 Subject: [PATCH 1/7] Fix return types for core themes --- .../themes/twentyfourteen/inc/featured-content.php | 2 +- src/wp-content/themes/twentytwenty/inc/template-tags.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-content/themes/twentyfourteen/inc/featured-content.php b/src/wp-content/themes/twentyfourteen/inc/featured-content.php index b98ab983919df..3193aa8b93549 100644 --- a/src/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/src/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -212,7 +212,7 @@ public static function delete_transient() { * @since Twenty Fourteen 1.0 * * @param WP_Query $query WP_Query object. - * @return WP_Query Possibly-modified WP_Query. + * @return void */ public static function pre_get_posts( $query ) { diff --git a/src/wp-content/themes/twentytwenty/inc/template-tags.php b/src/wp-content/themes/twentytwenty/inc/template-tags.php index fdf51ccee9624..e15ae6652bbec 100644 --- a/src/wp-content/themes/twentytwenty/inc/template-tags.php +++ b/src/wp-content/themes/twentytwenty/inc/template-tags.php @@ -29,7 +29,7 @@ * * @param array $args Arguments for displaying the site logo either as an image or text. * @param bool $display Display or return the HTML. - * @return string Compiled HTML based on our arguments. + * @return string|void Compiled HTML based on our arguments. */ function twentytwenty_site_logo( $args = array(), $display = true ) { $logo = get_custom_logo(); @@ -107,7 +107,7 @@ function twentytwenty_site_logo( $args = array(), $display = true ) { * @since Twenty Twenty 1.0 * * @param bool $display Display or return the HTML. - * @return string The HTML to display. + * @return string|void The HTML to display. */ function twentytwenty_site_description( $display = true ) { $description = get_bloginfo( 'description' ); @@ -249,7 +249,7 @@ function twentytwenty_edit_post_link( $link, $post_id, $text ) { * * @param int $post_id The ID of the post. * @param string $location The location where the meta is shown. - * @return string Post meta HTML. + * @return string|void Post meta HTML. */ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) { From 417f2579e2d351aea1f1a131b9ba7fba7a731ff2 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Feb 2026 14:32:34 -0800 Subject: [PATCH 2/7] Add variable return type for WP_Theme::get() --- .../classes/class-twenty-twenty-one-customize.php | 4 ++-- .../classes/class-twenty-twenty-one-dark-mode.php | 2 +- src/wp-includes/class-wp-theme.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php index 53db8dffb216f..9a2436af1e901 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php @@ -35,8 +35,8 @@ public function __construct() { public function register( $wp_customize ) { // Change site-title & description to postMessage. - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists. - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists. + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; // @phpstan-ignore property.nonObject (Assume that this setting exists.) + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore property.nonObject (Assume that this setting exists.) // Add partial for blogname. $wp_customize->selective_refresh->add_partial( diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php index d5672c4054f3c..6644e7d02eeab 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php @@ -98,7 +98,7 @@ public function enqueue_scripts() { if ( is_rtl() ) { $url = get_template_directory_uri() . '/assets/css/style-dark-mode-rtl.css'; } - wp_enqueue_style( 'tt1-dark-mode', $url, array( 'twenty-twenty-one-style' ), wp_get_theme()->get( 'Version' ) ); // @phpstan-ignore-line. Version is always a string. + wp_enqueue_style( 'tt1-dark-mode', $url, array( 'twenty-twenty-one-style' ), wp_get_theme()->get( 'Version' ) ); } /** diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index c894f6dd72f40..0f3271f28a7dd 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -864,6 +864,8 @@ public function cache_delete() { * * @since 3.4.0 * + * @phpstan-return ( $header is 'Tags' ? string[]|false : ( $header is 'Name'|'ThemeURI'|'Description'|'Author'|'AuthorURI'|'Version'|'Template'|'Status'|'TextDomain'|'DomainPath'|'RequiresWP'|'RequiresPHP'|'UpdateURI' ? string|false : mixed ) ) + * * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. * @return string|array|false String or array (for Tags header) on success, false on failure. */ From 2edcfeba820234fc7da189843592db6aa461aacc Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Feb 2026 14:33:25 -0800 Subject: [PATCH 3/7] Ensure Customizer setting exists before setting transport to postMessage --- .../classes/class-twenty-twenty-one-customize.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php index 9a2436af1e901..d4bc16e20171d 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php @@ -35,8 +35,12 @@ public function __construct() { public function register( $wp_customize ) { // Change site-title & description to postMessage. - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; // @phpstan-ignore property.nonObject (Assume that this setting exists.) - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore property.nonObject (Assume that this setting exists.) + foreach ( array( 'blogname', 'blogdescription' ) as $setting_id ) { + $setting = $wp_customize->get_setting( $setting_id ); + if ( $setting ) { + $setting->transport = 'postMessage'; + } + } // Add partial for blogname. $wp_customize->selective_refresh->add_partial( From fe5cc0f6632fca9b6e5d4b9daa0234c94c502b7a Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Feb 2026 14:34:21 -0800 Subject: [PATCH 4/7] Pass empty strings instead of null in twenty_twenty_one_generate_css() --- .../themes/twentytwentyone/inc/template-functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/inc/template-functions.php b/src/wp-content/themes/twentytwentyone/inc/template-functions.php index 7639331c37286..529564c295319 100644 --- a/src/wp-content/themes/twentytwentyone/inc/template-functions.php +++ b/src/wp-content/themes/twentytwentyone/inc/template-functions.php @@ -339,12 +339,12 @@ function twenty_twenty_one_get_non_latin_css( $type = 'front-end' ) { } // Return the specified styles. - return twenty_twenty_one_generate_css( // @phpstan-ignore-line. + return twenty_twenty_one_generate_css( implode( ',', $elements[ $type ] ), 'font-family', implode( ',', $font_family[ $locale ] ), - null, - null, + '', + '', false ); } From 3d0b3e98bcdb3a5fcd32e18ae6461d4c2b075417 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Feb 2026 14:35:19 -0800 Subject: [PATCH 5/7] Ensure Twenty_Twenty_One_SVG_Icons::get_svg() always returns string via cast --- .../classes/class-twenty-twenty-one-svg-icons.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php index 398ef82bbd7c8..e32d050b4e455 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php @@ -189,10 +189,9 @@ public static function get_svg( $group, $icon, $size ) { if ( array_key_exists( $icon, $arr ) ) { $repl = sprintf( '