Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#23118 closed enhancement (fixed)

Remove spaces between parentheses in function calls without arguments

Reported by: evansolomon's profile evansolomon Owned by: westi's profile 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 12 years ago.

Download all attachments as: .zip

Change History (9)

@evansolomon
12 years ago

#1 @evansolomon
12 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
12 years ago

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

#3 follow-ups: @westi
12 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 ;)

#4 in reply to: ↑ 3 ; follow-up: @evansolomon
12 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

#5 @nacin
12 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. :)

#6 @westi
12 years ago

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

In 23265:

Tighten our braces. Fixes #23118 props evansolomon.

#7 in reply to: ↑ 4 @westi
12 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.

#8 in reply to: ↑ 3 @SergeyBiryukov
12 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.