HTMLCheckMatrix: Create the exceptions to be thrown directly
authorPlatonides <platonides@gmail.com>
Tue, 4 Jun 2013 21:54:20 +0000 (23:54 +0200)
committerMatmarex <matma.rex@gmail.com>
Sun, 30 Jun 2013 21:14:18 +0000 (21:14 +0000)
Instead of using a function to create itself. Just like it's done
everywhere else in the code.

Change-Id: Ib080a3eb2fc2c173f8bf07289beb976824447357

includes/HTMLForm.php

index 33e447e..5af081b 100644 (file)
@@ -1887,7 +1887,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
        public function __construct( $params ) {
                $missing = array_diff( self::$requiredParams, array_keys( $params ) );
                if ( $missing ) {
-                       throw HTMLFormFieldRequiredOptionsException::create( $this, $missing );
+                       throw new HTMLFormFieldRequiredOptionsException( $this, $missing );
                }
                parent::__construct( $params );
        }
@@ -2803,8 +2803,8 @@ interface HTMLNestedFilterable {
 }
 
 class HTMLFormFieldRequiredOptionsException extends MWException {
-       static public function create( HTMLFormField $field, array $missing ) {
-               return new self( sprintf(
+       public function __construct( HTMLFormField $field, array $missing ) {
+               parent::__construct( sprintf(
                        "Form type `%s` expected the following parameters to be set: %s",
                        get_class( $field ),
                        implode( ', ', $missing )