#44455 closed defect (bug) (invalid)
PHP Doc for non-existing argument + Argument type mismatch
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.1 |
| Component: | Users | Keywords: | close |
| Focuses: | docs, coding-standards | Cc: |
Description
File name:/wp-includes/capabilities.php
Non-existing arguments in Doc comments:
function map_meta_cap( $cap, $user_id ) {
...
}
function current_user_can( $capability ) {
...
}
Argument type mismatch:
function is_super_admin( $user_id = false ) {
...
}
Uploading a proposed patch.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Attention!
map_meta_cap()andcurrent_user_can()do have this second parameter. For various reasons, these aren't in the function signature but instead accessed viafunc_get_args()Regarding the
is_super_admin()change: your change would indicate that one can passtrueorfalseto the function and expect it to work. However, that is not the case. Think of it as$user_id = null, wherenull(or in this case,false) is the default value. If we were to change this, it should be discussed & decided in the docs team first, and standardized in https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/. However, personally I'd rather change it to$user_id = nullinstead of adjusting the docs. But for BC reasons that's probably not possible in every case.