如何将PHP配置为使用选项卡进行缩进?
我能看到indentation_type的固定器
* indentation_type [@PSR2, @Symfony]
| Code MUST use configured indentation type.但是如何配置缩进类型?如果我试图设置'indentation_type' => 'tab',,就会得到错误
[indentation_type] Is not configurable.发布于 2017-03-22 11:29:52
它就在文档中,还有我是如何错过它的(可能是因为我在搜索术语'tab‘而不是’缩进‘)。
对于其他寻找相同信息的人,PhpCsFixer\Config中有一个PhpCsFixer\Config方法。
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'indentation_type' => true,
])
->setIndent("\t")
->setLineEnding("\n")
->setFinder($finder)发布于 2020-10-23 06:48:35
首先在项目根目录中创建.php_cs文件。然后将以下行添加到.php_cs文件中
<?php
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'indentation_type' => true,
])
->setIndent("\t")
->setLineEnding("\n")
->setFinder($finder)然后运行下面的命令来解决这个问题
vendor/bin/php-cs-fixer fix . --config .php_cshttps://stackoverflow.com/questions/42849484
复制相似问题