Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Generic.Arrays.ArrayIndent sniff #54

Merged

Conversation

deeky666
Copy link
Member

Seems this is not part of PSR-2 -.-

Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it 👍

Just some comments before you have my approval 😄

@@ -8,6 +8,8 @@
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
</rule>

<!-- Indent array keys with 4 spaces -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Force array indentation"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

7,
8,
9,
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the tests with a example with strings in the keys, like:

$foo = [
'foo'   =>  [
  'bar' => 2,
1 => 'baz',
];
];

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is also an interesting scenario:

$items->append($one)
      ->append(
            [
0,
 1,
  2,
   ...,
              14,
               15,
                16,
            ]
      );

And I'd expect to have something like:

$items->append($one)
      ->append(
            [
                0,
                1,
                2,
                ...,
                14,
                15,
                16,
            ]
      );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lcobucci that interferes with another rule:

Multi-line function call not indented correctly; expected 10 spaces but found 0

In the end an array initializer is an array initializer, is it not? We could add tests for all kinds of scenarios, but that doesn't change the array tokens as such. I would like to avoid possible conflicts with other rules as much as possible for now and in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deeky666 that makes sense =)

greg0ire
greg0ire previously approved these changes Apr 12, 2018
alcaeus
alcaeus previously approved these changes Apr 12, 2018
@deeky666 deeky666 dismissed stale reviews from alcaeus and greg0ire via b85e21a April 12, 2018 11:22
@deeky666 deeky666 force-pushed the add-Generic.Arrays.ArrayIndent-sniff branch from 1251e0f to b85e21a Compare April 12, 2018 11:22
Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -17,6 +19,7 @@
<!-- But allow empty catch -->
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
</rule>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this rule?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sry, that was something else I accidently commited xD. will fix it

@deeky666 deeky666 force-pushed the add-Generic.Arrays.ArrayIndent-sniff branch from b85e21a to fa4d8f8 Compare April 12, 2018 13:58
@Ocramius Ocramius self-assigned this Apr 12, 2018
@lcobucci lcobucci merged commit d4c19f6 into doctrine:master Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants