From 645207653ba9f21eda7c9668cc33701c98eefdd4 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 10 Jul 2018 12:10:34 -0700 Subject: [PATCH] Replace redundant Assert calls with native typehint * 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 | 1 - includes/changes/CategoryMembershipChange.php | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/Storage/PageUpdater.php b/includes/Storage/PageUpdater.php index 67928f9c15..c6795ea83a 100644 --- a/includes/Storage/PageUpdater.php +++ b/includes/Storage/PageUpdater.php @@ -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!' ); diff --git a/includes/changes/CategoryMembershipChange.php b/includes/changes/CategoryMembershipChange.php index e745203329..f1e61bbb4c 100644 --- a/includes/changes/CategoryMembershipChange.php +++ b/includes/changes/CategoryMembershipChange.php @@ -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; } -- 2.20.1