[wp-trac] [WordPress Trac] #54798: Check for int in menu priority

WordPress Trac noreply at wordpress.org
Fri Feb 18 13:41:07 UTC 2022

#54798: Check for int in menu priority
 Reporter:  kirtan95                  |       Owner:  audrasjb
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.0
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:

Comment (by kirtan95):

 @SergeyBiryukov So is it fine to add type check for float values? It will
 at least prevent users from passing float values as strings and plugin
 authors will be easily able to migrate their code in case they're passing
 float as a string.

 If passing a float value is so widely used, perhaps we can even change the
 function docstring of both add_menu_page and add_submenu_page to reflect
 that they accept float values.

 The motive of this PR was to add stricter type checks that would help
 developers spot bugs early during development, so I think the above two
 suggestions will help achieve this goal.

Ticket URL: <https://core.trac.wordpress.org/ticket/54798#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list