Even if I explicitly set the config settings.json, it is not passed as a command-line parameter to the executable.
I had to do a workaround by creating a wrapper script that always adds the config file sitting next to it:
settings.json
"php-cs-fixer.executablePath": "${workspaceFolder}/php-cs-fixer-wrapper.sh",
php-cs-fixer-wrapper.sh
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
exec "$SCRIPT_DIR/vendor/bin/php-cs-fixer" "$@" --config="$SCRIPT_DIR/.php-cs-fixer.php"
Adding the config file explicitly is a must in VSCode, since the tool runs on temp files created by the IDE and can't find config files relative to them. This caused it to switch into interactive mode, asking about risky rules, then timing out and generating .php-cs-fixer.dist.php wherever the saved file was. It was long, annoying, and didn't even fix the file. The above workaround fixed it, but fixing the issue with passing config parameters would be the real solution.
Even if I explicitly set the config settings.json, it is not passed as a command-line parameter to the executable.
I had to do a workaround by creating a wrapper script that always adds the config file sitting next to it:
settings.json
php-cs-fixer-wrapper.sh
Adding the config file explicitly is a must in VSCode, since the tool runs on temp files created by the IDE and can't find config files relative to them. This caused it to switch into interactive mode, asking about risky rules, then timing out and generating
.php-cs-fixer.dist.phpwherever the saved file was. It was long, annoying, and didn't even fix the file. The above workaround fixed it, but fixing the issue with passing config parameters would be the real solution.