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

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.3.4/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2012-05-31 16:37:24 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120531163724-u6aiaubu8ks5dh5z
Tags: 1.3.4-0.1
* Non-maintainer upload.
* New upstream release (Closes: #599617, #634825).
* Swtiched debian/copyright to format 1.0 (rewrite was needed anyway, as the
upstream license changed).
* Switched package to pkg-php-tools and debhelper 8 sequencer.
* Now running unit tests at build time (so depends on phpunit (>= 3.6)).
* Section is now PHP.
* Added missing Build-Depends-Indep: php-pear.
* Added missing ${misc:Depends}.
* Added Vcs fields.
* Added homepage field.
* Reviewed short and long description.
* Added dependency on php-timer.
* Standards-Version: is now 3.9.3 (lots of changes, see above...).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
class PHP_CodeSniffer_File
 
3
{
 
4
 
 
5
    /**
 
6
     * A simple function comment.
 
7
     *
 
8
     * long desc here
 
9
     *
 
10
     * @param int $stackPtr   The position in @ @unknown the stack of the token
 
11
     *                        that opened the scope
 
12
     * @param int $detph    How many scope levels down we are.
 
13
     * @param int    $index    The index
 
14
     * @return
 
15
     * @throws
 
16
     */
 
17
    private function _functionCall($stackPtr, $depth=1, $index)
 
18
    {
 
19
        return $stackPtr;
 
20
 
 
21
    }//end _functionCall()
 
22
 
 
23
    //
 
24
    // Sample function comment
 
25
    //
 
26
    //
 
27
    //
 
28
    public function invalidCommentStyle()
 
29
    {
 
30
 
 
31
    }//end invalidCommentStyle()
 
32
 
 
33
 
 
34
    /**
 
35
     *
 
36
     *
 
37
     * A simple function comment
 
38
     *
 
39
     *
 
40
     * Long description with extra blank line before and after
 
41
     *
 
42
     *
 
43
     * @return void
 
44
     */
 
45
    public function extraDescriptionNewlines()
 
46
    {
 
47
 
 
48
    }//end extraDescriptionNewlines()
 
49
 
 
50
 
 
51
    /**
 
52
     * A simple function comment
 
53
     * @return void
 
54
     */
 
55
    public function missingNewlinesBeforeTags()
 
56
    {
 
57
 
 
58
    }//end missingNewlinesBeforeTags()
 
59
 
 
60
 
 
61
    /**
 
62
     * Access tag should not be treated as a long description
 
63
     *
 
64
     * @access public
 
65
     * @return void
 
66
     */
 
67
    public function accessTag()
 
68
    {
 
69
 
 
70
    }//end accessTag()
 
71
 
 
72
    /**
 
73
     * Constructor
 
74
     *
 
75
     * No return tag
 
76
     */
 
77
    function PHP_CodeSniffer_File()
 
78
    {
 
79
        return;
 
80
    }
 
81
 
 
82
 
 
83
    /**
 
84
     * Destructor
 
85
     *
 
86
     * No return tag too
 
87
     */
 
88
    function _PHP_CodeSniffer_File()
 
89
    {
 
90
        return;
 
91
    }
 
92
 
 
93
 
 
94
    /**
 
95
     * Destructor PHP5
 
96
     */
 
97
    function __destruct()
 
98
    {
 
99
        return;
 
100
    }
 
101
 
 
102
 
 
103
    function missingComment()
 
104
    {
 
105
        return;
 
106
    }
 
107
 
 
108
 
 
109
    /**
 
110
     * no return tag
 
111
     *
 
112
     */
 
113
    public function noReturn($one)
 
114
    {
 
115
 
 
116
    }//end noReturn()
 
117
 
 
118
 
 
119
    /**
 
120
     * Param not immediate
 
121
     *
 
122
     * @return
 
123
     * @param   int   $threeSpaces
 
124
     * @param int     $superfluous
 
125
     * @param missing
 
126
     * @param
 
127
     */
 
128
    public function missingDescroption($threeSpaces)
 
129
    {
 
130
 
 
131
    }//end missingDescroption()
 
132
 
 
133
 
 
134
    /**
 
135
     * Param not immediate
 
136
     *
 
137
     * @param int      $one   comment
 
138
     * @param int      $two   comment
 
139
     * @param string   $three comment
 
140
     *
 
141
     * @return void
 
142
     */
 
143
    public function oneSpaceAfterLongestVar($one, $two, $three)
 
144
    {
 
145
 
 
146
    }//end oneSpaceAfterLongestVar()
 
147
 
 
148
 
 
149
}//end class
 
150
 
 
151
 
 
152
/**
 
153
 * A simple function comment
 
154
 *
 
155
 * @param string $str The string passed in by reference
 
156
 *
 
157
 * @return void
 
158
 */
 
159
public function functionOutsideClass(&$str)
 
160
{
 
161
    return;
 
162
}//end functionOutsideClass()
 
163
 
 
164
 
 
165
function missingCommentOutsideClass()
 
166
{
 
167
    return;
 
168
}//end missingCommentOutsideClass()
 
169
 
 
170
 
 
171
?><?php
 
172
function tagBeforeComment()
 
173
{
 
174
    return;
 
175
}//end tagBeforeComment()
 
176
 
 
177
 
 
178
/**
 
179
 * no return tag
 
180
 *
 
181
 *
 
182
 *
 
183
 */
 
184
public function noReturnOutsideClass()
 
185
{
 
186
 
 
187
}//end noReturnOutsideClass()
 
188
 
 
189
 
 
190
/**
 
191
 * Missing param comment
 
192
 *
 
193
 * @param int $one comment
 
194
 *
 
195
 * @return void
 
196
 * @fine  Unknown tag
 
197
 */
 
198
public function missingTwoParamComment($one, $two, $three)
 
199
{
 
200
 
 
201
}//end missingTwoParamComment()
 
202
 
 
203
 
 
204
/**
 
205
 *
 
206
 */
 
207
function emptyFunctionDocComment()
 
208
{
 
209
}//end emptyFunctionDocComment()
 
210
 
 
211
 
 
212
/**
 
213
 * Test function.
 
214
 *
 
215
 * @param string $arg1 An argument
 
216
 *
 
217
 * @access public
 
218
 * @return bool
 
219
 */
 
220
function myFunction($arg1) {}
 
221
 
 
222
 
 
223
/**
 
224
 * Test function.
 
225
 *
 
226
 * @param string $arg1 An argument
 
227
 *
 
228
 * @access public
 
229
 * @return bool
 
230
 */
 
231
 
 
232
echo $blah;
 
233
 
 
234
function myFunction($arg1) {}
 
235
 
 
236
/**
 
237
 * Test function.
 
238
 *
 
239
 * @access public
 
240
 * @return bool
 
241
 * @throws MyException
 
242
 * @throws MyException When I feel like it
 
243
 */
 
244
function myFunction() {}
 
245
 
 
246
class MyClass() {
 
247
    /**
 
248
     * An abstract function.
 
249
     *
 
250
     * @return array(string)
 
251
     */
 
252
    abstract final protected function myFunction();
 
253
}
 
254
?>