- if ( !is_object( $revision ) ) {
- $revid = $revision;
- // This code path is deprecated, and nothing is known to
- // use it, so performance here shouldn't be a worry.
- if ( $revid !== null ) {
- wfDeprecated( __METHOD__ . ' with $revision = revision ID', '1.25' );
- $store = $this->getRevisionStore();
- $revision = $store->getRevisionById( $revid, Revision::READ_LATEST );
- } else {
- $revision = null;
+ if ( $revision !== null ) {
+ if ( $revision instanceof Revision ) {
+ $revision = $revision->getRevisionRecord();
+ } elseif ( !( $revision instanceof RevisionRecord ) ) {
+ throw new InvalidArgumentException(
+ __METHOD__ . ': invalid $revision argument type ' . gettype( $revision ) );