我通常用PHP编写代码,但我有一个非常简单的html代码,它的结构很糟糕。当我尝试用php-cs修复程序修复它时,情况可能会变得更糟。它将一些元素(如“i”)保持在同一行,但将其类下移。或者它保持了“Lorem”Impsum脚本中的Lorem部分,并将“Impsum”扔下。。。等
我使用我在互联网上找到的以下配置代码:
<?php
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PSR12' => true,
'new_with_braces' => false,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
'blank_line_before_statement' => true,
'braces' => [
'allow_single_line_closure' => true,
],
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'include' => true,
'lowercase_cast' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_spaces_around_offset' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'single_trait_insert_per_statement' => false,
'method_separation' => false,
])
->setLineEnding("\n");
有人给我一个更好的配置建议吗?谢谢你的回复。