Use tab for indentation in PHP-CS-Fixer

How to configure PHP-CS-Fixer to use tabs for indentation?

I see the latch indentation_type

* indentation_type [@PSR2, @Symfony]
  | Code MUST use configured indentation type.

But how do I set the indent type? If I try to install 'indentation_type' => 'tab',, I get an error

[indentation_type] Is not configurable.
+4
source share
1 answer

This was in the documentation, and I skipped some of them (probably because I was looking for the term “tab” instead of “indentation”)

For those who seek the same, PhpCsFixer\Configthere is a method setIndent.

return PhpCsFixer\Config::create()
    ->setRules([
        '@PSR2' => true,
        'indentation_type' => true,
    ])
    ->setIndent("\t")
    ->setLineEnding("\n")
    ->setFinder($finder)
+7
source

Source: https://habr.com/ru/post/1672524/


All Articles