How to add custom li item to wordpress menu

Default usage of add_filter looks like this:

add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

As you can see, the default priority is 10 and by default only one param is passed.

In your code you need your filter to get 2 params, because wp_nav_menu_items takes 2 params ($items and $args) and you need both of them in your filter. So you have to pass 2 as number of params, when you add your filter:

function add_new_item_to_menu( $items, $args ) {
    if ( 'header-menu' == $args->theme_location ) {
        $items .= '<li><a>Show whatever</a></li>';
    }
    return $items;
}
add_filter( 'wp_nav_menu_items', 'add_new_item_to_menu', 10, 2 );