Skip to content

Commit

Permalink
fix: PHP Compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Sep 18, 2024
1 parent 2f9ed12 commit 4376fd9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function format_hierarhical_name( WP_Term|int|string|null|array|\W
}

$formatter = self::get_name_formatter( $args );
$formatted = \array_map( \get_term( ... ), \get_ancestors( $term->term_id, $term->taxonomy ) );
$formatted = \array_map( 'get_term', \get_ancestors( $term->term_id, $term->taxonomy ) );
$formatted = \array_map( $formatter, \array_reverse( $formatted ) );
$formatted[] = $args['link_final'] ? $formatter( $term ) : $term->name;

Expand Down Expand Up @@ -75,7 +75,7 @@ private static function parse_format_args( array $args ): array {
*/
private static function get_name_formatter( array $args ): Closure {
if ( \is_callable( $args['formatter'] ?? null ) ) {
return $args['formatter']( ... );
return $args['formatter'];
}

$formatter ??= $args['link_items'] && $args['link_format']
Expand All @@ -101,8 +101,8 @@ private static function get_name_formatter( array $args ): Closure {
*/
private static function get_link_formatter( string|callable|array|bool $fmt ): ?Closure {
return match ( true ) {
\is_bool( $fmt ) && $fmt => \get_term_link( ... ),
\is_callable( $fmt ) => $fmt( ... ),
\is_bool( $fmt ) && $fmt => 'get_term_link',
\is_callable( $fmt ) => $fmt,
\is_array( $fmt ) => static fn( $t ) => \call_user_func( $fmt, $t ),
\is_string( $fmt ) => static fn( $t ) => \add_query_arg( $t->taxonomy, $t->slug, $fmt ),
default => null,
Expand Down

0 comments on commit 4376fd9

Please sign in to comment.