Skip to content

Commit

Permalink
Add CachingIterator stub
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jun 23, 2022
1 parent e15f8f7 commit 9496feb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ parameters:
- NoRewindIterator
- LimitIterator
- InfiniteIterator
- CachingIterator
explicitMixedInUnknownGenericNew: false
explicitMixedForGlobalVariables: false
explicitMixedViaIsArray: false
Expand Down
35 changes: 35 additions & 0 deletions stubs/iterable.stub
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,38 @@ class InfiniteIterator extends IteratorIterator {
*/
public function key() {}
}

/**
* @template TKey
* @template TValue
* @template TIterator as Iterator<TKey, TValue>
*
* @template-implements OuterIterator<TKey, TValue>
* @template-implements ArrayAccess<TKey, TValue>
*
* @template-extends IteratorIterator<TKey, TValue, TIterator>
*/
class CachingIterator extends IteratorIterator implements OuterIterator, ArrayAccess, Countable {
const CALL_TOSTRING = 1 ;
const CATCH_GET_CHILD = 16 ;
const TOSTRING_USE_KEY = 2 ;
const TOSTRING_USE_CURRENT = 4 ;
const TOSTRING_USE_INNER = 8 ;
const FULL_CACHE = 256 ;

/**
* @param TIterator $iterator
* @param int-mask-of<self::*> $flags
*/
public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {}

/**
* @return TValue
*/
public function current() {}

/**
* @return TKey
*/
public function key() {}
}

0 comments on commit 9496feb

Please sign in to comment.