Adding Nav Filter

Is there any logical reason why this filter suggested in WP docs

add_filter( 'nav_menu_link_attributes', 'cfw_add_data_atts_to_nav', 10, 4 );
    function cfw_add_data_atts_to_nav( $atts, $item, $args ) {

    $atts['data-hover'] = $item->title;
    return $atts;
}

is not working on Sage 9?

This is what i’m getting

Warning
: call_user_func_array() expects parameter 1 to be a valid callback, function 'cfw_add_data_atts_to_nav' not found or invalid function name in
C:\Users\Jorgo\Desktop\wordpress\wp-includes\class-wp-hook.php
on line
298


Warning
: Invalid argument supplied for foreach() in
C:\Users\Jorgo\Desktop\wordpress\wp-includes\class-walker-nav-menu.php
on line
198

I thought this error is due to soil nice walker, but the error still shows up even if I remove support for it.

Any ideas why?

Namespaces, is my guess.

Just use an anonymous function. It’s easier. But if you need to use a named function, then include the namespace.