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
2 changes: 1 addition & 1 deletion functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
'get_post_stati' => ["(\$output is 'names' ? array<string, string> : array<string, \stdClass>)"],
'get_comment' => ["(\$comment is \WP_Comment ? array<array-key, mixed>|\WP_Comment : array<array-key, mixed>|\WP_Comment|null) & (\$output is 'ARRAY_A' ? array<string, mixed>|null : (\$output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Comment|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'"],
'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_term_by' => ["(\$output is 'ARRAY_A' ? array<string, string|int>|\WP_Error|false : (\$output is 'ARRAY_N' ? list<string|int>|\WP_Error|false : \WP_Term|\WP_Error|false))"],
'get_term_by' => ["false|(\$output is 'ARRAY_A' ? array<string, string|int> : (\$output is 'ARRAY_N' ? list<string|int> : \WP_Term))"],
'get_page_by_path' => ["(\$output is 'ARRAY_A' ? array<string, mixed>|null : (\$output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Post|null))"],
'get_term' => ["(\$output is 'ARRAY_A' ? array<string, string|int>|\WP_Error|null : (\$output is 'ARRAY_N' ? list<string|int>|\WP_Error|null : \WP_Term|\WP_Error|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'"],
'has_action' => ['($callback is false ? bool : false|int)'],
Expand Down
8 changes: 4 additions & 4 deletions tests/data/get_term_by.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use function get_term_by;
use function PHPStan\Testing\assertType;

assertType('WP_Error|WP_Term|false', get_term_by('term_id', 2, '', OBJECT));
assertType('WP_Error|WP_Term|false', get_term_by('slug', 'test'));
assertType('array<string, int|string>|WP_Error|false', get_term_by('term_id', 2, '', ARRAY_A));
assertType('list<int|string>|WP_Error|false', get_term_by('term_id', 2, '', ARRAY_N));
assertType('WP_Term|false', get_term_by('term_id', Faker::int(), '', OBJECT));
assertType('WP_Term|false', get_term_by('slug', 'test'));
assertType('array<string, int|string>|false', get_term_by('term_id', Faker::int(), '', ARRAY_A));
assertType('list<int|string>|false', get_term_by('term_id', Faker::int(), '', ARRAY_N));
2 changes: 1 addition & 1 deletion wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -138433,7 +138433,7 @@ function get_term($term, $taxonomy = '', $output = \OBJECT, $filter = 'raw')
* @param string $filter Optional. How to sanitize term fields. Default 'raw'.
* @return WP_Term|array|false WP_Term instance (or array) on success, depending on the `$output` value.
* False if `$taxonomy` does not exist or `$term` was not found.
* @phpstan-return ($output is 'ARRAY_A' ? array<string, string|int>|\WP_Error|false : ($output is 'ARRAY_N' ? list<string|int>|\WP_Error|false : \WP_Term|\WP_Error|false))
* @phpstan-return false|($output is 'ARRAY_A' ? array<string, string|int> : ($output is 'ARRAY_N' ? list<string|int> : \WP_Term))
*/
function get_term_by($field, $value, $taxonomy = '', $output = \OBJECT, $filter = 'raw')
{
Expand Down