WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#23118 closed enhancement (fixed)

Remove spaces between parentheses in function calls without arguments

Reported by: evansolomon Owned by: westi
Milestone: 3.6 Priority: lowest
Severity: trivial Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

I noticed there were a few spots with weird spaces in function calls. So it would like like foo( ) instead of foo(). It looks weird, so let's kill them off.

Here's what I ran to fix them: ack "\( \)" --ignore-dir=wp-content -l | xargs perl -pi -E 's/\( \)/\(\)/g'

Attachments (1)

23118.diff (9.8 KB) - added by evansolomon 2 years ago.

Download all attachments as: .zip

Change History (9)

@evansolomon2 years ago

comment:1 @evansolomon2 years ago

  • Keywords has-patch added

comment:2 @SergeyBiryukov2 years ago

  • Milestone changed from Awaiting Review to 3.6
  • Priority changed from normal to lowest
  • Type changed from defect (bug) to enhancement

comment:3 follow-ups: @westi2 years ago

  • Owner set to westi
  • Status changed from new to accepted

It could be argued that our coding style recommends the presence of these.

However, I agree that they do look weird - although I make no promises not to accidentally add more of them in future ;)

comment:4 in reply to: ↑ 3 ; follow-up: @evansolomon2 years ago

Replying to westi:

It could be argued that our coding style recommends the presence of these.

I imagine such a coding standard would quickly top the list of least-followed rules in WordPress.

Just for fun...

$ ack "\(\)" --php -h | wc -l
   10637

comment:5 @nacin2 years ago

I like spaces. But I dislike them in two places: inside array brackets when the index is a static string (so, $foo['bar']), and here. Core overwhelmingly agrees. I searched for function definitions ending with () { and found 1290 matches.

Ending with ( ) { — 11.

And six of those were totally westi in default-constants.php. :)

comment:6 @westi2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 23265:

Tighten our braces. Fixes #23118 props evansolomon.

comment:7 in reply to: ↑ 4 @westi2 years ago

Replying to evansolomon:

Replying to westi:

It could be argued that our coding style recommends the presence of these.

I imagine such a coding standard would quickly top the list of least-followed rules in WordPress.

Coding standards are always guides not rules.

comment:8 in reply to: ↑ 3 @SergeyBiryukov2 years ago

Replying to westi:

It could be argued that our coding style recommends the presence of these.

I guess the space usage rule from our coding standards only applies if the function has arguments.

Note: See TracTickets for help on using tickets.