X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchanges%2FCategoryMembershipChange.php;h=f1e61bbb4c86fa579a8d88a5d812305fc1841a62;hb=3ef209ce1019c3000f7349941cfd55484d71a653;hp=6fa6907007f1f3f22e181d7d388980dec3ddff83;hpb=587d08c5a626f8195def9f82ee83e17c85824db8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/CategoryMembershipChange.php b/includes/changes/CategoryMembershipChange.php index 6fa6907007..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; @@ -59,7 +57,7 @@ class CategoryMembershipChange { /** * @param Title $pageTitle Title instance of the categorized page - * @param Revision $revision Latest Revision instance of the categorized page + * @param Revision|null $revision Latest Revision instance of the categorized page * * @throws MWException */ @@ -71,7 +69,7 @@ class CategoryMembershipChange { $this->timestamp = $revision->getTimestamp(); } $this->revision = $revision; - $this->newForCategorizationCallback = [ 'RecentChange', 'newForCategorization' ]; + $this->newForCategorizationCallback = [ RecentChange::class, 'newForCategorization' ]; } /** @@ -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; } @@ -142,7 +139,7 @@ class CategoryMembershipChange { /** * @param string $timestamp Timestamp of the recent change to occur in TS_MW format * @param Title $categoryTitle Title of the category a page is being added to or removed from - * @param User $user User object of the user that made the change + * @param User|null $user User object of the user that made the change * @param string $comment Change summary * @param Title $pageTitle Title of the page that is being added or removed * @param string $lastTimestamp Parent revision timestamp of this change in TS_MW format @@ -187,22 +184,19 @@ class CategoryMembershipChange { } /** @var RecentChange $rc */ - $rc = call_user_func_array( - $this->newForCategorizationCallback, - [ - $timestamp, - $categoryTitle, - $user, - $comment, - $pageTitle, - $lastRevId, - $newRevId, - $lastTimestamp, - $bot, - $ip, - $deleted, - $added - ] + $rc = ( $this->newForCategorizationCallback )( + $timestamp, + $categoryTitle, + $user, + $comment, + $pageTitle, + $lastRevId, + $newRevId, + $lastTimestamp, + $bot, + $ip, + $deleted, + $added ); $rc->save(); }