From 11d290fe7bd308b7b10f06c0d6554e33bcedb39c Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Mon, 27 Aug 2012 13:34:02 +0200 Subject: [PATCH] use InvalidArgumentException rather then Exception Change-Id: Ie744c773b316278e4a92af28354a8fe4eb83b78f --- includes/libs/GenericArrayObject.php | 4 ++-- tests/phpunit/includes/libs/GenericArrayObjectTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.20.1