r77515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77514‎ | r77515 | r77516 >
Date:00:11, 1 December 2010
Author:platonides
Status:deferred (Comments)
Tags:
Comment:
Do not take class members as known functions, so that it catches errors like the one fixed in r77497.
Added guessing for $wgMemc
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -184,8 +184,9 @@
185185
186186 $this->mStatus = self::WAITING_FUNCTION;
187187 $this->mFunctionQualifiers = array();
 188+ $this->mClass = null;
 189+ $this->mParent = null;
188190
189 -
190191 // Predefine constant that might not be defined by this file source code
191192 $this->mConstants = array( 'PARSEKIT_SIMPLE', 'UNORM_NFC', # Extensions
192193 /* Defined in Title.php and GlobalFunctions.php */
@@ -286,6 +287,12 @@
287288 $this->mClass = $token[1];
288289 $this->mParent = null;
289290 }
 291+
 292+ if ( $token[0] == '}' ) {
 293+ $this->mClass = null;
 294+ $this->mParent = null;
 295+ }
 296+
290297 if ( ( $lastMeaningfulToken[0] == T_EXTENDS ) && ( $token[0] == T_STRING ) ) {
291298 $this->checkClassName( $token );
292299 $this->mParent = $token[1];
@@ -312,7 +319,7 @@
313320 $this->mInSwitch = 0;
314321 $this->mFunctionGlobals = array();
315322 $currentToken[0] = self::FUNCTION_DEFINITION;
316 - $this->mKnownFunctions[] = $this->mFunction;
 323+ $this->mKnownFunctions[] = $this->mClass ? $this->mClass . "::" . $this->mFunction : $this->mFunction;
317324
318325 if ( $this->generateDeprecatedList && in_array( self::FUNCTION_DEPRECATED, $this->mFunctionQualifiers ) ) {
319326 if ( ( substr( $this->mFunction, 0, 2 ) != "__" ) ) {
@@ -674,7 +681,8 @@
675682 '$wgMessageCache' => 'MessageCache',
676683 '$wgLang' => 'Language', '$wgContLang' => 'Language',
677684 '$dbw' => 'Database', '$dbr' => 'Database',
678 - '$sk' => 'Skin'
 685+ '$sk' => 'Skin',
 686+ '$wgMemc' => 'MWMemcached',
679687 );
680688
681689 if ( $token[0] == T_VARIABLE ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r77518Follow DatabaseBase rename, per r77515 CR.platonides00:33, 1 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77497qualify call to array_to_obj...reedy18:52, 30 November 2010

Comments

#Comment by 😂 (talk | contribs)   00:18, 1 December 2010

Not a fault of this commit, I just noticed it in the diff.

'$dbw' => 'Database', '$dbr' => 'Database',

Should those be DatabaseBase, since it was renamed?

#Comment by Platonides (talk | contribs)   00:33, 1 December 2010

Yes. Fixed in r77518.

Status & tagging log