r77813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77812‎ | r77813 | r77814 >
Date:16:56, 5 December 2010
Author:ialex
Status:ok
Tags:
Comment:
Removed trailing whitespaces
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -53,12 +53,12 @@
5454 static $mKnownFileClassesDefault = array();
5555 static $mKnownFunctionsDefault = array();
5656 static $mConstantsDefault = array();
57 -
 57+
5858 # Ignore constants with these prefixes:
5959 static $constantIgnorePrefixes = array( "PGSQL_", "OCI_", "SQLT_BLOB", "DB2_", "XMLREADER_", "SQLSRV_" );
6060 # Ignore functions with these prefixes:
6161 static $functionIgnorePrefixes = array( "pg_", "oci_", "db2_", "gmp_", "sqlsrv_", "exif_", "fss_", "tidy_",
62 - "apc_", "eaccelerator_", "xcache_", "wincache_", "apache_", "xdiff_", "wikidiff2_", "parsekit_",
 62+ "apc_", "eaccelerator_", "xcache_", "wincache_", "apache_", "xdiff_", "wikidiff2_", "parsekit_",
6363 "wddx_", "setproctitle", "utf8_", "normalizer_", "dba_", "pcntl_", "finfo_", "mime_content_type",
6464 # GD and images functions:
6565 "imagecreatetruecolor", "imagecolorallocate", "imagecolortransparent", "imagealphablending",
@@ -72,7 +72,7 @@
7373 'addslashes' => 'Replace with Database::addQuotes/strencode',
7474 'mysql_escape_string' => 'Replace with Database::addQuotes/strencode',
7575 );
76 -
 76+
7777 protected $generateDeprecatedList = false;
7878
7979 /* Values for status */
@@ -100,12 +100,12 @@
101101 if ( count( $this->mTokens ) > 0 ) {
102102 $globals = array (
103103 '$wgArticle', # Setup.php
104 - '$wgAutoloadLocalClasses', # AutoLoader.php, a couple of readers
 104+ '$wgAutoloadLocalClasses', # AutoLoader.php, a couple of readers
105105 '$wgCanonicalNamespaceNames', # Namespace.php
106106 '$wgContLang', # Setup.php
107107 '$wgDeferredUpdateList', # Setup.php
108108 '$wgExtModifiedFields', '$wgExtNewFields', '$wgExtNewIndexes', '$wgExtNewTables', # Updates
109 - '$wgFeedClasses', # Defines.php, many uses
 109+ '$wgFeedClasses', # Defines.php, many uses
110110 '$wgLang', # Setup.php
111111 '$wgLanguageNames', # Language.php, read by others
112112 '$wgMemc', # Setup.php
@@ -204,12 +204,12 @@
205205 'FILEINFO_MIME', 'FILEINFO_MIME_TYPE', 'MHASH_ADLER32',
206206 'SIGTERM', 'SIG_DFL',
207207 'SVN_REVISION_HEAD', 'SVN_REVISION_INITIAL',
208 - ) ;
 208+ ) ;
209209 }
210 -
 210+
211211 function load( $file, $shortcircuit = true ) {
212212 $this->initVars();
213 - $this->mFilename = $file;
 213+ $this->mFilename = $file;
214214
215215 $source = file_get_contents( $file );
216216 if ( substr( $source, 0, 3 ) == "\xEF\xBB\xBF" ) {
@@ -294,12 +294,12 @@
295295 $this->mClass = $token[1];
296296 $this->mParent = null;
297297 }
298 -
 298+
299299 if ( $token[0] == '}' ) {
300300 $this->mClass = null;
301301 $this->mParent = null;
302302 }
303 -
 303+
304304 if ( ( $lastMeaningfulToken[0] == T_EXTENDS ) && ( $token[0] == T_STRING ) ) {
305305 $this->checkClassName( $token );
306306 $this->mParent = $token[1];
@@ -310,7 +310,7 @@
311311 $requirePath = "";
312312 continue;
313313 }
314 -
 314+
315315 if ( $token[0] != T_FUNCTION )
316316 continue;
317317 $this->mStatus = self::IN_FUNCTION_NAME;
@@ -359,7 +359,7 @@
360360 $this->mBraces--;
361361 if ( $this->mInSwitch <= $this->mBraces )
362362 $this->mInSwitch = 0;
363 -
 363+
364364 $this->purgeGlobals();
365365 if ( ! $this->mBraces ) {
366366 $this->mStatus = self::WAITING_FUNCTION;
@@ -503,7 +503,7 @@
504504 case self::IN_FUNCTION_REQUIRE:
505505 if ( $token == ';' ) {
506506 $requirePath = trim( $requirePath, ')("' );
507 -
 507+
508508 if ( substr( $requirePath, 0, 8 ) == "PHPUnit/" ) {
509509 $this->mStatus = $this->mStatus - self::IN_REQUIRE_WAITING;
510510 continue;
@@ -524,7 +524,7 @@
525525 $this->mStatus = $this->mStatus - self::IN_REQUIRE_WAITING;
526526 continue;
527527 }
528 -
 528+
529529 if ( ( $requirePath == '' ) || ( !file_exists( $requirePath ) && $requirePath[0] != '/' ) ) {
530530 /* Try prepending the script folder, for maintenance scripts (but see Maintenance.php:758) */
531531 $requirePath = dirname( $this->mFilename ) . "/" . $requirePath;
@@ -552,10 +552,10 @@
553553 $this->mStatus = $this->mStatus - self::IN_REQUIRE_WAITING;
554554 continue;
555555 }
556 -
 556+
557557 if ( $token[0] == T_WHITESPACE )
558558 continue;
559 -
 559+
560560 if ( $token[0] == T_STRING_VARNAME ) {
561561 $token[0] = T_VARIABLE;
562562 $token[1] = '$' . $token[1];
@@ -604,7 +604,7 @@
605605 $requirePath .= $token[1];
606606 }
607607 continue;
608 -
 608+
609609 }
610610 }
611611
@@ -614,10 +614,10 @@
615615
616616 function checkDeprecation( $token ) {
617617 global $mwDeprecatedFunctions;
618 -
619 - if ( $mwDeprecatedFunctions && !in_array( self::FUNCTION_DEPRECATED, $this->mFunctionQualifiers ) &&
 618+
 619+ if ( $mwDeprecatedFunctions && !in_array( self::FUNCTION_DEPRECATED, $this->mFunctionQualifiers ) &&
620620 isset( $mwDeprecatedFunctions[ $token[1] ] ) ) {
621 -
 621+
622622 if ( isset( $token['class'] ) ) {
623623 if ( in_array( $token['class'], $mwDeprecatedFunctions[ $token[1] ] ) ) {
624624 $this->warning( "Non deprecated function $this->mFunction calls deprecated function {$token['class']}::{$token[1]} in line {$token[2]}" );
@@ -628,11 +628,11 @@
629629 }
630630 }
631631 }
632 -
 632+
633633 function checkFunctionName( $token, $warn = 'defer' ) {
634634 if ( !isset( $token['base'] ) ) {
635635 // Local function
636 -
 636+
637637 if ( substr( $token[1], 0, 2 ) == 'wf' ) {
638638 // MediaWiki function
639639 // TODO: List them.
@@ -641,30 +641,30 @@
642642 if ( $token[1] == 'dieout' && in_array( $this->mFunction, array( 'setup_database', 'initial_setup', 'setup_plpgsql' ) ) ) {
643643 return;
644644 }
645 -
 645+
646646 if ( isset( self::$poisonedFunctions[ strtolower($token[1]) ] ) ) {
647647 $this->warning( "Poisoned function {$token[1]} called from {$this->mFunction} in line {$token[2]}: " . self::$poisonedFunctions[strtolower($token[1])] );
648648 return;
649649 }
650 -
 650+
651651 if ( function_exists( $token[1] ) ) {
652652 return;
653653 }
654654 if ( in_array( $token[1], $this->mKnownFunctions ) ) {
655655 return;
656656 }
657 -
 657+
658658 if ( self::inIgnoreList( $token[1], self::$functionIgnorePrefixes ) ) {
659659 return;
660660 }
661 -
 661+
662662 if ( $warn == 'now' ) {
663663 $this->warning( "Unavailable function {$token[1]} in line {$token[2]}" );
664664 } else if ( $warn == 'defer' ) {
665665 // Defer to the end of the file
666666 $this->mUnknownFunctions[] = $token;
667667 }
668 -
 668+
669669 }
670670 }
671671
@@ -674,7 +674,7 @@
675675 }
676676 $this->mUnknownFunctions = array();
677677 }
678 -
 678+
679679 /* Returns a class name, or null if it couldn't guess */
680680 function guessClassName( $token ) {
681681 static $wellKnownVars = array(
@@ -691,7 +691,7 @@
692692 '$sk' => 'Skin',
693693 '$wgMemc' => 'MWMemcached',
694694 );
695 -
 695+
696696 if ( $token[0] == T_VARIABLE ) {
697697 if ( isset( $wellKnownVars[ $token[1] ] ) ) {
698698 return $wellKnownVars[ $token[1] ];
@@ -704,9 +704,9 @@
705705 return $this->mClass;
706706 if ( ( $token[1] == 'parent' ) && !isset( $token['base'] ) )
707707 return $this->getParentName( $token );
708 -
 708+
709709 $name = $token[1];
710 -
 710+
711711 if ( $token[1][0] == 'm' ) // member
712712 $name = substr( $token[1], 1 );
713713 } else {
@@ -766,7 +766,7 @@
767767 /* Skip the error about $site and $lang in Maintenance.php */
768768 return true;
769769 }
770 -
 770+
771771 return false;
772772 }
773773
@@ -812,7 +812,7 @@
813813 }
814814
815815 /**
816 - * Returns a
 816+ * Returns a
817817 * @param $token Token holding the class name
818818 * @param $warn A value from 'no', 'defer', 'now¡
819819 * @return mixed The class name if it is found, false otherwise
@@ -860,7 +860,7 @@
861861 }
862862 return false;
863863 }
864 -
 864+
865865 function getParentName( $token ) {
866866 if ( !is_null( $this->mParent ) ) {
867867 return $this->mParent;
@@ -868,17 +868,17 @@
869869 $this->warning( "Use of parent in orphan class {$this->mClass} in line $token[2]" );
870870 return "-";
871871 }
872 -
 872+
873873 /**
874 - * Sets a number of files which are considered as having always been
875 - * loaded before any loaded one. Any functions/classes defined there
 874+ * Sets a number of files which are considered as having always been
 875+ * loaded before any loaded one. Any functions/classes defined there
876876 * will be assumed to be available.
877877 */
878878 function preloadFiles( $files ) {
879879 $this->initVars();
880880 $this->mFilename = '__preload';
881881 $this->mTokens = array( T_OPEN_TAG, '<?php', 0 );
882 -
 882+
883883 for ( $i = 1; $i <= count( $files ); $i++ ) {
884884 $this->mTokens[] = array( T_REQUIRE, 'require', $i );
885885 $this->mTokens[] = array( T_CONSTANT_ENCAPSED_STRING, "'" . $files[$i - 1] . "'", $i );

Status & tagging log