summaryrefslogtreecommitdiff
path: root/includes/libs/ProcessCacheLRU.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/libs/ProcessCacheLRU.php')
-rw-r--r--includes/libs/ProcessCacheLRU.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/includes/libs/ProcessCacheLRU.php b/includes/libs/ProcessCacheLRU.php
index 8d80eb38..b55ff9da 100644
--- a/includes/libs/ProcessCacheLRU.php
+++ b/includes/libs/ProcessCacheLRU.php
@@ -20,6 +20,7 @@
* @file
* @ingroup Cache
*/
+use Wikimedia\Assert\Assert;
/**
* Handles per process caching of items
@@ -128,9 +129,9 @@ class ProcessCacheLRU {
* @throws UnexpectedValueException
*/
public function resize( $maxKeys ) {
- if ( !is_int( $maxKeys ) || $maxKeys < 1 ) {
- throw new UnexpectedValueException( __METHOD__ . " must be given an integer >= 1" );
- }
+ Assert::parameterType( 'integer', $maxKeys, '$maxKeys' );
+ Assert::parameter( $maxKeys >= 1, '$maxKeys', 'must be >= 1' );
+
$this->maxCacheKeys = $maxKeys;
while ( count( $this->cache ) > $this->maxCacheKeys ) {
reset( $this->cache );