OXID eShop uses PSR-2 as coding style. This guide shows you step by step, how PhpStorm can assist you with the coding style.
1. Installation of CodeSniffer¶
PhpStorm uses the command line tool CodeSniffer to detect coding style
warnings and errors. When installing OXID eShop, CodeSniffer is installed by composer as
well (if you did not specify the
--no-dev switch on the command line). Check, this by executing CodeSniffer on the
2. Configure PhpStorm to use CodeSniffer¶
- Install and configure PHP CodeSniffer in PhpStorm. This is described in the Jetbrains documentation (set code sniffer by remote interpreter if CodeSniffer is installed in VM. See Configure a PHP_CodeSniffer script associated with a PHP interpreter).
- PhpStorm has multiple profiles where you can configure, how PHP files should be inspected:
- Go to .
- Choose .
- Choose and enable .
- Choose (PSR12 needs CodeSniffer >=3.3.0).
- Configure the PhpStorm editor to use PSR2 as well:
- Go to .
- Select .
- Select (PSR12 needs CodeSniffer >=3.3.0).
3. Coding Style in Action¶
- The PhpStorm editor shows you in every file via grey, serrated line where the coding style is corrupted.
- PhpStorm can apply the coding style by reformatting existing code via .
- You are able to run an inspection via . PhpStorm reports you CodeSniffer errors (and warnings if configured) in the section .