Skip to content

Commit 8733400

Browse files
committedSep 23, 2024··
fix: Fixed callbacks for PHP 8
1 parent 4376fd9 commit 8733400

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎Term.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static function parse_format_args( array $args ): array {
7575
*/
7676
private static function get_name_formatter( array $args ): Closure {
7777
if ( \is_callable( $args['formatter'] ?? null ) ) {
78-
return $args['formatter'];
78+
return static fn( $t ) => $args['formatter']( $t );
7979
}
8080

8181
$formatter ??= $args['link_items'] && $args['link_format']
@@ -101,10 +101,10 @@ private static function get_name_formatter( array $args ): Closure {
101101
*/
102102
private static function get_link_formatter( string|callable|array|bool $fmt ): ?Closure {
103103
return match ( true ) {
104-
\is_bool( $fmt ) && $fmt => 'get_term_link',
105-
\is_callable( $fmt ) => $fmt,
104+
\is_bool( $fmt ) && $fmt => static fn( $t ) => \get_term_link( $t ),
106105
\is_array( $fmt ) => static fn( $t ) => \call_user_func( $fmt, $t ),
107106
\is_string( $fmt ) => static fn( $t ) => \add_query_arg( $t->taxonomy, $t->slug, $fmt ),
107+
\is_callable( $fmt ) => static fn( $t ) => $fmt( $t ),
108108
default => null,
109109
};
110110
}

0 commit comments

Comments
 (0)
Please sign in to comment.