From: Kunal Mehta Date: Wed, 21 Sep 2016 06:00:54 +0000 (-0700) Subject: Avoid Wikimedia\Assert in HashBagOStuff X-Git-Tag: 1.31.0-rc.0~5428 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=d2fd3109a34f1e619e901f8494eb1e2c25d57a0e;p=lhc%2Fweb%2Fwiklou.git Avoid Wikimedia\Assert in HashBagOStuff This is the only usage of wikimedia/assert in the planned objectcache library, so it doesn't make much sense to have a dependency upon the entire library just for one usage that is trivially replaced. Change-Id: I8f967fb2b861852c7fc74f7d42e2cbab1df05bc4 --- diff --git a/includes/libs/objectcache/HashBagOStuff.php b/includes/libs/objectcache/HashBagOStuff.php index e03cec6a2f..baa3c32c6a 100644 --- a/includes/libs/objectcache/HashBagOStuff.php +++ b/includes/libs/objectcache/HashBagOStuff.php @@ -20,7 +20,6 @@ * @file * @ingroup Cache */ -use Wikimedia\Assert\Assert; /** * Simple store for keeping values in an associative array for the current process. @@ -46,7 +45,9 @@ class HashBagOStuff extends BagOStuff { parent::__construct( $params ); $this->maxCacheKeys = isset( $params['maxKeys'] ) ? $params['maxKeys'] : INF; - Assert::parameter( $this->maxCacheKeys > 0, 'maxKeys', 'must be above zero' ); + if ( $this->maxCacheKeys <= 0 ) { + throw new InvalidArgumentException( '$maxKeys parameter must be above zero' ); + } } protected function expire( $key ) {