Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#41234 closed defect (bug) (fixed)

Fix two blatant code typos

Reported by: jrf's profile jrf Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.9
Component: General Keywords: has-patch commit
Focuses: Cc:


case and default statements used in a switch control structure should be followed by a : colon.

While working on an issue in the WordPress Coding Standards, I came across two typos which need to be fixed. Both use a ; semi-colon instead of a colon.

Attachments (1)

fix-two-typos-in-switch-statements.patch (1.1 KB) - added by jrf 6 years ago.

Download all attachments as: .zip

Change History (6)

#1 @adamsilverstein
6 years ago

Hi @jrf those might be fixed for consistency sake though semicolons are strangely allowed in switch statements:

#2 @jrf
6 years ago

@adamsilverstein Good point, but yes, consistency would definitely win out here. These are the stats I just generated for core in that respect:

Default/case statement followed by colon:
        yes [3325/3327, 99.94%]
        no => 2 (0.06%)

#3 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 4.9

#4 @netweb
6 years ago

  • Keywords has-patch commit added

#5 @SergeyBiryukov
6 years ago

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

In 40997:

General: Always use colon instead of a semicolon in switch() control structures.

Props jrf.
Fixes #41234.

Note: See TracTickets for help on using tickets.