With the upcoming major release, the integer menu slugs will be removed. Users will no longer be able to register nav menus with integer slugs starting WordPress 5.3.
Prior to this, it was possible to register menus with integer slugs. However, it then results in unintended issues that are difficult to debug. For instance:
register_nav_menus( array( ‘primary’ => ‘Primary’, 1 => ‘First’, 2 => ‘Second’, ) );
The assumption is that the resulting list of menus would match what was passed. Instead, the result is:
array( ‘primary’ => ‘Primary’, 0 => ‘First’, 1 => ‘Second’, )
This would cause wp_nav_menu( array( ‘theme_location’ => 1 ) ) to return the wrong menu.
Therefore, fixing the issue, WordPress 5.3 will no longer support Integer Menu Slugs for nav menu registration. Registering menus with Integer Slugs/numeric index in v.5.3 will trigger a warning – _doing_it_wrong().
The core team expects the warning to be informative for developers to know about the issue and encourage them to use string slugs for navigation menus instead of integer slugs.
News Source: WordPress Core