junstyle / vscode-php-cs-fixer

PHP CS Fixer extension for VS Code

Home Page:https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why are indention and code styles being ignored

snake-py opened this issue · comments

commented

I followed the installation instructions and I am trying to utilize this as pre-commit hook, but the output looks awful:

If I provide the command with the following php code it will not format it at all - is this intended or am I doing something wrong

    public $elasticTemplate = [
        '_id' => null,
        'id' => null,
        'type' => null,
                    '@timestamp' => null,
        'environment' => null,
                 'internal_api_log_id' => null,
        'base_url' => null,
        '       product' => null,
        'stage' => null,
        'exception'
        =>
        [
            'trace' => null,
            'place'
            => null,
            'previousThrowable' =>
            null,
            'type' => null,
                'message' => null,
            'code' => null,
        ],

The command I am using:

tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --using-cache=no --path-mode=intersection 

The config I have:

<?php

$finder = PhpCsFixer\Finder::create()
    ->exclude('tools')
    ->in(__DIR__)
;

$config = new PhpCsFixer\Config();
return $config->setRules([
        '@PSR12' => true,
        'array_syntax' => ['syntax' => 'short'],
    ])
    ->setFinder($finder)
;
commented

Sorry just noticed, I posted in the wrong repo, wanted to post here PHP-CS-Fixer/PHP-CS-Fixer#6631