Why isn’t this add_filter function working as expected?

apply_filters( $tag, $value, $param, $otherparam )

This is how the apply_filters function work. By default, the value is printed if no function is hooked with the filter.

It’s not clear what directorist_icon( 'fas fa-chevron-right', false ) prints here. But if it is showing “next” string at the output, the filter is working right.

If you need to print, then echo apply_filters will help.

If this description doesn’t fit your necessity, you can explain what you want to achieve, I hope I can help.