Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59383


Change subject: Replace incorrectly used asserts by exceptions
......................................................................

Replace incorrectly used asserts by exceptions

Change-Id: I52a5853eb86be4e6a10e3ec2d3b10915e00e0597
---
M ValueParsers/includes/ValueParserFactory.php
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/83/59383/1

diff --git a/ValueParsers/includes/ValueParserFactory.php 
b/ValueParsers/includes/ValueParserFactory.php
index 23c28fc..480d0de 100644
--- a/ValueParsers/includes/ValueParserFactory.php
+++ b/ValueParsers/includes/ValueParserFactory.php
@@ -2,6 +2,8 @@
 
 namespace ValueParsers;
 
+use InvalidArgumentException;
+
 /**
  * Factory for creating ValueParser objects.
  *
@@ -46,8 +48,13 @@
         */
        public function __construct( array $valueParsers ) {
                foreach ( $valueParsers as $parserId => $parserClass ) {
-                       assert( is_string( $parserId ) );
-                       assert( is_string( $parserClass ) );
+                       if ( !is_string( $parserId ) ) {
+                               throw new InvalidArgumentException( 'Parser id 
needs to be a string' );
+                       }
+
+                       if ( !is_string( $parserClass ) ) {
+                               throw new InvalidArgumentException( 'Parser 
class needs to be a string' );
+                       }
 
                        $this->parsers[$parserId] = $parserClass;
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/59383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52a5853eb86be4e6a10e3ec2d3b10915e00e0597
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to