Php Inspections (EA Extended)

Compatible with: IntelliJ IDEA PhpStorm
16.04.2017
157 927
For support and donations please visit Github | Issues | PayPal.

Please follow me at twitter for status updates.

This plugin is a Static Code Analysis tool for PHP (aka inspections in JetBrains products).

It covers:
- architecture related issues (e.g. design pattern violations)
- weak types control and possible code construct simplifications
- performance issues
- non-optimal, duplicate and suspicious "if" conditions
- validation of magic methods usage
- regular expressions
- validation of exception handling workflow
- compatibility issues
- variety of time-consuming bugs
- PhpUnit API usage
- security issues

Some of inspections are expecting conditional statements (e.g. "if") to use group statement for wrapping body expressions. If this requirement is met then additional inspections are applied to the source code.

For Mac shortcuts, see this reference card. Windows/Linux ones are:
Alt + Shift + I to inspect current file with current profile
Ctrl + Alt + Shift + I to run inspection by name
Ctrl + Shift + F4 to close results of inspection.

On some projects CPU and therefore battery usage could be intensive, so it should be taken into account when traveling with a laptop.

Download plugin

Recent change notes

Our crowdfunding campaign finishes soon! This release makes you even more awesome, really =).

- Alias functions usage: resolved false-positives (imported functions)
- Default value is hidden in else branch: resolved a false-positive (container being used in conditions)
- Long inheritance chain: resolved false-positives (frameworks aware)
- One-time use variables: QF bug-fix
- Parameter could be declared as array: QF bug-fix
- Phar-incompatible 'realpath()' usage: QF implemented
- Statement could be decoupled from foreach: resolved false-positives (statements not operating with vars)
- Type unsafe comparison: QF implemented
- Unnecessary parentheses: resolved false-positives (multiple cases)
- Unused constructor dependencies: resolved false-positives (static context was not checked)
- Variable functions usage: QF rewritten
- ::class can be used: QF bug-fix, new options (lookup root namespace classes); thank you @Garethp
- 'empty(...)' usage: QF implemented
- 'stristr(...)/stripos(...)/strripos(...)' could be replaced with 'strstr(...)/strpos()/strrpos()': QF bug-fix
- 'substr(...)' short-hand usage: QF bug-fix, resolved false-positives (non-numeric offset)

- Parameter/variable is not used: new patterns
- A constant can be used: new patterns
- Overriding deprecated methods: new patterns
- Suspicious assignments: new patterns
- 'array_keys(...)/array_values(...)' used as foreach array: dropped
- Foreach source to iterate over: reworked (less false-positives)
- Unqualified function/constant reference: new patters

- Class autoloading correctness: implemented
- Multiple return statements usage: implemented (needs activation)
- Null pointer exceptions prevention: pilot version
- Return type hint can be used: implemented
- Usage of the silence operator: implemented (context aware!); thank you @funivan