Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#45596 closed defect (bug) (fixed)

Argument type mismatch

Reported by: subrataemfluence's profile subrataemfluence Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.2 Priority: low
Severity: normal Version: 5.0
Component: Users Keywords: has-patch
Focuses: docs, template Cc:

Description

File: wp-includes/author-template-patch.php

Doc blocks of the following functions have incorrect argument type declarations.

the_author( $deprecated = '', $deprecated_echo = true ) { ... }

get_the_author_meta( $field = '', $user_id = false ) { ... }

the_author_meta( $field = '', $user_id = false ) { ... }

Please review attached proposed patch.

Attachments (1)

45596.patch (1.8 KB) - added by subrataemfluence 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @swissspidy
7 years ago

  • Focuses coding-standards removed
  • Priority changed from normal to low

We don't usually add things like string|bool in these cases, because it indicates that one could pass true as well.

Instead, the default value of false means "use current user by default".

So, if anything, I'd change the description to Optional. User ID. Defaults to the current author. or perhaps change the type to string|false to be explicit, or both.

#2 in reply to: ↑ 1 @subrataemfluence
7 years ago

Thank you for explaining :) Please let me know whether I shall modify the patch or close the ticket.

Replying to swissspidy:

We don't usually add things like string|bool in these cases, because it indicates that one could pass true as well.

Instead, the default value of false means "use current user by default".

So, if anything, I'd change the description to Optional. User ID. Defaults to the current author. or perhaps change the type to string|false to be explicit, or both.

#3 @TimothyBlynJacobs
7 years ago

It's possible to document it as string|false. http://docs.phpdoc.org/references/phpdoc/types.html.

#4 @SergeyBiryukov
7 years ago

  • Component changed from General to Users
  • Focuses docs template added
  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @pento
7 years ago

  • Milestone changed from 5.1 to 5.2

#6 @SergeyBiryukov
7 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45086:

Docs: Correct parameter types for the_author(), get_the_author_meta(), and the_author_meta().

Props subrataemfluence.
Fixes #45596.

Note: See TracTickets for help on using tickets.