-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Visual Studio Code configuration
Go to https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation and download the phar file
Link used to be https://cs.symfony.com/download/php-cs-fixer-v2.phar
File->Preferences->Settings
At north-east, there are two icons, one says "Open Settings" and will show you the settings in json mode. . Add your paths.
"phpformatter.phpPath": "c:\\wamp\\bin\\php\\php7.4.9\\php.exe",
"phpformatter.pharPath": "c:\\php_formatter\\php-cs-fixer.phar",
"phpformatter.logging": true,
"phpformatter.arguments": [
"--rules=@PSR2"
],
The phpformatter.arguments PSR2 is required, seems to be a bug.
Debug info is visible here (phpformatter.logging):
View -> Command Palette ->Developer: Toggle Developer Tools -> Console
and looks like this:
console.ts:137 [Extension Host] PHPFormatter: Tempfile fd: 5
console.ts:137 [Extension Host] PHPFormatter: Tempfile name: c:\temp\phpfmt-21316hI7z3XLclzvd.tmp
console.ts:137 [Extension Host] PHPFormatter: Writing current document content to temp file. Until VSCode will have a way of querying encoding, utf8 will be used for reading and writing.
console.ts:137 [Extension Host] PHPFormatter: Full command being executed: "c:\wamp\bin\php\php7.4.9\php.exe" "c:\php_formatter\php-cs-fixer.phar" fix "c:\temp\phpfmt-21316hI7z3XLclzvd.tmp" --rules=@PSR2
Test that php-cs-fixer is installed:
php C:\php_formatter\php-cs-fixer.phar fix sample.php
I gathered this info from all the tickets. I hope it helps you.
wardds
Metadata
Metadata
Assignees
Labels
No labels