Skip to content

Commit fdbc043

Browse files
authored
fix(ClassDeclaration): Fix indent to 2 spaces for multi-line class declaration (#3300911)
1 parent 2cc69ae commit fdbc043

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
class ClassDeclarationSniff extends PSR2ClassDeclarationSniff
2626
{
2727

28+
/**
29+
* {@inheritdoc}
30+
*
31+
* @var integer
32+
*/
33+
public $indent = 2;
34+
2835

2936
/**
3037
* Returns an array of tokens this test wants to listen for.

tests/Drupal/Classes/ClassDeclarationUnitTest.inc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,14 @@ namespace {
4040
class ThirdClass {
4141
// No-op.
4242
}
43+
44+
/**
45+
* Class declaration over multiple lines.
46+
*/
47+
class WithManyInterfaces implements
48+
Interface1,
49+
Interface2,
50+
Interface3,
51+
Interface4 {
52+
53+
}

tests/Drupal/Classes/ClassDeclarationUnitTest.inc.fixed

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,14 @@ namespace {
4040
class ThirdClass {
4141
// No-op.
4242
}
43+
44+
/**
45+
* Class declaration over multiple lines.
46+
*/
47+
class WithManyInterfaces implements
48+
Interface1,
49+
Interface2,
50+
Interface3,
51+
Interface4 {
52+
53+
}

0 commit comments

Comments
 (0)