WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#41234 closed defect (bug) (fixed)

Fix two blatant code typos

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

Description

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 3 years ago.

Download all attachments as: .zip

Change History (6)

#1 @adamsilverstein
3 years ago

Hi @jrf those might be fixed for consistency sake though semicolons are strangely allowed in switch statements: http://php.net/manual/en/control-structures.switch.php

#2 @jrf
3 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
3 years ago

  • Milestone changed from Awaiting Review to 4.9

#4 @netweb
3 years ago

  • Keywords has-patch commit added

#5 @SergeyBiryukov
3 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.