Index: trunk/tools/code-utils/check-vars.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | 'session_unregister' => 'Deprecated since PHP 5.3.0.', |
99 | 99 | 'session_is_registered' => 'Deprecated since PHP 5.3.0.', |
100 | 100 | 'set_magic_quotes_runtime' => 'Deprecated since PHP 5.3.0.', |
101 | | - |
| 101 | + |
102 | 102 | 'var_dump' => 'Debugging function.', //r81671#c13996 |
103 | 103 | //'print_r' => 'Debugging function if second parameter is not true.', |
104 | 104 | 'wfVarDump' => 'Debugging function.', //var_export() wrapper |
— | — | @@ -239,9 +239,11 @@ |
240 | 240 | function setGenerateDeprecatedList( $bool = true ) { |
241 | 241 | $this->generateDeprecatedList = $bool; |
242 | 242 | } |
| 243 | + |
243 | 244 | function getGenerateDeprecatedList() { |
244 | 245 | return $this->generateDeprecatedList; |
245 | 246 | } |
| 247 | + |
246 | 248 | function saveDeprecatedList( $filename ) { |
247 | 249 | $data = "<?php\n\$mwDeprecatedFunctions = array(\n"; |
248 | 250 | foreach( $this->mDeprecatedFunctionList as $depre => $classes ) { |
— | — | @@ -254,9 +256,11 @@ |
255 | 257 | function setGenerateParentList( $bool = true ) { |
256 | 258 | $this->generateParentList = $bool; |
257 | 259 | } |
| 260 | + |
258 | 261 | function getGenerateParentList() { |
259 | 262 | return $this->generateParentList; |
260 | 263 | } |
| 264 | + |
261 | 265 | function saveParentList( $filename ) { |
262 | 266 | global $mwParentClasses; |
263 | 267 | $data = "<?php\n\$mwParentClasses = array(\n"; |
— | — | @@ -266,7 +270,7 @@ |
267 | 271 | $data .= "\n);\n\n"; |
268 | 272 | file_put_contents( $filename, $data ); |
269 | 273 | } |
270 | | - |
| 274 | + |
271 | 275 | private function initVars() { |
272 | 276 | $this->mProblemCount = 0; |
273 | 277 | |
— | — | @@ -314,7 +318,7 @@ |
315 | 319 | |
316 | 320 | /* Skip HipHop specific requires */ |
317 | 321 | $source = preg_replace( '/if \( isset\( \$_SERVER\[\'MW_COMPILED\'\] \) \) {\\s+require \( \'phase3\/.*\' \);\\s+} else {/', 'if ( true ) {', $source ); |
318 | | - |
| 322 | + |
319 | 323 | $this->mTokens = token_get_all( $source ); |
320 | 324 | } |
321 | 325 | |
— | — | @@ -370,7 +374,7 @@ |
371 | 375 | $this->mFunctionQualifiers = array(); |
372 | 376 | |
373 | 377 | if ( $token[0] == T_COMMENT ) { |
374 | | - if ( substr( $token[1], 0, 2 ) == '/*' && substr( $token[1], 0, 3 ) != '/**' |
| 378 | + if ( substr( $token[1], 0, 2 ) == '/*' && substr( $token[1], 0, 3 ) != '/**' |
375 | 379 | && preg_match( '/^\s+\*(?!\/)/m', $token[1] ) && strpos( $token[1], "\$separatorTransformTable = array( ',' => '' )" ) === false ) { |
376 | 380 | $this->warning( 'missed-docblock', "Multiline comment with /* in line $token[2]" ); |
377 | 381 | } |
— | — | @@ -470,7 +474,7 @@ |
471 | 475 | if ( $this->mInProfilingFunction && $this->mAfterProfileOut & 1 ) { |
472 | 476 | $this->warning( 'profileout', "Reached end of $this->mClass::$this->mFunction with last statement not being wfProfileOut" ); |
473 | 477 | } |
474 | | - |
| 478 | + |
475 | 479 | $this->mStatus = self::WAITING_FUNCTION; |
476 | 480 | $this->mFunctionQualifiers = array(); |
477 | 481 | } |
— | — | @@ -560,7 +564,7 @@ |
561 | 565 | // throw Exception; -> Exception is a constant |
562 | 566 | // throw Exception("Foo"); -> Exception() is a function |
563 | 567 | // throw new Exception("Foo"); -> Exception is a class. |
564 | | - |
| 568 | + |
565 | 569 | $this->warning( 'function-throw', "Not using new when throwing token {$token[1]} in line $token[2], function {$this->mFunction}" ); |
566 | 570 | } |
567 | 571 | } |
— | — | @@ -692,7 +696,7 @@ |
693 | 697 | /* Try prepending the script folder, for maintenance scripts (but see Maintenance.php:758) */ |
694 | 698 | $requirePath = dirname( $this->mFilename ) . "/" . $requirePath; |
695 | 699 | } |
696 | | - |
| 700 | + |
697 | 701 | if ( !file_exists( $requirePath ) ) { |
698 | 702 | if ( strpos( $requirePath, '$' ) === false ) { |
699 | 703 | $this->warning( 'missing-requires', "Did not found the expected require of $requirePath" ); |
— | — | @@ -1081,7 +1085,7 @@ |
1082 | 1086 | die ( |
1083 | 1087 | "Usage: |
1084 | 1088 | php $argv[0] [options] <PHP_source_file1> <PHP_source_file2> ... |
1085 | | - |
| 1089 | + |
1086 | 1090 | Options: |
1087 | 1091 | --generate-deprecated-list |
1088 | 1092 | --generate-parent-list |
— | — | @@ -1120,7 +1124,7 @@ |
1121 | 1125 | foreach ( $argv as $arg ) { |
1122 | 1126 | if ( substr( $arg, 0, 2 ) == '-W' ) |
1123 | 1127 | continue; |
1124 | | - |
| 1128 | + |
1125 | 1129 | $cv->load( $arg ); |
1126 | 1130 | $cv->execute(); |
1127 | 1131 | } |