关联数组 => 应该与 PHP-CS-Fixer 对齐吗?
$array = [
1 => 'a',
'1' => 'b',
1.5 => 'c',
true => 'd',
];
Run Code Online (Sandbox Code Playgroud)
或者
$array = [
1 => 'a',
'1' => 'b',
1.5 => 'c',
true => 'd',
];
Run Code Online (Sandbox Code Playgroud)
这是现在运行align_double_arrow较新版本的 PHP-CS-Fixer (v2, v3)的正确方法,它将在双箭头 ('=>') 之后对齐数组元素:
php-cs-fixer fix path \
--rules='{"binary_operator_spaces": {"operators": {"=>": "align_single_space_minimal"}}}'
Run Code Online (Sandbox Code Playgroud)
更多阅读:https : //github.com/FriendsOfPHP/PHP-CS-Fixer/blob/3.0/doc/rules/operator/binary_operator_spaces.rst