Page MenuHomePhabricator

PageUpdater should support fluent interface
Closed, ResolvedPublic

Description

PageUpdater is a builder for page update operation. Since this operation is very complex, PageUpdater has a lot of setters. It should support fluent interface so that instead of

$updater = $page->newPageUpdater();
$updater->setFlags( $flags );
$updater->setOriginalRevisionId( $rev );
$update = $updater->prepareUpdate();

we could do

$update = $page->newPageUpdater()
  ->setFlags( $flags )
  ->setOriginalRevisionId( $rev )
  ->prepareUpdate()

In order for PageUpdater to become fluent, all setters need to start returning $this.
We do not need to update all the callers to benefit from it, maybe see in core if there's any obvious cases

Event Timeline

Change 708774 had a related patch set uploaded (by TChin; author: TChin):

[mediawiki/core@master] Support fluent interface for PageUpdater

https://gerrit.wikimedia.org/r/708774

Change 708774 merged by jenkins-bot:

[mediawiki/core@master] Support fluent interface for PageUpdater

https://gerrit.wikimedia.org/r/708774