Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[CS] Remove aligned "=>" #12284

Copy link
Copy link
Closed
Closed
Copy link
@webmozart

Description

@webmozart
Issue body actions

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 to false. You will have to follow a chain of commits that only changed whitespace (and use git blame on those commits again) before you find the commit that actually changed the line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.