From: jeroendedauw Date: Mon, 27 Aug 2012 11:34:02 +0000 (+0200) Subject: use InvalidArgumentException rather then Exception X-Git-Tag: 1.31.0-rc.0~22589^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=11d290fe7bd308b7b10f06c0d6554e33bcedb39c;p=lhc%2Fweb%2Fwiklou.git use InvalidArgumentException rather then Exception Change-Id: Ie744c773b316278e4a92af28354a8fe4eb83b78f --- diff --git a/includes/libs/GenericArrayObject.php b/includes/libs/GenericArrayObject.php index d4cc5253db..b4b9d6108a 100644 --- a/includes/libs/GenericArrayObject.php +++ b/includes/libs/GenericArrayObject.php @@ -142,11 +142,11 @@ abstract class GenericArrayObject extends ArrayObject { * @param mixed $index * @param mixed $value * - * @throws Exception + * @throws InvalidArgumentException */ protected function setElement( $index, $value ) { if ( !$this->hasValidType( $value ) ) { - throw new Exception( + throw new InvalidArgumentException( 'Can only add ' . $this->getObjectType() . ' implementing objects to ' . get_called_class() . '.' ); } diff --git a/tests/phpunit/includes/libs/GenericArrayObjectTest.php b/tests/phpunit/includes/libs/GenericArrayObjectTest.php index bf3ff3cd2b..8a2fb55971 100644 --- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php +++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php @@ -170,7 +170,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { call_user_func( $function, $list, $element ); $valid = true; } - catch ( Exception $exception ) { + catch ( InvalidArgumentException $exception ) { $valid = false; }