~ubuntu-branches/ubuntu/wily/php-codesniffer/wily-proposed

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-2.3.2/CodeSniffer/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc

  • Committer: Package Import Robot
  • Author(s): David Prévot, Greg Sherwood
  • Date: 2015-06-24 13:41:36 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20150624134136-dv60dnl6s20tdxwr
Tags: 2.3.3-1
[ Greg Sherwood ]
Prepare for 2.3.3 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
/*
4
 
    Comments need to be indented 4 space.
5
 
*/
6
 
 
7
 
/*
8
 
    same with multi-line
9
 
    comments.
10
 
*/
11
 
 
12
 
/*
13
 
    But they can:
14
 
        - be indented more than 4
15
 
        - but not less than 4
16
 
*/
17
 
 
18
 
/*
19
 
    - This is valid:
20
 
   Not indented correctly.
21
 
*/
22
 
 
23
 
/*
24
 
   Comments need to be indented 4 space.
25
 
*/
26
 
 
27
 
/*
28
 
    Comments need to be indented 4 space.
29
 
     Comments need to be indented 4 space.
30
 
   Comments need to be indented 4 space.
31
 
  Comments need to be indented 4 space.
32
 
 
33
 
    Comments need to be indented 4 space.
34
 
   Comments need to be indented 4 space.
35
 
*/
36
 
 
37
 
/*
38
 
    Block comments require a blank
39
 
    line after them.
40
 
*/
41
 
$code = 'should not be here';
42
 
 
43
 
/*
44
 
    Closing comment not aligned
45
 
    */
46
 
 
47
 
/*
48
 
    Closing comment not aligned
49
 
 */
50
 
 
51
 
/* Not allowed */
52
 
 
53
 
/*  Not allowed
54
 
    either.
55
 
*/
56
 
 
57
 
/* */
58
 
 
59
 
$code = 'should not be here';
60
 
/*
61
 
 
62
 
    Block comments require a blank
63
 
    line before them. */
64
 
 
65
 
/*
66
 
*/
67
 
 
68
 
/** Not allowed */
69
 
 
70
 
/**  Not allowed
71
 
    either.
72
 
**/
73
 
 
74
 
/*
75
 
    no capital
76
 
    letter.
77
 
*/
78
 
 
79
 
echo 'hi';
80
 
 
81
 
function func()
82
 
{
83
 
    echo 1;
84
 
    /**
85
 
       test
86
 
       here
87
 
    **/
88
 
    echo 'test';
89
 
    /**
90
 
        Test
91
 
        here
92
 
       **/
93
 
 
94
 
}//end func()
95
 
 
96
 
public static function test()
97
 
{
98
 
    /*
99
 
        Block comments do not require a blank line before them
100
 
        if they are after T_OPEN_CURLY_BRACKET.
101
 
    */
102
 
 
103
 
    $code = '';
104
 
 
105
 
}//end test()
106
 
 
107
 
 
108
 
public static function test()
109
 
{
110
 
 
111
 
    /*
112
 
        Block comments do not require a blank line before them
113
 
        if they are after T_OPEN_CURLY_BRACKET.
114
 
    */
115
 
 
116
 
    $code = '';
117
 
 
118
 
}//end test()
119
 
 
120
 
class MyClass
121
 
{
122
 
 
123
 
    /**
124
 
     * Comment should be ignored.
125
 
     *
126
 
     * @var   integer
127
 
     * @since 4.0.0
128
 
     */
129
 
    const LEFT = 1;
130
 
 
131
 
}
132
 
 
133
 
/**
134
 
 * Comment should be ignored.
135
 
 *
136
 
 */
137
 
final class MyClass
138
 
{
139
 
    /**
140
 
     * Comment should be ignored.
141
 
     *
142
 
     */
143
 
    final public function test() {}
144
 
}
145
 
 
146
 
switch ($var) {
147
 
    case 'foo':
148
 
        /*
149
 
            Foo comment.
150
 
            This is a multiple
151
 
            line comment for Foo.
152
 
        */
153
 
 
154
 
        echo 'Foo';
155
 
    break;
156
 
 
157
 
    default:
158
 
 
159
 
        /*
160
 
            Foo comment.
161
 
            This is a multiple
162
 
            line comment for Foo.
163
 
        */
164
 
 
165
 
        echo 'Default';
166
 
    break;
167
 
}//end switch
168
 
 
169
 
/**
170
 
 * Comment should be ignored in PHP 5.4.
171
 
 *
172
 
 */
173
 
trait MyTrait {
174
 
 
175
 
}
176
 
 
177
 
/*
178
 
    这是一条测试评论.
179
 
*/
180
 
 
181
 
/*Channels::includeSystem('Permission');
182
 
if (Permission::hasPermission($projectid, 'project.metadata.add') === FALSE) {
183
 
    throw new PermissionException(_('You do not have permission to add metadata field'));
184
 
}*/
185
 
 
186
 
/*
187
 
    Comment goes here
188
 
*/
189
 
$two = (1 + 1);  // I'm not a comment closer!
190
 
 
191
 
class Foo
192
 
{
193
 
 
194
 
    /**
195
 
     * Comment here.
196
 
     *
197
 
     * @var array
198
 
     */
199
 
    var $bar = array();
200
 
 
201
 
}