Index: trunk/phase3/maintenance/checkSyntax.php |
— | — | @@ -275,7 +275,9 @@ |
276 | 276 | } |
277 | 277 | |
278 | 278 | $text = file_get_contents( $file ); |
| 279 | + $tokens = token_get_all( $text ); |
279 | 280 | |
| 281 | + $this->checkEvilToken( $file, $tokens, '@', 'Error supression operator (@)'); |
280 | 282 | $this->checkRegex( $file, $text, '/^[\s\r\n]+<\?/', 'leading whitespace' ); |
281 | 283 | $this->checkRegex( $file, $text, '/\?>[\s\r\n]*$/', 'trailing ?>' ); |
282 | 284 | $this->checkRegex( $file, $text, '/^[\xFF\xFE\xEF]/', 'byte-order mark' ); |
— | — | @@ -292,6 +294,18 @@ |
293 | 295 | $this->mWarnings[$file][] = $desc; |
294 | 296 | $this->output( "Warning in file $file: $desc found.\n" ); |
295 | 297 | } |
| 298 | + |
| 299 | + private function checkEvilToken( $file, $tokens, $evilToken, $desc ) { |
| 300 | + if ( !in_array( $evilToken, $tokens ) ) { |
| 301 | + return; |
| 302 | + } |
| 303 | + |
| 304 | + if ( !isset( $this->mWarnings[$file] ) ) { |
| 305 | + $this->mWarnings[$file] = array(); |
| 306 | + } |
| 307 | + $this->mWarnings[$file][] = $desc; |
| 308 | + $this->output( "Warning in file $file: $desc found.\n" ); |
| 309 | + } |
296 | 310 | } |
297 | 311 | |
298 | 312 | $maintClass = "CheckSyntax"; |