-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The result of VS Code formatter vs cli - differs with same config file #195
Comments
And yes, vs code extension output has nothing suspicious if I "format current file":
|
Dear @palansher We use <?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$finder = Finder::create()
->in([
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return (new Config('Extranet Laravel Rules'))
->setRules([
'@PSR12' => true,
'braces' => [
'position_after_functions_and_oop_constructs' => 'same',
]
])
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true); |
Hello, Stefano!
Unfortunately, I was not. Thank you for your example. Maybe author will pay attention to provided details. |
Well I think I possibly found the issue. Id turned out, that the cs-fixer versions where different and so the name of some deprecated rule names. Maybe you can check that for yourself again :) |
Great! Now after two years, I am focused on DevOps and currently even have no PHP environment to check :) |
Just to clear up any ambiguities. The problem could be that a different php-cs-fixer version is used in the extension than the one installed in the /vendor/ folder. Thanks for the feedback and in this case good luck for the future :) |
Good day!
Thank you for great extension!
The problem:
I get different results for formatting. Maybe extension does not pay attention to rulesets in the provided config file ?
For example, in such cli I get correct results:
But in VS Code (formatting, ) I got less rules applied for the same PHP file..
i.e. after formatting in VSCODE (and saving file, for sure), the CLI version founds to format something more (extra).
Is it known feature/bug?
Is it possible to get same result with same config file for CLI and VSCODE extension methods?
If you interested, I can provide some example PHP file.
The Environment is:
VS Code config settings are (workspace):
php cs fixer ext ver: v0.3.8
PHP CS Fixer 3.13.1 Oliva by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.13
ubuntu 20.04
vscode ver: 1.74.2
.php-cs-fixer.php in workspace root:
The text was updated successfully, but these errors were encountered: