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