r75139 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75138‎ | r75139 | r75140 >
Date:09:43, 21 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Removal of old style parameter definitions
Modified paths:
  • /trunk/extensions/Validator/includes/Validator.php (modified) (history)
  • /trunk/extensions/Validator/includes/parserHooks/Validator_ListErrors.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/parserHooks/Validator_ListErrors.php
@@ -66,19 +66,18 @@
6767 *
6868 * @since 0.4
6969 *
70 - * @return array
 70+ * @return array of Parameter
7171 */
7272 protected function getParameterInfo( $type ) {
7373 global $egValidatorErrListMin;
7474
75 - return array(
76 - 'minseverity' => array(
77 - 'criteria' => array(
78 - 'in_array' => array_keys( self::$severityMap )
79 - ),
80 - 'default' => $egValidatorErrListMin
81 - )
82 - );
 75+ $params = array();
 76+
 77+ $params['minseverity'] = new Parameter( 'minseverity' );
 78+ $params['minseverity']->setDefault( $egValidatorErrListMin );
 79+ $params['minseverity']->addCriteria( new CriterionInArray( array_keys( self::$severityMap ) ) );
 80+
 81+ return $params;
8382 }
8483
8584 /**
Index: trunk/extensions/Validator/includes/Validator.php
@@ -209,7 +209,7 @@
210210 $cleanedList[$parameter->getName()] = $parameter;
211211 }
212212 else {
213 - $cleanedList[$key] = Parameter::newFromArray( $key, $parameter );
 213+ throw new Exception( "$key is not a valid Parameter." );
214214 }
215215 }
216216

Status & tagging log