Skip to content
Open
6 changes: 5 additions & 1 deletion src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -4160,6 +4160,7 @@ function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )
* or 'objects' to return an array of taxonomy objects.
* Default is 'names'.
* @return string[]|WP_Taxonomy[] List of taxonomies or taxonomy names. Empty array on failure.
* @phpstan-return ( $output is 'names' ? list<non-falsy-string> : array<non-falsy-string, WP_Taxonomy> )
*/
function get_attachment_taxonomies( $attachment, $output = 'names' ) {
if ( is_int( $attachment ) ) {
Expand Down Expand Up @@ -4204,7 +4205,9 @@ function get_attachment_taxonomies( $attachment, $output = 'names' ) {
}

if ( 'names' === $output ) {
$taxonomies = array_unique( $taxonomies );
/** @var non-falsy-string[] $taxonomies */
$unique_taxonomies = array_values( array_unique( $taxonomies ) );
$taxonomies = $unique_taxonomies;
}

return $taxonomies;
Expand All @@ -4222,6 +4225,7 @@ function get_attachment_taxonomies( $attachment, $output = 'names' ) {
* @param string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'.
* Default 'names'.
* @return string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments.
* @phpstan-return ( $output is 'names' ? list<non-falsy-string> : array<non-falsy-string, WP_Taxonomy> )
*/
function get_taxonomies_for_attachments( $output = 'names' ) {
$taxonomies = array();
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ function get_post_status_object( $post_status ) {
* from the array needs to match; 'and' means all elements must match.
* Default 'and'.
* @return string[]|stdClass[] A list of post status names or objects.
* @phpstan-return ( $output is 'names' ? array<non-falsy-string, non-falsy-string> : array<non-falsy-string, stdClass> )
*/
function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
global $wp_post_statuses;
Expand Down
4 changes: 3 additions & 1 deletion src/wp-includes/taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ function create_initial_taxonomies() {
* one element from the array needs to match; 'and' means all elements must match.
* Default 'and'.
* @return string[]|WP_Taxonomy[] An array of taxonomy names or objects.
* @phpstan-return ( $output is 'names' ? array<non-falsy-string, non-falsy-string> : array<non-falsy-string, WP_Taxonomy> )
*/
function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
global $wp_taxonomies;
Expand All @@ -301,12 +302,13 @@ function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' )
*
* @since 2.3.0
*
* @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies.
* @global array<non-falsy-string, WP_Taxonomy> $wp_taxonomies The registered taxonomies.
*
* @param string|string[]|WP_Post $object_type Name of the type of taxonomy object, or an object (row from posts).
* @param string $output Optional. The type of output to return in the array. Accepts either
* 'names' or 'objects'. Default 'names'.
* @return string[]|WP_Taxonomy[] The names or objects of all taxonomies of `$object_type`.
* @phpstan-return ( $output is 'names' ? list<non-falsy-string> : array<non-falsy-string, WP_Taxonomy> )
*/
function get_object_taxonomies( $object_type, $output = 'names' ) {
global $wp_taxonomies;
Expand Down
Loading