diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/libs/MapCacheLRU.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/libs/MapCacheLRU.php')
-rw-r--r-- | includes/libs/MapCacheLRU.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/includes/libs/MapCacheLRU.php b/includes/libs/MapCacheLRU.php index 0b6db32e..a0230bee 100644 --- a/includes/libs/MapCacheLRU.php +++ b/includes/libs/MapCacheLRU.php @@ -20,6 +20,7 @@ * @file * @ingroup Cache */ +use Wikimedia\Assert\Assert; /** * Handles a simple LRU key/value map with a maximum number of entries @@ -41,9 +42,9 @@ class MapCacheLRU { * @throws Exception When $maxCacheKeys is not an int or =< 0. */ public function __construct( $maxKeys ) { - if ( !is_int( $maxKeys ) || $maxKeys < 1 ) { - throw new Exception( __METHOD__ . " must be given an integer and >= 1" ); - } + Assert::parameterType( 'integer', $maxKeys, '$maxKeys' ); + Assert::parameter( $maxKeys >= 1, '$maxKeys', 'must be >= 1' ); + $this->maxCacheKeys = $maxKeys; } |