[WIP] This article describes the settings you should apply to your PHPStorm IDE to avoid common mistakes. While these seem minor at first sight, they ease the work on our QA department and help big time to not let the core decay over time in regards to Code quality and consistency.
TYPO3 uses PSR-2 as Coding Style for PHP. To set that in PHPStorm:
- Open Settings (or Default Settings, if you want to set this for all projects)
- Go to Editor -> Code Style -> PHP
- Click on "Set from..." (Looks like a link on the top right of the settings window)
- Choose "Predefined Style > PSR1/2"
Autocomplete for factory methods (makeInstance, ObjectManager->get) in PHPStorm
The TYPO3 core comes with a configuration file for the dynamic return type plugin that gives you autocomplete for factory methods like GeneralUtility::makeInstance and ObjectManager->get. To install the plugin in PHPStorm follow these steps:
- Open Settings
- Go to plugins
- Click the "Browse repositories" button
- Enter "dynamicReturnTypePlugin" in the search box
- Install the plugin
- The configuration will be loaded automatically
FYI: The configuration file: https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/dynamicReturnTypeMeta.json (If your TYPO3 version does not have this file you can download it and just add it to your project.)