File: OpeningBraceSameLineUnitTest.inc

package info (click to toggle)
php-codesniffer 2.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,460 kB
  • ctags: 8,660
  • sloc: php: 40,311; xml: 9,505; pascal: 3,365; makefile: 16; sh: 6
file content (81 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php

// The following are all ok.
interface Test_Interface_Ok_A {
}

class Test_Class_Ok_A {
}

class Test_Class_Ok_B extends Test_Class_Ok_A {
}

class Test_Class_Ok_C implements Test_Interface_Ok_A {
}


// These are all incorrect.
interface Test_Interface_Bad_A
{ // There should be no content after the brace.
}

class Test_Class_Bad_A
	{
	}

class Test_Class_Bad_B extends Test_Class_Bad_A

{ // There should be no content after the brace.
}

class Test_Class_Bad_C implements Test_Interface_Bad_A


{
}

// These should all be flagged for wrong whitespace before opening brace.
interface Test_Interface_Bad_C   {
}

class Test_Class_Bad_G	{		
}

class Test_Class_Bad_H extends Test_Class_Bad_G			{
}

class Test_Class_Bad_I implements Test_Interface_Bad_C{
}

// This one should be flagged as a potential parse error.
class Test_Class_Bad_H

// This is OK.
class A_Class_With_Really_Long_Name
    extends Another_Class_With_A_Really_Long_Name {

}

// This is OK too.
class A_Class_With_Really_Long_Name_2
    extends Another_Class_With_A_Really_Long_Name
    implements Some_Interface_With_A_Long_Name,
          Another_Interface_With_A_Long_Name {

}

// But this is not.
class A_Class_With_Really_Long_Name_3
    extends Another_Class_With_A_Really_Long_Name
	{

}

// Nor is this.
class A_Class_With_Really_Long_Name_4
    extends Another_Class_With_A_Really_Long_Name
    implements Some_Interface_With_A_Long_Name,
          Another_Interface_With_A_Long_Name
{

}