|
23 | 23 | * } |
24 | 24 | * @return array List of category objects. |
25 | 25 | * |
26 | | - * @phpstan-return ($args is array{fields: 'count'}&array ? list<numeric-string> : ($args is array{fields: 'names'|'slugs'}&array ? list<string> : ($args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : ($args is array{fields: 'id=>parent'}&array ? array<int, int> : ($args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : array<int, \WP_Term>))))) |
| 26 | + * @phpstan-return ( |
| 27 | + * $args is array{fields: 'count'}&array ? list<numeric-string> : ( |
| 28 | + * $args is array{fields: 'names'|'slugs'}&array ? list<string> : ( |
| 29 | + * $args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : ( |
| 30 | + * $args is array{fields: 'id=>parent'}&array ? array<int, int> : ( |
| 31 | + * $args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : array<int, \WP_Term> |
| 32 | + * ) |
| 33 | + * ) |
| 34 | + * ) |
| 35 | + * ) |
| 36 | + * ) |
27 | 37 | */ |
28 | 38 | function get_categories( $args = '' ) { |
29 | 39 | $defaults = array( 'taxonomy' => 'category' ); |
@@ -92,7 +102,22 @@ function get_categories( $args = '' ) { |
92 | 102 | * WP_Error if $category is empty, null if it does not exist. |
93 | 103 | * |
94 | 104 | * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output |
95 | | - * @phpstan-return ($category is object ? array<array-key, mixed>|\WP_Term : array<array-key, mixed>|\WP_Term|\WP_Error|null) & ($output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : ($output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null)) |
| 105 | + * @phpstan-return ( |
| 106 | + * $category is object ? ( |
| 107 | + * array<array-key, mixed>|\WP_Term |
| 108 | + * ) : ( |
| 109 | + * array<array-key, mixed>|\WP_Term|\WP_Error|null) & ( |
| 110 | + * $output is 'ARRAY_A' ? |
| 111 | + * ( array<string, mixed>|\WP_Error|null ) |
| 112 | + * : ( |
| 113 | + * $output is 'ARRAY_N' ? |
| 114 | + * ( array<int, mixed>|\WP_Error|null) |
| 115 | + * : ( \WP_Term|\WP_Error|null ) |
| 116 | + * ) |
| 117 | + * ) |
| 118 | + * ) |
| 119 | + * ) |
| 120 | + * ) |
96 | 121 | */ |
97 | 122 | function get_category( $category, $output = OBJECT, $filter = 'raw' ) { |
98 | 123 | $category = get_term( $category, 'category', $output, $filter ); |
@@ -130,7 +155,11 @@ function get_category( $category, $output = OBJECT, $filter = 'raw' ) { |
130 | 155 | * Returns null if it does not exist. |
131 | 156 | * |
132 | 157 | * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output |
133 | | - * @phpstan-return ($output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : ($output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null)) |
| 158 | + * @phpstan-return ( |
| 159 | + * $output is 'ARRAY_A' ? (array<string, mixed>|\WP_Error|null) : ( |
| 160 | + * $output is 'ARRAY_N' ? (array<int, mixed>|\WP_Error|null) : (\WP_Term|\WP_Error|null) |
| 161 | + * ) |
| 162 | + * ) |
134 | 163 | */ |
135 | 164 | function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) { |
136 | 165 | $category_path = rawurlencode( urldecode( $category_path ) ); |
@@ -306,7 +335,17 @@ function sanitize_category_field( $field, $value, $cat_id, $context ) { |
306 | 335 | * @return WP_Term[]|int|WP_Error Array of 'post_tag' term objects, a count thereof, |
307 | 336 | * or WP_Error if any of the taxonomies do not exist. |
308 | 337 | * |
309 | | - * @phpstan-return ($args is array{fields: 'count'}&array ? numeric-string : ($args is array{fields: 'names'|'slugs'}&array ? list<string> : ($args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : ($args is array{fields: 'id=>parent'}&array ? array<int, int> : ($args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : array<int, \WP_Term>)))))|\WP_Error |
| 338 | + * @phpstan-return ( |
| 339 | + * $args is array{fields: 'count'}&array ? numeric-string : ( |
| 340 | + * $args is array{fields: 'names'|'slugs'}&array ? list<string> : ( |
| 341 | + * $args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : ( |
| 342 | + * $args is array{fields: 'id=>parent'}&array ? array<int, int> : ( |
| 343 | + * $args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : array<int, \WP_Term> |
| 344 | + * ) |
| 345 | + * ) |
| 346 | + * ) |
| 347 | + * ) |
| 348 | + * ) |\WP_Error |
310 | 349 | */ |
311 | 350 | function get_tags( $args = '' ) { |
312 | 351 | $defaults = array( 'taxonomy' => 'post_tag' ); |
|
0 commit comments