soderlind / vscode-phpcbf

PHP Code Beautifier and Fixer for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=persoderlind.vscode-phpcbf
GNU General Public License v3.0
28 stars 10 forks source link

extension seems to ignore phpcs.xml #17

Open alberto-bottarini opened 6 years ago

alberto-bottarini commented 6 years ago

PHP example file:

<?php

namespace My\App;

class Foo
{
    public function getFoo()
    {
        echo 1;
    }

}

PHPCS.XML:

<?xml version="1.0"?>
<ruleset name="MyStandard">
 <rule ref="PSR2" />
 <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
   <severity>0</severity>
 </rule>
</ruleset>

If I run, using shell phpcs myfile.php I get, correctly:

 12 | ERROR | [x] The closing brace for the class must go on the next line after the body

Running phpcbf app/User.php, will fix my file:

FILE                                                       FIXED  REMAINING
---------------------------------------------------------------------------
/home/abottarini/Develop/homestead/quizzy/app/User.php     1      0

The same fix won't do if I run phpcbf inside my Visual Studio, while phpcs extension is underling my error line in red.