Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#35915 closed defect (bug) (fixed)

Documentation of `get_preview_post_link` declares missing return variable type information

Reported by: chris_dev's profile chris_dev Owned by: drewapicture's profile DrewAPicture
Milestone: 4.6 Priority: normal
Severity: trivial Version: 4.4
Component: General Keywords: has-patch has-unit-tests
Focuses: docs Cc:

Description

Super simple, but I just noticed that the inline documentation for the get_preview_post_link says it returns string but actually it returns void as well.

Trivial patch attached.

Attachments (3)

35915.patch (804 bytes) - added by chris_dev 9 years ago.
35915.1.patch (955 bytes) - added by chris_dev 9 years ago.
@swissspidy Hi, I attached another patch file. Is it what you meant ?
35915.diff (3.5 KB) - added by swissspidy 9 years ago.

Download all attachments as: .zip

Change History (12)

@chris_dev
9 years ago

#1 @chris_dev
9 years ago

  • Severity changed from normal to trivial

#2 @swissspidy
9 years ago

  • Keywords needs-patch added

It needs to be documented in which cases it returns void.

Though I think it's weird it doesn't return an empty string or false. Perhaps changing that is the better solution.

@chris_dev
9 years ago

@swissspidy Hi, I attached another patch file. Is it what you meant ?

#3 @swissspidy
9 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Version changed from trunk to 4.4

@swissspidy
9 years ago

#4 @swissspidy
9 years ago

  • Keywords has-patch has-unit-tests added; needs-patch removed
  • Milestone changed from 4.5 to Future Release

@chris_dev Yes, that's what I meant. Thanks for the refreshed patch!

I added some unit tests in 35915.diff and changed the return value to null because that's what a void function returns in PHP.

#5 @swissspidy
9 years ago

  • Milestone changed from Future Release to 4.6

#6 @DrewAPicture
9 years ago

  • Keywords needs-refresh added

35915.diff needs a refresh.

#7 @DrewAPicture
9 years ago

In 37564:

Docs: Update the return description for get_preview_post_link() to note that it can also return null.

Props chris_dev, swissspidy.
See #35915.

#8 @DrewAPicture
9 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 37566:

Posts: Add test coverage for get_preview_post_link().

Props swissspidy.
Fixes #35915.

#9 @DrewAPicture
9 years ago

  • Keywords needs-refresh removed
Note: See TracTickets for help on using tickets.