diff --git a/functionMap.php b/functionMap.php index a666bcc..0a461ef 100644 --- a/functionMap.php +++ b/functionMap.php @@ -86,6 +86,7 @@ 'get_password_reset_key' => [null, '@phpstan-impure' => ''], 'get_permalink' => ['($post is \WP_Post ? string : string|false)'], 'get_post' => ["(\$post is \WP_Post ? array|\WP_Post : array|\WP_Post|null) & (\$output is 'ARRAY_A' ? array|null : (\$output is 'ARRAY_N' ? array|null : \WP_Post|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'" ], + 'get_post_ancestors' => ['list'], 'get_post_permalink' => ['($post is \WP_Post ? string : string|false)'], 'get_post_stati' => ["(\$output is 'names' ? array : array)"], 'get_post_types' => ["(\$output is 'names' ? array : array)"], diff --git a/tests/data/return/get-post-ancestors.php b/tests/data/return/get-post-ancestors.php new file mode 100644 index 0000000..432d0fc --- /dev/null +++ b/tests/data/return/get-post-ancestors.php @@ -0,0 +1,12 @@ +', get_post_ancestors(123)); +assertType('list', get_post_ancestors(Faker::int())); +assertType('list', get_post_ancestors(Faker::wpPost())); diff --git a/wordpress-stubs.php b/wordpress-stubs.php index bd0900b..a27c9d2 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -131144,6 +131144,7 @@ function get_post($post = \null, $output = \OBJECT, $filter = 'raw') * * @param int|WP_Post $post Post ID or post object. * @return int[] Array of ancestor IDs or empty array if there are none. + * @phpstan-return list */ function get_post_ancestors($post) {