Closed
Description
I would like to remove all aligned =>
symbols from our code base and add a corresponding rule to our coding conventions:
Before:
$resolver->setDefaults(array(
'data_class' => $dataClass,
'empty_data' => $emptyData,
'trim' => true,
'required' => true,
'read_only' => false,
// ... snip ...
'action' => '',
'attr' => $defaultAttr,
'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.',
));
After:
$resolver->setDefaults(array(
'data_class' => $dataClass,
'empty_data' => $emptyData,
'trim' => true,
'required' => true,
'read_only' => false,
// ... snip ...
'action' => '',
'attr' => $defaultAttr,
'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.',
));
Although the first version looks nicer, it is:
- more difficult to maintain, because whole arrays have to be adjusted when the length of the longest key changes;
- more difficult to review PRs, since their diffs contain lines which are unrelated to the PR apart from whitespace changes;
- and most importantly, very difficult to use
git blame
. If you want to find out when/why "read_only" was set tofalse
. You will have to follow a chain of commits that only changed whitespace (and usegit blame
on those commits again) before you find the commit that actually changed the line.
Metadata
Metadata
Assignees
Labels
Ideal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)