benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

PHP Coding Standards Fixer (php-cs-fixer) V2 Support #170

Closed ghost closed 7 years ago

ghost commented 7 years ago

PHP Coding Standards Fixer (php-cs-fixer) is now 2.0.0, which can set configurable rules, using sublime-phpcs with php_cs_fixer_additional_args setting can't use it. Can we support it?

Thanks! :)

benmatselby commented 7 years ago

Hi @chanjsq Do you have an example please?

benmatselby commented 7 years ago

Hi @chanjsq

I think it does support this.. I've just tried this:

"php_cs_fixer_additional_args": {
        "--diff": ""
    },

And it ran this:

Phpcs] /usr/local/opt/php71/bin/php /Users/ben/.composer/vendor/bin/php-cs-fixer fix /Users/ben/git/external/trello-cli/src/TrelloCli/Client.php --verbose --diff
[Phpcs] cwd: /Users/ben
[Phpcs] You are running php-cs-fixer with xdebug enabled. This has a major impact on runtime performance.
Loaded config default.
F
Legend: ?-unknown, I-invalid file syntax, file ignored, S-Skipped, .-no changes, F-fixed, E-error
   1) /Users/ben/git/external/trello-cli/src/TrelloCli/Client.php (braces)
      ---------- begin diff ----------
--- Original
+++ New
@@ @@
         if ($httpClient === null) {
-

Which produces the diff. So this is supporting additional args? I'm closing as I believe it does what is requested. Please re-open if I've misunderstood and you can provide an example.

Thanks for raising

iotch commented 7 years ago

OP is talking about this:

$ php php-cs-fixer.phar fix /path/to/project --rules='{"concat_space": {"spacing": "none"}}'

Some rules now with v 2.0 not only booleans, but may contain values.