Subversion Repositories Applications.framework

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 aurelien 1
<?php
2
 
3
class Test
4
{
5
    function __construct()
6
    {
7
       $this->hello(); // error here
8
    }
9
 
10
   function hello() // error here
11
    { // no error here as brackets can be put anywhere in the pear standard
12
        echo 'hello';
13
    }
14
 
15
    function hello2()
16
    {
17
       if (TRUE) { // error here
18
            echo 'hello'; // no error here as its more than 4 spaces.
19
        } else {
20
        echo 'bye'; // error here
21
        }
22
 
23
        while (TRUE) {
24
           echo 'hello'; // error here
25
         }// no error here as its handled by another test.
26
 
27
       do { // error here
28
         echo 'hello'; // error here
29
       } while (TRUE); // no error here as its aligned with the do.
30
   }// no error here as its handled by another test.
31
 
32
    function hello3()
33
    {
34
        switch ($hello) {
35
        case 'hello': // no error here as switch statements shouldn't be indented ???
36
            break;
37
        }
38
    }
39
 
40
}
41
 
42
?>
43
<pre>
44
</head>
45
<body>
46
<?php
47
if ($form->validate()) {
48
    $safe = $form->getSubmitValues();
49
}
50
?>
51
</pre>
52
<?php
53
 
54
class Test2
55
{
56
    function __construct()
57
    {
58
    //    $this->open(); // error here
59
    }
60
 
61
    public function open()
62
    {
63
        // Some inline stuff that shouldn't error
64
        if (TRUE) echo 'hello';
65
        foreach ($tokens as $token) echo $token;
66
    }
67
 
68
    /**
69
     * This is a comment 1.
70
     * This is a comment 2.
71
     * This is a comment 3.
72
     * This is a comment 4.
73
     */
74
    public function close()
75
    {
76
        // All ok.
77
        if (TRUE) {
78
            if (TRUE) {
79
            } else if (FALSE) {
80
                foreach ($tokens as $token) {
81
                    switch ($token) {
82
                    case '1':
83
                    case '2':
84
                        if (true) {
85
                            if (false) {
86
                                if (false) {
87
                                    if (false) {
88
                                        echo 'hello';
89
                                    }
90
                                }
91
                            }
92
                        }
93
                    break;
94
                    case '5':
95
                        break;
96
                    }
97
                    do {
98
                        while (true) {
99
                            foreach ($tokens as $token) {
100
                                for ($i = 0; $i < $token; $i++) {
101
                                    echo 'hello';
102
                                }
103
                            }
104
                        }
105
                    } while (true);
106
                }
107
            }
108
        }
109
    }
110
 
111
    /*
112
      This is another c style comment 1.
113
      This is another c style comment 2.
114
      This is another c style comment 3.
115
      This is another c style comment 4.
116
      This is another c style comment 5.
117
    */
118
 
119
    /*
120
    *
121
    *
122
    *
123
   */
124
 
125
    /**
126
   */
127
 
128
    /*
129
      This comment has a newline in it.
130
 
131
    */
132
 
133
    public function read()
134
    {
135
        echo 'hello';
136
 
137
        // no errors below.
138
        $array = array(
139
                  'this',
140
                  'that' => array(
141
                             'hello',
142
                             'hello again' => array(
143
                                               'hello',
144
                                              ),
145
                            ),
146
                 );
147
    }
148
}
149
 
150
abstract class Test3
151
{
152
    public function parse()
153
    {
154
 
155
        foreach ($t as $ndx => $token) {
156
            if (is_array($token)) {
157
                echo 'here';
158
            } else {
159
                $ts[] = array("token" => $token, "value" => '');
160
 
161
                $last = count($ts) - 1;
162
 
163
                switch ($token) {
164
                case '(':
165
 
166
                    if ($last >= 3 &&
167
                        $ts[0]['token'] != T_CLASS &&
168
                        $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
169
                        $ts[$last - 3]['token'] == T_VARIABLE ) {
170
 
171
 
172
                        if (true) {
173
                            echo 'hello';
174
                        }
175
                    }
176
                    array_push($braces, $token);
177
                    break;
178
                }
179
            }
180
        }
181
    }
182
}
183
 
184
public function test()
185
{
186
    $o = <<<EOF
187
this is some text
188
this is some text
189
this is some text
190
this is some text
191
this is some text
192
this is some text
193
EOF;
194
 
195
    return $o;
196
}
197
 
198
if ($a === true || $a === true || $a === true || $a === true ||
199
    $a === true || $a === true || $a === true || $a === true) {
200
 
201
    echo 'hello';
202
}
203
 
204
if ($true) {
205
    /* First comment line
206
    *
207
    * Comment test here
208
    * Comment test here
209
    *
210
    */
211
 
212
    /* First comment line
213
    *
214
    * Comment test here
215
    * Comment test here
216
    *
217
    this si something */
218
}
219
 
220
function test()
221
{
222
    /* taken from http://de3.php.net/manual/en/reserved.php */
223
    # $m[] = 'declare';
224
   /* taken from http://de3.php.net/manual/en/reserved.php */
225
   # $m[] = 'declare';
226
}
227
 
228
foreach ($elements as $element) {
229
    if ($something) {
230
        // Do IF.
231
    } else if ($somethingElse) {
232
        // Do ELSE.
233
    }
234
}
235
 
236
if ($condition) {
237
    echo "This is a long
238
string that spans $numLines lines
239
without indenting.
240
";
241
}
242
 
243
if ($condition) {
244
    echo 'This is a long
245
    string that spans nultiple lines
246
    with indenting.
247
    ';
248
}
249
 
250
if ($condition) {
251
    echo 'This is a long
252
          string that spans nultiple lines
253
          with indenting.';
254
}
255
 
256
switch ($foo) {
257
case 1:
258
    switch ($bar) {
259
    default:
260
        echo $string{1};
261
    }
262
    break;
263
}
264
 
265
function temp($foo, $bar) {
266
    switch ($foo) {
267
    case 1:
268
        switch ($bar) {
269
        default:
270
            return $foo;
271
        }
272
        break;
273
    }
274
}
275
 
276
switch ($foo) {
277
case 1:
278
    switch ($bar) {
279
        default:
280
        if ($something) {
281
            echo $string{1};
282
        } else if ($else) {
283
            switch ($else) {
284
                default:
285
            }
286
        }
287
    }
288
    break;
289
}
290
 
291
switch ($name) {
292
case "1":
293
case "2":
294
case "3":
295
    return true;
296
}
297
 
298
switch ($name) {
299
case "1":
300
case "2":
301
case "3":
302
default :
303
    return true;
304
}
305
 
306
?>