+ /**
+ * A guess for {{REVISIONID}}, calculated using the callback provided via
+ * setSpeculativeRevIdCallback(). For consistency, the value will be calculated upon the
+ * first call of this method, and re-used for subsequent calls.
+ *
+ * If no callback was defined via setSpeculativeRevIdCallback(), this method will return false.
+ *
+ * @since 1.32
+ * @return int|false
+ */
+ public function getSpeculativeRevId() {
+ return $this->getOption( 'speculativeRevId' );
+ }
+
+ /**
+ * Callback registered with ParserOptions::$lazyOptions, triggered by getSpeculativeRevId().
+ *
+ * @param ParserOptions $popt
+ * @return bool|false
+ */
+ private static function initSpeculativeRevId( ParserOptions $popt ) {
+ $cb = $popt->getOption( 'speculativeRevIdCallback' );
+ $id = $cb ? $cb() : null;
+
+ // returning null would result in this being re-called every access
+ return $id ?? false;
+ }
+