How can I configure PHP-CS-Fixer to use tab for indentation?
I can see the indentation_type fixer
* indentation_type [@PSR2, @Symfony]
  | Code MUST use configured indentation type.
But how do I configure the indentation type? If I try to set 'indentation_type' => 'tab',, I am getting the error
[indentation_type] Is not configurable.
                It was there in the documentation, and some how I missed it (probably because I was searching for the term 'tab' instead of 'indentation')
For anyone else looking for the same, there is a setIndent method in PhpCsFixer\Config.
return PhpCsFixer\Config::create()
    ->setRules([
        '@PSR2' => true,
        'indentation_type' => true,
    ])
    ->setIndent("\t")
    ->setLineEnding("\n")
    ->setFinder($finder)
                        First create .php_cs file in your project root directory. Then add the below lines to .php_cs file
<?php
return PhpCsFixer\Config::create()
->setRules([
    '@PSR2' => true,
    'indentation_type' => true,
])
->setIndent("\t")
->setLineEnding("\n")
->setFinder($finder)
Then run the below command to fix the issue
vendor/bin/php-cs-fixer fix . --config .php_cs
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With