Index: trunk/tools/code-utils/check-vars.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * Checks a number of syntax conventions on variables from a valid PHP file. |
6 | 6 | * |
7 | 7 | * Run as: |
8 | | - * find phase3/ \( -name \*.php -or -name \*.inc \) -not \( -name importUseModWiki.php -o -name diffLanguage.php -o -name LocalSettings.php \) -exec php tools/code-utils/check-vars.php \{\} + |
| 8 | + * find phase3/ \( -name \*.php -or -name \*.inc \) -not \( -name importUseModWiki.php -o -name diffLanguage.php -o -name LocalSettings.php -o -name Parser?????.php \) -exec php tools/code-utils/check-vars.php \{\} + |
9 | 9 | */ |
10 | 10 | |
11 | 11 | require_once( dirname( __FILE__ ) . "/../../phase3/includes/Defines.php" ); # Faster than parsing |
— | — | @@ -77,12 +77,9 @@ |
78 | 78 | '$wgAutoloadLocalClasses', # AutoLoader.php, a couple of readers |
79 | 79 | '$wgCanonicalNamespaceNames', # Namespace.php |
80 | 80 | '$wgContLang', # Setup.php |
81 | | - '$wgContLanguageCode', # Should probably be removed |
82 | | - '$wgDBcataloged', # http://www.mediawiki.org/wiki/Special:Code/MediaWiki/45755#c7954 |
83 | 81 | '$wgDeferredUpdateList', # Setup.php |
84 | 82 | '$wgExtModifiedFields', '$wgExtNewFields', '$wgExtNewIndexes', '$wgExtNewTables', # Updates |
85 | 83 | '$wgFeedClasses', # Defines.php, many uses |
86 | | - '$wgIP', # Setup.php |
87 | 84 | '$wgLang', # Setup.php |
88 | 85 | '$wgLanguageNames', # Language.php, read by others |
89 | 86 | '$wgMemc', # Setup.php |
— | — | @@ -122,7 +119,11 @@ |
123 | 120 | '$wgHtmlEntities' => array( 'Sanitizer.php' ), |
124 | 121 | '$wgHtmlEntityAliases' => array( 'Sanitizer.php' ), |
125 | 122 | '$wgFullyInitialised' => array( /* Set */ 'Setup.php', /* read */ 'Exception.php' ), |
| 123 | + '$wgContLanguageCode' => array( 'Setup.php' ), |
126 | 124 | '$wgUseLatin1' => array( 'FiveUpgrade.inc' ), # If you upgrade from MW < 1.5 it will be there |
| 125 | + '$wgDatabase' => array( 'DatabaseUpdater.php' ), |
| 126 | + '$wgExtPGNewFields' => array( 'DatabaseUpdater.php', 'PostgresUpdater.php' ), |
| 127 | + '$wgExtPGAlteredFields' => array( 'DatabaseUpdater.php', 'PostgresUpdater.php' ), |
127 | 128 | '$errs' => array( 'Installer.php' ), |
128 | 129 | '$mainListOpened' => array( 'Installer.php' ), |
129 | 130 | '$optionsWithArgs' => array( 'commandLine.inc' ), |
— | — | @@ -194,8 +195,17 @@ |
195 | 196 | |
196 | 197 | if ( $lastMeaningfulToken[0] == T_OPEN_TAG && $token[0] == T_OPEN_TAG ) { |
197 | 198 | # See r69767 |
198 | | - $this->warning( "$token[1] in line $token[2] after $lastMeaningfulToken[1] in line $lastMeaningfulToken[2]" ); |
| 199 | + $this->warning( "{$token[1]} in line {$token[2]} after {$lastMeaningfulToken[1]} in line {$lastMeaningfulToken[2]}" ); |
199 | 200 | } |
| 201 | + if ( $token == ';' ) { |
| 202 | + if ( $lastMeaningfulToken == ';' ) { |
| 203 | + # See r72751, warn on ;; |
| 204 | + $this->warning( "Empty statement" ); |
| 205 | + } elseif ( $lastMeaningfulToken[0] == T_FOR ) { |
| 206 | + # But not on infinte for loops: for ( ; ; ) |
| 207 | + $currentToken = array(';', ';', $lastMeaningfulToken[2] ); |
| 208 | + } |
| 209 | + } |
200 | 210 | |
201 | 211 | if ( $lastMeaningfulToken[0] == T_DECLARE && $token[0] == T_STRING ) { |
202 | 212 | $currentToken[0] = T_WHITESPACE; # Ignore the ticks or encoding |