From 048634230cf537452aac8c6abb144082189ac1e0 Mon Sep 17 00:00:00 2001 From: Marian <42134098+IanDelMar@users.noreply.github.com> Date: Tue, 28 Jul 2026 06:31:02 +0200 Subject: [PATCH] WP_Comments_List_Table::floated_admin_avatar: narrow return type --- functionMap.php | 1 + tests/data/return/wp-comments-list-table.php | 15 +++++++++++++++ wordpress-stubs.php | 1 + 3 files changed, 17 insertions(+) create mode 100644 tests/data/return/wp-comments-list-table.php diff --git a/functionMap.php b/functionMap.php index 07b36751..cbf3287c 100644 --- a/functionMap.php +++ b/functionMap.php @@ -364,6 +364,7 @@ 'WP_Block_List::offsetGet' => ['\WP_Block|null', 'offset' => 'int'], 'WP_Block_List::offsetSet' => ['void', 'offset' => 'int|null'], 'WP_Block_List::offsetUnset' => ['void', 'offset' => 'int'], + 'WP_Comments_List_Table::floated_admin_avatar' => ['non-falsy-string'], 'WP_Object_Cache::delete' => [null, 'deprecated' => 'false'], 'WP_Dependencies::$groups' => [null, '@phpstan-var' => 'array'], 'WP_Dependencies::get_etag' => ['non-falsy-string'], diff --git a/tests/data/return/wp-comments-list-table.php b/tests/data/return/wp-comments-list-table.php new file mode 100644 index 00000000..9a53b8d8 --- /dev/null +++ b/tests/data/return/wp-comments-list-table.php @@ -0,0 +1,15 @@ +floated_admin_avatar('', 0)); +assertType('non-falsy-string', $commentsListTable->floated_admin_avatar('name', 123)); +assertType('non-falsy-string', $commentsListTable->floated_admin_avatar(Faker::string(), Faker::int())); diff --git a/wordpress-stubs.php b/wordpress-stubs.php index 151441f4..4a215dfe 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -4481,6 +4481,7 @@ public function __construct($args = array()) * @param string $name Comment author name. * @param int $comment_id Comment ID. * @return string Avatar with the user name. + * @phpstan-return non-falsy-string */ public function floated_admin_avatar($name, $comment_id) {