- /**
- * Fetches next search result, or false.
- * @deprecated since 1.32; Use self::extractResults() or foreach
- * @return SearchResult|false
- */
- public function next() {
- wfDeprecated( __METHOD__, '1.32' );
- $it = $this->bcIterator();
- $searchResult = $it->current();
- $it->next();
- return $searchResult ?? false;
- }
-
- /**
- * Rewind result set back to beginning
- * @deprecated since 1.32; Use self::extractResults() or foreach
- */
- public function rewind() {
- wfDeprecated( __METHOD__, '1.32' );
- $this->bcIterator()->rewind();
- }
-
- private function bcIterator() {
- if ( $this->bcIterator === null ) {
- $this->bcIterator = 'RECURSION';
- $this->bcIterator = $this->getIterator();
- } elseif ( $this->bcIterator === 'RECURSION' ) {
- // Either next/rewind or extractResults must be implemented. This
- // class was potentially instantiated directly. It should be
- // abstract with abstract methods to enforce this but that's a
- // breaking change...
- wfDeprecated( static::class . ' without implementing extractResults', '1.32' );
- $this->bcIterator = new ArrayIterator( [] );
- }
- return $this->bcIterator;
- }
-
- /**
- * Frees the result set, if applicable.
- */
- function free() {
- // ...
- }
-