r90250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90249‎ | r90250 | r90251 >
Date:00:06, 17 June 2011
Author:reedy
Status:ok
Tags:
Comment:
Fix case statement fall through

Fix "text" being used as a constant rather than $text

Fix some indenting

Remove some unused variables
Modified paths:
  • /trunk/extensions/Validator/includes/ParameterInput.php (modified) (history)
  • /trunk/extensions/Validator/includes/ParserHook.php (modified) (history)
  • /trunk/extensions/Validator/includes/TopologicalSort.php (modified) (history)
  • /trunk/extensions/Validator/includes/criteria/CriterionInArray.php (modified) (history)
  • /trunk/extensions/Validator/includes/parserHooks/Validator_Describe.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/ParameterInput.php
@@ -92,7 +92,6 @@
9393 * @return string
9494 */
9595 public function getHtml() {
96 - $html = '';
9796 $valueList = array();
9897
9998 foreach ( $this->param->getCriteria() as $criterion ) {
@@ -115,6 +114,7 @@
116115 break;
117116 case Parameter::TYPE_BOOLEAN:
118117 $html = $this->getBooleanInput();
 118+ break;
119119 case Parameter::TYPE_STRING:
120120 default:
121121 $html = $this->getStrInput();
Index: trunk/extensions/Validator/includes/parserHooks/Validator_Describe.php
@@ -349,6 +349,8 @@
350350 foreach ( $parameters as $parameter ) {
351351 $tableRows[] = $this->getDescriptionRow( $parameter, $defaults );
352352 }
 353+
 354+ $table = '';
353355
354356 if ( count( $tableRows ) > 0 ) {
355357 $tableRows = array_merge( array(
@@ -360,17 +362,17 @@
361363 '!' . wfMsg( 'validator-describe-header-description' )
362364 ), $tableRows );
363365
364 - $table = implode( "\n|-\n", $tableRows );
365 -
366 - $h3 =
367 - ( $pre ? '=== ' : '<h3>' ) .
368 - wfMsg( 'validator-describe-parameters' ) .
369 - ( $pre ? ' ===' : '</h3>' );
370 -
371 - $table = "$h3\n\n" .
372 - '{| class="wikitable sortable"' . "\n" .
373 - $table .
374 - "\n|}";
 366+ $table = implode( "\n|-\n", $tableRows );
 367+
 368+ $h3 =
 369+ ( $pre ? '=== ' : '<h3>' ) .
 370+ wfMsg( 'validator-describe-parameters' ) .
 371+ ( $pre ? ' ===' : '</h3>' );
 372+
 373+ $table = "$h3\n\n" .
 374+ '{| class="wikitable sortable"' . "\n" .
 375+ $table .
 376+ "\n|}";
375377 }
376378
377379 return $table;
Index: trunk/extensions/Validator/includes/criteria/CriterionInArray.php
@@ -89,8 +89,7 @@
9090 */
9191 protected function getItemErrorMessage( Parameter $parameter ) {
9292 global $wgLang;
93 -
94 - $values = $parameter->getValue();
 93+
9594 $originalCount = count( $this->allowedValues );
9695
9796 if ( $originalCount > 15 ) {
@@ -123,10 +122,9 @@
124123 */
125124 protected function getFullListErrorMessage( Parameter $parameter ) {
126125 global $wgLang;
127 -
128 - $values = $parameter->getValue();
 126+
129127 $originalCount = count( $this->allowedValues );
130 -
 128+
131129 if ( $originalCount > 15 ) {
132130 $allowedValues = array_slice( $this->allowedValues, 0, 13 );
133131 $omitCount = $originalCount - count( $allowedValues );
Index: trunk/extensions/Validator/includes/ParserHook.php
@@ -273,8 +273,6 @@
274274 * @return string
275275 */
276276 public function validateAndRender( array $arguments, $type ) {
277 - global $egValidatorErrorLevel;
278 -
279277 $names = $this->getNames();
280278 $this->validator = new Validator( $names[0] );
281279
@@ -468,7 +466,7 @@
469467 // Parse the wikitext to HTML.
470468 if ( $this->isFunction() ) {
471469 return $this->parser->parse(
472 - text,
 470+ $text,
473471 $this->parser->mTitle,
474472 $this->parser->mOptions,
475473 true,
Index: trunk/extensions/Validator/includes/TopologicalSort.php
@@ -36,7 +36,7 @@
3737 }
3838
3939 // turn pairs into double-linked node tree
40 - foreach ( $dependencies as $key => $dpair ) {
 40+ foreach ( $dependencies as $dpair ) {
4141 list ( $module, $dependency ) = each ( $dpair );
4242 if ( !isset( $this->mNodes[$module] ) ) $this->mNodes[$module] = new TSNode( $module );
4343 if ( !isset( $this->mNodes[$dependency] ) ) $this->mNodes[$dependency] = new TSNode( $dependency );

Status & tagging log