Replace redundant Assert calls with native typehint
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 10 Jul 2018 19:10:34 +0000 (12:10 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 10 Jul 2018 19:31:13 +0000 (19:31 +0000)
* PageUpdater: Plain class type hints never needed Assert,
  not sure why that was here.

* CategoryMembershipChange: The 'callable' typehint was introduced
  in PHP 5.4.

Change-Id: I958bd63a7f9edec3a297f34fe43339fac5f43006

includes/Storage/PageUpdater.php
includes/changes/CategoryMembershipChange.php

index 67928f9..c6795ea 100644 (file)
@@ -615,7 +615,6 @@ class PageUpdater {
                // Defend against mistakes caused by differences with the
                // signature of WikiPage::doEditContent.
                Assert::parameterType( 'integer', $flags, '$flags' );
-               Assert::parameterType( 'CommentStoreComment', $summary, '$summary' );
 
                if ( $this->wasCommitted() ) {
                        throw new RuntimeException( 'saveRevision() has already been called on this PageUpdater!' );
index e745203..f1e61bb 100644 (file)
@@ -23,8 +23,6 @@
  * @since 1.27
  */
 
-use Wikimedia\Assert\Assert;
-
 class CategoryMembershipChange {
 
        const CATEGORY_ADDITION = 1;
@@ -83,11 +81,10 @@ class CategoryMembershipChange {
         *
         * @throws MWException
         */
-       public function overrideNewForCategorizationCallback( $callback ) {
+       public function overrideNewForCategorizationCallback( callable $callback ) {
                if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
                        throw new MWException( 'Cannot override newForCategorization callback in operation.' );
                }
-               Assert::parameterType( 'callable', $callback, '$callback' );
                $this->newForCategorizationCallback = $callback;
        }