diff --git a/includes/AbuseFilter.php b/includes/AbuseFilter.php index 49fb4727c..ddc0f1d67 100644 --- a/includes/AbuseFilter.php +++ b/includes/AbuseFilter.php @@ -1572,12 +1572,17 @@ class AbuseFilter { /** * @deprecated Use VariableGenerator::addEditVars * @param Title $title - * @param Page|null $page + * @param WikiPage|\Article|null $page * @return AbuseFilterVariableHolder */ - public static function getEditVars( Title $title, Page $page = null ) { + public static function getEditVars( Title $title, object $page = null ) { + if ( $page !== null && !$page instanceof WikiPage ) { + $page = $page->getPage(); + } + $vars = new AbuseFilterVariableHolder(); $generator = new VariableGenerator( $vars ); + return $generator->addEditVars( $title, $page )->getVariableHolder(); } diff --git a/includes/VariableGenerator/VariableGenerator.php b/includes/VariableGenerator/VariableGenerator.php index 457c39932..f227ddfd5 100644 --- a/includes/VariableGenerator/VariableGenerator.php +++ b/includes/VariableGenerator/VariableGenerator.php @@ -4,7 +4,6 @@ namespace MediaWiki\Extension\AbuseFilter\VariableGenerator; use AbuseFilterVariableHolder; use Hooks; -use Page; use RCDatabaseLogEntry; use Title; use User; @@ -154,10 +153,10 @@ class VariableGenerator { /** * @param Title $title - * @param Page|null $page + * @param WikiPage|null $page * @return $this For chaining */ - public function addEditVars( Title $title, Page $page = null ) : self { + public function addEditVars( Title $title, WikiPage $page = null ) : self { // NOTE: $page may end up remaining null, e.g. if $title points to a special page. if ( !$page && $title->canExist() ) { // TODO: The caller should do this!