Skip to content

Instantly share code, notes, and snippets.

@Rarst
Last active February 21, 2023 11:21
Show Gist options
  • Select an option

  • Save Rarst/1370155 to your computer and use it in GitHub Desktop.

Select an option

Save Rarst/1370155 to your computer and use it in GitHub Desktop.
WordPress coding standards configuration for PhpStorm

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)

@andizer

andizer commented Aug 11, 2014

Copy link
Copy Markdown

The file removes the space between ! and function. Seems to be a bug, because the codestyle for wordpress says there has to be a space between them.

See: http://make.wordpress.org/core/handbook/coding-standards/php/#space-usage

@Rarst

Rarst commented Aug 13, 2014

Copy link
Copy Markdown
Author

@andizer

That shoudn't be the case (<option name="SPACE_AROUND_UNARY_OPERATOR" value="true" />). Check your code style settings for changes (Project Settings > Code Style > PHP > Spaces > Around Operators > Unary Operators).

@tacoverdo

Copy link
Copy Markdown

@Rarst It seems that the setting has been moved in the EAP version of PHPStorm that @andizer and I are running.

Checking Project Settings > Code Style > PHP > Spaces > Other > After unary Not (!) solves this issue.

@Rarst

Rarst commented Sep 2, 2014

Copy link
Copy Markdown
Author

EAP should ship with native WP style as far as I know? If it's wrong in that one should probably be reported as bug...

@Rarst

Rarst commented Oct 8, 2014

Copy link
Copy Markdown
Author

Yeah, there seems to be mild upgrade issue with that setting going from 7 to 8, hit it too. :)

@momin-riyadh

Copy link
Copy Markdown

How to auto Complete for wordpress comments and function definition in PhpStorm?

/**
 * The Header template for our theme
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package Hasan_WordPress
 * @subpackage Hasan
 * @since Hasan 1.0
 */

@gaupoit

gaupoit commented Jul 8, 2018

Copy link
Copy Markdown

@momin-ctg you can use /** and press "Enter"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment