WatchedItemStore: Use callable type hint instead of Assert library
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 28 May 2016 02:30:14 +0000 (19:30 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 28 May 2016 02:30:14 +0000 (19:30 -0700)
And remove an unused use statement.

Change-Id: Idb74a564088744d73f71f5ef17e8f84f6e484c69

includes/WatchedItemStore.php

index 6486955..515fbfc 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 
 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
-use MediaWiki\MediaWikiServices;
 use MediaWiki\Linker\LinkTarget;
 use Wikimedia\Assert\Assert;
 
@@ -81,14 +80,12 @@ class WatchedItemStore implements StatsdAwareInterface {
         * @return ScopedCallback to reset the overridden value
         * @throws MWException
         */
-       public function overrideDeferredUpdatesAddCallableUpdateCallback( $callback ) {
+       public function overrideDeferredUpdatesAddCallableUpdateCallback( callable $callback ) {
                if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
                        throw new MWException(
                                'Cannot override DeferredUpdates::addCallableUpdate callback in operation.'
                        );
                }
-               Assert::parameterType( 'callable', $callback, '$callback' );
-
                $previousValue = $this->deferredUpdatesAddCallableUpdateCallback;
                $this->deferredUpdatesAddCallableUpdateCallback = $callback;
                return new ScopedCallback( function() use ( $previousValue ) {
@@ -106,14 +103,12 @@ class WatchedItemStore implements StatsdAwareInterface {
         * @return ScopedCallback to reset the overridden value
         * @throws MWException
         */
-       public function overrideRevisionGetTimestampFromIdCallback( $callback ) {
+       public function overrideRevisionGetTimestampFromIdCallback( callable $callback ) {
                if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
                        throw new MWException(
                                'Cannot override Revision::getTimestampFromId callback in operation.'
                        );
                }
-               Assert::parameterType( 'callable', $callback, '$callback' );
-
                $previousValue = $this->revisionGetTimestampFromIdCallback;
                $this->revisionGetTimestampFromIdCallback = $callback;
                return new ScopedCallback( function() use ( $previousValue ) {