spl_iterators.stub.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <?php
  2. /** @generate-class-entries */
  3. class EmptyIterator implements Iterator
  4. {
  5. /** @tentative-return-type */
  6. public function current(): never {}
  7. /** @tentative-return-type */
  8. public function next(): void {}
  9. /** @tentative-return-type */
  10. public function key(): never {}
  11. /** @tentative-return-type */
  12. public function valid(): bool {}
  13. /** @tentative-return-type */
  14. public function rewind(): void {}
  15. }
  16. class CallbackFilterIterator extends FilterIterator
  17. {
  18. public function __construct(Iterator $iterator, callable $callback) {}
  19. /** @tentative-return-type */
  20. public function accept(): bool {}
  21. }
  22. class RecursiveCallbackFilterIterator extends CallbackFilterIterator implements RecursiveIterator
  23. {
  24. public function __construct(RecursiveIterator $iterator, callable $callback) {}
  25. /**
  26. * @tentative-return-type
  27. * @implementation-alias RecursiveFilterIterator::hasChildren
  28. */
  29. public function hasChildren(): bool {}
  30. /** @tentative-return-type */
  31. public function getChildren(): RecursiveCallbackFilterIterator {}
  32. }
  33. interface RecursiveIterator extends Iterator
  34. {
  35. /** @tentative-return-type */
  36. public function hasChildren(): bool;
  37. /** @tentative-return-type */
  38. public function getChildren(): ?RecursiveIterator;
  39. }
  40. class RecursiveIteratorIterator implements OuterIterator
  41. {
  42. public function __construct(Traversable $iterator, int $mode = RecursiveIteratorIterator::LEAVES_ONLY, int $flags = 0) {}
  43. /** @tentative-return-type */
  44. public function rewind(): void {}
  45. /** @tentative-return-type */
  46. public function valid(): bool {}
  47. /** @tentative-return-type */
  48. public function key(): mixed {}
  49. /** @tentative-return-type */
  50. public function current(): mixed {}
  51. /** @tentative-return-type */
  52. public function next(): void {}
  53. /** @tentative-return-type */
  54. public function getDepth(): int {}
  55. /** @tentative-return-type */
  56. public function getSubIterator(?int $level = null): ?RecursiveIterator {}
  57. /** @tentative-return-type */
  58. public function getInnerIterator(): RecursiveIterator {}
  59. /** @tentative-return-type */
  60. public function beginIteration(): void {}
  61. /** @tentative-return-type */
  62. public function endIteration(): void {}
  63. /** @tentative-return-type */
  64. public function callHasChildren(): bool {}
  65. /** @tentative-return-type */
  66. public function callGetChildren(): ?RecursiveIterator {}
  67. /** @tentative-return-type */
  68. public function beginChildren(): void {}
  69. /** @tentative-return-type */
  70. public function endChildren(): void {}
  71. /** @tentative-return-type */
  72. public function nextElement(): void {}
  73. /** @tentative-return-type */
  74. public function setMaxDepth(int $maxDepth = -1): void {}
  75. /** @tentative-return-type */
  76. public function getMaxDepth(): int|false {}
  77. }
  78. interface OuterIterator extends Iterator
  79. {
  80. /** @tentative-return-type */
  81. public function getInnerIterator(): ?Iterator;
  82. }
  83. class IteratorIterator implements OuterIterator
  84. {
  85. public function __construct(Traversable $iterator, ?string $class = null) {}
  86. /** @tentative-return-type */
  87. public function getInnerIterator(): ?Iterator {}
  88. /** @tentative-return-type */
  89. public function rewind(): void {}
  90. /** @tentative-return-type */
  91. public function valid(): bool {}
  92. /** @tentative-return-type */
  93. public function key(): mixed {}
  94. /** @tentative-return-type */
  95. public function current(): mixed {}
  96. /** @tentative-return-type */
  97. public function next(): void {}
  98. }
  99. abstract class FilterIterator extends IteratorIterator
  100. {
  101. /** @tentative-return-type */
  102. abstract public function accept(): bool;
  103. public function __construct(Iterator $iterator) {}
  104. /** @tentative-return-type */
  105. public function rewind(): void {}
  106. /** @tentative-return-type */
  107. public function next(): void {}
  108. }
  109. abstract class RecursiveFilterIterator extends FilterIterator implements RecursiveIterator
  110. {
  111. public function __construct(RecursiveIterator $iterator) {}
  112. /** @tentative-return-type */
  113. public function hasChildren(): bool {}
  114. /** @tentative-return-type */
  115. public function getChildren(): ?RecursiveFilterIterator {}
  116. }
  117. class ParentIterator extends RecursiveFilterIterator
  118. {
  119. public function __construct(RecursiveIterator $iterator) {}
  120. /**
  121. * @tentative-return-type
  122. * @implementation-alias RecursiveFilterIterator::hasChildren
  123. */
  124. public function accept(): bool {}
  125. }
  126. interface SeekableIterator extends Iterator
  127. {
  128. /** @tentative-return-type */
  129. public function seek(int $offset): void;
  130. }
  131. class LimitIterator extends IteratorIterator
  132. {
  133. public function __construct(Iterator $iterator, int $offset = 0, int $limit = -1) {}
  134. /** @tentative-return-type */
  135. public function rewind(): void {}
  136. /** @tentative-return-type */
  137. public function valid(): bool {}
  138. /** @tentative-return-type */
  139. public function next(): void {}
  140. /** @tentative-return-type */
  141. public function seek(int $offset): int {}
  142. /** @tentative-return-type */
  143. public function getPosition(): int {}
  144. }
  145. class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable
  146. {
  147. public function __construct(Iterator $iterator, int $flags = CachingIterator::CALL_TOSTRING) {}
  148. /** @tentative-return-type */
  149. public function rewind(): void {}
  150. /** @tentative-return-type */
  151. public function valid(): bool {}
  152. /** @tentative-return-type */
  153. public function next(): void {}
  154. /** @tentative-return-type */
  155. public function hasNext(): bool {}
  156. public function __toString(): string {}
  157. /** @tentative-return-type */
  158. public function getFlags(): int {}
  159. /** @tentative-return-type */
  160. public function setFlags(int $flags): void {}
  161. /**
  162. * @param string $key
  163. * @tentative-return-type
  164. */
  165. public function offsetGet($key): mixed {}
  166. /**
  167. * @param string $key
  168. * @tentative-return-type
  169. */
  170. public function offsetSet($key, mixed $value): void {}
  171. /**
  172. * @param string $key
  173. * @tentative-return-type
  174. */
  175. public function offsetUnset($key): void {}
  176. /**
  177. * @param string $key
  178. * @tentative-return-type
  179. */
  180. public function offsetExists($key): bool {}
  181. /** @tentative-return-type */
  182. public function getCache(): array {}
  183. /** @tentative-return-type */
  184. public function count(): int {}
  185. }
  186. class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator
  187. {
  188. public function __construct(Iterator $iterator, int $flags = RecursiveCachingIterator::CALL_TOSTRING) {}
  189. /** @tentative-return-type */
  190. public function hasChildren(): bool {}
  191. /** @tentative-return-type */
  192. public function getChildren(): ?RecursiveCachingIterator {}
  193. }
  194. class NoRewindIterator extends IteratorIterator
  195. {
  196. public function __construct(Iterator $iterator) {}
  197. /** @tentative-return-type */
  198. public function rewind(): void {}
  199. /** @tentative-return-type */
  200. public function valid(): bool {}
  201. /** @tentative-return-type */
  202. public function key(): mixed {}
  203. /** @tentative-return-type */
  204. public function current(): mixed {}
  205. /** @tentative-return-type */
  206. public function next(): void {}
  207. }
  208. class AppendIterator extends IteratorIterator
  209. {
  210. public function __construct() {}
  211. /** @tentative-return-type */
  212. public function append(Iterator $iterator): void {}
  213. /** @tentative-return-type */
  214. public function rewind(): void {}
  215. /** @tentative-return-type */
  216. public function valid(): bool {}
  217. /** @tentative-return-type */
  218. public function current(): mixed {}
  219. /** @tentative-return-type */
  220. public function next(): void {}
  221. /** @tentative-return-type */
  222. public function getIteratorIndex(): ?int {}
  223. /** @tentative-return-type */
  224. public function getArrayIterator(): ArrayIterator {}
  225. }
  226. class InfiniteIterator extends IteratorIterator
  227. {
  228. public function __construct(Iterator $iterator) {}
  229. /** @tentative-return-type */
  230. public function next(): void {}
  231. }
  232. class RegexIterator extends FilterIterator
  233. {
  234. public ?string $replacement = null;
  235. public function __construct(Iterator $iterator, string $pattern, int $mode = RegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
  236. /** @tentative-return-type */
  237. public function accept(): bool {}
  238. /** @tentative-return-type */
  239. public function getMode(): int {}
  240. /** @tentative-return-type */
  241. public function setMode(int $mode): void {}
  242. /** @tentative-return-type */
  243. public function getFlags(): int {}
  244. /** @tentative-return-type */
  245. public function setFlags(int $flags): void {}
  246. /** @tentative-return-type */
  247. public function getRegex(): string {}
  248. /** @tentative-return-type */
  249. public function getPregFlags(): int {}
  250. /** @tentative-return-type */
  251. public function setPregFlags(int $pregFlags): void {}
  252. }
  253. class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
  254. {
  255. public function __construct(RecursiveIterator $iterator, string $pattern, int $mode = RecursiveRegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
  256. /** @tentative-return-type */
  257. public function accept(): bool {}
  258. /**
  259. * @tentative-return-type
  260. * @implementation-alias RecursiveFilterIterator::hasChildren
  261. */
  262. public function hasChildren(): bool {}
  263. /** @tentative-return-type */
  264. public function getChildren(): RecursiveRegexIterator {}
  265. }
  266. class RecursiveTreeIterator extends RecursiveIteratorIterator
  267. {
  268. /** @param RecursiveIterator|IteratorAggregate $iterator */
  269. public function __construct(
  270. $iterator,
  271. int $flags = RecursiveTreeIterator::BYPASS_KEY,
  272. int $cachingIteratorFlags = CachingIterator::CATCH_GET_CHILD,
  273. int $mode = RecursiveTreeIterator::SELF_FIRST
  274. ) {}
  275. /** @tentative-return-type */
  276. public function key(): mixed {}
  277. /** @tentative-return-type */
  278. public function current(): mixed {}
  279. /** @tentative-return-type */
  280. public function getPrefix(): string {}
  281. /** @tentative-return-type */
  282. public function setPostfix(string $postfix): void {}
  283. /** @tentative-return-type */
  284. public function setPrefixPart(int $part, string $value): void {}
  285. /** @tentative-return-type */
  286. public function getEntry(): string {}
  287. /** @tentative-return-type */
  288. public function getPostfix(): string {}
  289. }