At the TYPO3 developer days the core team members decided to drop the TYPO3 specific coding guidelines and to switch to the PSR-2 standard. This change was done in the night from Oct. 08 to 09 using a single huge commit. Read on for the complete story how to adapt your personal dev environment.
If you wonder what’s all the hype is about: It is about the coding guidelines that TYPO3 uses. Until now it was a custom set of rules that have to be applied to the source code of TYPO3 core patches.
This custom set for  The php code part of the coding guidelines were now replaced by the PSR-2 standard that many other php projects accept also as their coding standard. The main benefit is, that switching and interoperability will be much easier than it was until now.
If you would like to know more about the standard, you can head on to PHP Framework Interop Group to the PSR-2 section: http://www.php-fig.org/psr/psr-2/ . This link covers all the details about the standard.
A standard is only on thing. The other thing is implementing it manually is very, very annoying and error prone. For your convenience and many other TYPO3 developers I collected some sources how you can adapt quickly your tools settings to this standard. If your favorite tool is missing, please do not hesitate to contact me. I will update this post, whenever necessary.
Adapt existing code
One of the major issues will be to adapt existing code to the new coding standard. TYPO3 Core was changed automatically, but all third party extensions should take the move too. Even if you do not like the switch personally, you should take it. The switch between contributing to TYPO3 core or your extension will be much easier for most people, because they do not have to remember two code styles.
A really great tool is the composer package of sensiolabs.org. This package makes you transform your code in some simple steps. It was also used to convert the TYPO3 source core.
You find the composer package and detailed instruction on http://cs.sensiolabs.org/
IDE and Editor configurations
In real live you would really like that your favorite editor supports you by applying the PSR-2 conventions. I collected some sources of main editors that are used for php editing by searching the web, but did not verify or test each of them. If you have any recommendations, I will be very happy to update this blog post.
phpStorm has a built-in support for the PSR-2 standard. The attached screenshot is more or less self explanatory. There you see how to set the PSR-2 compatible settings in phpStorm.
Further more Jetbrains, the publisher of phpStorm, wrote an article how to enhance the PSR-2 support in their IDE: http://blog.jetbrains.com/webide/2012/11/more-php-formatting-options-and-bundled-code-styles-for-ps/
Eclipse has a built-in PSR-2 support. It is part of the PDT tools collection. The feature list mentions it in this overview . Rantan Parai wrote a nice article how to configure it correctly: https://ratanparai.wordpress.com/2014/10/16/prepare-eclipse-for-php-psr-standard/
For Netbeans there is an article by Bobby Allen from Ipswich, which describes how to configure Netbeans for PSR-2. In early 2015 he turned his findings and experiences into a Netbeans module.
A little bit older is this project of Maniaplant on github: http://maniaplanet.github.io/netbeans-psr/
More Support for many more Editors
There are many, many more editors around which are capable to support your coding for TYPO3. Some findings I listed in this section. If I missed something or you would like to have your editor mentioned here, with a link to a howto in order to be PSR-2 compatible, don’t hesitate to leave a comment. I will add it to this section later on.
There is an initative that tries to establish common configurations among many editors and IDEs. TYPO3 supports this in providing an .editorconfig file. It was already adapted to the new standard. For more details and whether your editor supports the standard, please refer to http://editorconfig.org/ Editors which support editorconfig natively or support it by installing a plugin are listed in this section: http://editorconfig.org/#download
codeLite has a built in support. Details are here: https://github.com/eranif/codelite/issues/817
 Thanks to Markus Klein for the correction
If you like my posts, please help promoting them. For sharing via Twitter, Facebook, XING, Linked In & co you can use easily the buttons below. To be informed right after publishing a new article, you are welcome to subscribe to the RSS feed of this blog. Thank you.