Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#38384 closed defect (bug) (fixed)

Twenty Seventeen: Replace inline control structure in `twentyseventeen_content_image_sizes_attr()`

Reported by: ocean90's profile ocean90 Owned by: davidakennedy's profile davidakennedy
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: good-first-bug has-patch
Focuses: Cc:

Description

See https://github.com/WordPress/twentyseventeen/blob/5b5e4e86c2b8343863d7633758987da93c2bf2e8/functions.php#L317-L323.

To improve code readability the lines 317 and 321 should be changed to a proper if ( ) {} block. Also, per WordPress' coding standards, yoda conditons should only be used for ==, !=, ===, and !==.

Attachments (2)

readability-patch.38384.diff (915 bytes) - added by vrundakansara 7 years ago.
Code readability bug fixed
38384.diff (1.1 KB) - added by aaroncampbell 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ocean90
7 years ago

  • Keywords good-first-bug added

@vrundakansara
7 years ago

Code readability bug fixed

#2 @vrundakansara
7 years ago

  • Keywords has-patch added; needs-patch removed

#3 @ocean90
7 years ago

#38422 was marked as a duplicate.

@aaroncampbell
7 years ago

#4 @aaroncampbell
7 years ago

Sorry, I had missed this. I added the patch from my duplicate ticket. The only difference is that the condition was just added to an existing if for the second replacement.

#5 @davidakennedy
7 years ago

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

In 38847:

Twenty Seventeen: Replace inline control structure to improve code readability

Props vrundakansara, aaroncampbell.

Fixes #38384.

#6 @SergeyBiryukov
7 years ago

Should this also be fixed in Twenty Sixteen? See twentysixteen_content_image_sizes_attr().

Note: See TracTickets for help on using tickets.