diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/others/phpstorm-codestyles/Piwik_codestyle.xml | 152 | ||||
-rw-r--r-- | misc/others/phpstorm-codestyles/README.md | 18 |
2 files changed, 170 insertions, 0 deletions
diff --git a/misc/others/phpstorm-codestyles/Piwik_codestyle.xml b/misc/others/phpstorm-codestyles/Piwik_codestyle.xml new file mode 100644 index 0000000000..a2d7949a60 --- /dev/null +++ b/misc/others/phpstorm-codestyles/Piwik_codestyle.xml @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8"?> +<code_scheme name="Piwik-codestyle"> + <option name="RIGHT_MARGIN" value="160" /> + <PHPCodeStyleSettings> + <option name="ALIGN_KEY_VALUE_PAIRS" value="true" /> + <option name="LOWER_CASE_BOOLEAN_CONST" value="true" /> + <option name="LOWER_CASE_NULL_CONST" value="true" /> + </PHPCodeStyleSettings> + <XML> + <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> + </XML> + <codeStyleSettings language="JavaScript"> + <option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> + <option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" /> + <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" /> + </codeStyleSettings> + <codeStyleSettings language="PHP"> + <option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" /> + <arrangement> + <rules> + <rule> + <match> + <TYPE>CONST</TYPE> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PUBLIC</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PROTECTED</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PRIVATE</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PUBLIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PROTECTED</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>FIELD</TYPE> + <MODIFIER>PRIVATE</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <TYPE>CONSTRUCTOR</TYPE> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PUBLIC</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PROTECTED</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PRIVATE</MODIFIER> + <MODIFIER>STATIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PUBLIC</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PROTECTED</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <AND> + <TYPE>METHOD</TYPE> + <MODIFIER>PRIVATE</MODIFIER> + </AND> + </match> + </rule> + <rule> + <match> + <TYPE>TRAIT</TYPE> + </match> + </rule> + <rule> + <match> + <TYPE>INTERFACE</TYPE> + </match> + </rule> + <rule> + <match> + <TYPE>CLASS</TYPE> + </match> + </rule> + </rules> + </arrangement> + </codeStyleSettings> +</code_scheme> + diff --git a/misc/others/phpstorm-codestyles/README.md b/misc/others/phpstorm-codestyles/README.md new file mode 100644 index 0000000000..26d33d80b3 --- /dev/null +++ b/misc/others/phpstorm-codestyles/README.md @@ -0,0 +1,18 @@ +Phpstorm has an awesome feature called "Reformat code" which reformats all PHP code to follow a particular selected coding style. + +Piwik uses PSR coding standard for php source code. We use a slightly customized PSR style +(because the default PSR style in Phpstorm results in some unwanted changes). + +Steps: + * Use latest Phpstorm + * Copy this Piwik_codestyle.xml file in your ~/.WebIde60/config/codestyles/ + * If you use Windows or Mac see which path to copy at: http://intellij-support.jetbrains.com/entries/23358108 + * Restart PhpStorm. + * Select this coding in Settings>Code style. + +Phpstorm can also be configured to apply the style automatically before commit. + +You are now writing code that respects Piwik coding standards. Enjoy! + +Reference: http://piwik.org/participate/coding-standards/ + |