Skip to content

Commit aa2265f

Browse files
authored
Narrow return type of do_meta_boxes() (#403)
1 parent f750c20 commit aa2265f

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

functionMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'do_action' => ['void', 'hook_name' => 'non-empty-string'],
7575
'do_action_ref_array' => ['void', 'hook_name' => 'non-empty-string'],
7676
'do_action_deprecated' => ['void', 'hook_name' => 'non-empty-string'],
77+
'do_meta_boxes' => ['int<0, max>'],
7778
'edit_link' => ['int<0, max>'],
7879
'edit_term_link' => ['($display is true ? void : string|void)'],
7980
'get_approved_comments' => ["(\$args is array{count: true}&array ? int : (\$args is array{fields: 'ids'}&array ? array<int, int> : array<int, \WP_Comment>))"],
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpStubs\WordPress\Core\Tests;
6+
7+
use function do_meta_boxes;
8+
use function PHPStan\Testing\assertType;
9+
10+
assertType('int<0, max>', do_meta_boxes(Faker::string(), Faker::string(), Faker::mixed()));

wordpress-stubs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89985,6 +89985,7 @@ function _get_plugin_from_callback($callback)
8998589985
* Often this is the object that's the focus of the current screen,
8998689986
* for example a `WP_Post` or `WP_Comment` object.
8998789987
* @return int Number of meta_boxes.
89988+
* @phpstan-return int<0, max>
8998889989
*/
8998989990
function do_meta_boxes($screen, $context, $data_object)
8999089991
{

0 commit comments

Comments
 (0)