WordPress PHPStorm coding standards

May 24th, 2012 by Richy B. Leave a reply »

I’m a regular user of JetBrains PhpStorm coding package and recently I’ve been doing a bit of WordPress orientated work – so how can I ensure my code matches the WordPress coding standards? Well, using Rarst’s WordPress coding standards helps.

  1. Just download the file and save it as “WordPress.xml” into your Php Storm folder such as .WebIde40/config/codestyles (on Linux, this was /home/[username]/.WebIde40/config/codestyles : I did have to show hidden files in Nautilus: on Windows it’ll be something like C:\Users\[username]\.WebIde40\config\codestyles\ ). To find your configuration file easily, run the following commands:
    • Linux: cd ~/.WebIde40/config/codestyles
    • Mac OS X: cd ~/Library/Preferences/WebIde40/codestyles
    • Windows: cd c:/Users/USERNAME/.WebIde40/config/codestyles
  2. Restart PhpStorm
  3. Load your project and go to “File -> Settings”
  4. Select “Project Settings -> Code Style”
  5. Select “Scheme: WordPress” and OK
  6. Select “Code -> Reformat code…” and wait for your code to be reformatted

This won’t catch every item (such as the Yoda conditions), but it’ll at least make it a bit closer.

This post is over 6 months old.

This means that, despite my best intentions, it may no longer be accurate.

This blog holds over 12 years of archived content - during that time, I may have changed my opinion of something, technology will have advanced (and old "best standards" may no longer be the case), my technology "know how" has improved etc etc - it would probably take me a considerable amount of time to update all the archival entries: and defeat the point of keeping them anyway.

Please take these posts for what they are: a brief look into my past, my history, my journey and "caveat emptor".

Leave a Reply

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


gamy-dance