WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 9 months ago

#44840 closed enhancement (fixed)

Don't assign to a variable inside if statement in get_post_format()

Reported by: Mirucon Owned by: SergeyBiryukov
Milestone: 5.1 Priority: normal
Severity: minor Version:
Component: Post Formats Keywords: has-patch needs-testing commit
Focuses: coding-standards Cc:

Description

Currently in the get_post_format() function, there's variable assign inside if statement. It is not a really good practice since assigning to a variable inside could confuse people as it looks like a mistake of the comparison operator. This patch will assign to a new variable just before the line of if().

Attachments (1)

44840.patch (440 bytes) - added by Mirucon 10 months ago.

Download all attachments as: .zip

Change History (6)

@Mirucon
10 months ago

#1 @mukesh27
10 months ago

  • Component changed from General to Post Formats
  • Focuses coding-standards added
  • Keywords needs-testing added

#2 @SergeyBiryukov
10 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.0

#3 @SergeyBiryukov
10 months ago

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

In 43592:

Post Formats: Don't assign a variable inside if statement in get_post_format().

Props Mirucon.
Fixes #44840.

#4 @johnbillion
9 months ago

  • Milestone changed from 5.0 to 5.1

#5 @johnbillion
9 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.