PHP External Formatter: Process exited with non-zero code
Validate the configuration in Settings > PHP > Quality Tools > PHP CS Fixer by opening your current Configuration by clicking the button with the three dots (...).
In the now open PHP CS Fixer dialog press the Validate button.
At the bottom of the dialog an info admonition should become visible showing "OK, PHP CS Fixer [version ...]". Additionally the PHP version is shown. This should be the one you selected.
FYI: PhpStorm uses the PHP version from the system, at least this is what it did for me. Not in this dialog info, but when executing, e.g. the time when you see the notice about the non-zero exit status code.
I'd therefore recommend to configure the "System PHP" as well, because it will show the PHP version as PhpStorm finds it and this info can be obtained as well.
You can now close this dialog.
After obtaining this information, use the configured path of the PHP CS Fixer PHP script and execute it in your terminal (ALT + F12):
$ /path/to/bin/php-cs-fixer help fix
...
---------
Exit code of the `fix` command is built using following bit flags:
... eight more lines ...
# E_SUCCESS - exit code 0
At the very end you find the description of the PHP CS Fixer (PHP External Formatter) exit code. As we only know it is non-zero, these are your potential causes:
- General error (or PHP minimal requirement not matched).
- Configuration error of the application.
- Configuration error of a Fixer.
- Exception raised within the application.
- 255 - Fatal Error during the execution of the PHP CS Fixer PHP script invocation (not shown in the help output of the PHP script itself)
With the information you were able to obtain by validating the configuration above, you now have to verify your coding standards configuration if they are compatible with the PHP runtime configuration that is in use.
Locate your PHP CLI SAPI configuration initialization files ("php.ini") and temporarily enable error logging to a known and accessible error log file location of yours. Then provoke the error message again and consult the log file.
You will likely see the stack trace of an exception or some other message about a PHP Fatal Error.
Could this be the issue? [Your PHP CS Fixer PHP Script configuration file location]
Likely not. PhpStorm invokes the PHP CS Fixer External Formatter on a single file copied to a temporary location with the chosen standard (Ruleset) given via command line arguments.
When you configure your custom standard, this is an option PhpStorm supports, you specify the standard location under Settings > PHP > Quality Tools > PHP CS Fixer by selecting the Custom Ruleset (dropdown box) and it requires an absolute pathname.
idea.logfile for possible hints (Help | Show Log in XXX) 2) If it has nothing -- add extra logging and try again (see instructions in this comment: youtrack.jetbrains.com/issue/… )