Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<array-key, mixed>|\WP_Post : array<array-key, mixed>|\WP_Post|null) & (\$output is 'ARRAY_A' ? array<string, mixed>|null : (\$output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Post|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'" ],
'get_post_ancestors' => ['list<int>'],
'get_post_permalink' => ['($post is \WP_Post ? string : string|false)'],
'get_post_stati' => ["(\$output is 'names' ? array<string, string> : array<string, \stdClass>)"],
'get_post_types' => ["(\$output is 'names' ? array<string, string> : array<string, \WP_Post_Type>)"],
Expand Down
12 changes: 12 additions & 0 deletions tests/data/return/get-post-ancestors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace PhpStubs\WordPress\Core\Tests;

use function get_post_ancestors;
use function PHPStan\Testing\assertType;

assertType('list<int>', get_post_ancestors(123));
assertType('list<int>', get_post_ancestors(Faker::int()));
assertType('list<int>', get_post_ancestors(Faker::wpPost()));
1 change: 1 addition & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>
*/
function get_post_ancestors($post)
{
Expand Down