How To Setup PHPStorm for Magento Development
Magicento
Go buy this extension and install it.
It's $32 so the first time you use it to automatically build a Module Stub you'll have saved yourself 15-20 minutes and you'll have covered the cost.
Line Sepator
Hit CTRL-ALT-s
to bring up the settings menu.
Navigate to: Editor > Code Style : General
Line separator => Unix and macOS (\n)
2. PSR-1 / PSR-2
Hit CTRL-ALT-s
to bring up the settings menu.
Navigate to: Editor > Code Style > PHP
Click "Set from..." on the top right.
Choose "PSR1/PSR2" from the drop down menu.
PHP
Hit CTRL-ALT-s
to bring up the settings menu.
Navigate to: Languages & Frameworks > PHP
Set your PHP Language level
Click the "..." next to CLI Interpreter
Click "+" to add a new binary
Choose where ever your PHP executable is located
Hit OK
PHP_CodeSniffer
This step requires PHP and composer installed so you don't meet those criteria go do that now.
Install via composer: https://github.com/squizlabs/PHP_CodeSniffer
composer global require "squizlabs/php_codesniffer=*"
Clone the Magento Coding Standard repo to your computer somewhere.
git clone https://github.com/magento/magento-coding-standard.git
Add the Magento Coding Standard sniffs to php_codsniffer
phpcs --config-set installed_paths F:\magento-coding-standard\
Note here the path that is specified above is where you cloned the Magento Coding Standard repo to.
Verify that phpcs has the sniffs
phpcs -i
Hit CTRL-ALT-s
to bring up the settings menu.
Navigate to: Languages & Frameworks > PHP > Quality Tools
Expand PHP_CodeSniffer
Click "..." to choose a preset standard
Choose the phpcs executable in for the path
In Windows 10 for me it was: C:\Users\Will\AppData\Roaming\Composer\vendor\bin\phpcs.bat
Click "Validate" and you should get a success message
Navigate to: Editor > Inspections
Search for: "quality tools"
Choose: PHP_CodeSniffer validation
Click the checkbox such that it's enabled
Choose a "Severity" and a "Warning" level. I like "Weak Warning"
Check "Show sniff name"
In the drop down list for "Coding standard" choose "Magento2"
Click "Apply"