Invalidate specific decls before IDE queries
[hiphop-php.git] / hphp / hack / hhi / traits.hhi
blob3c47c881383978929264af692ea76d38905228c1
1 <?hh
2 /**
3  * Copyright (c) 2014, Facebook, Inc.
4  * All rights reserved.
5  *
6  * This source code is licensed under the MIT license found in the
7  * LICENSE file in the "hack" directory of this source tree.
8  *
9  */
11 /**
12  * This file provides type information for some of PHP's predefined interfaces
13  *
14  * YOU SHOULD NEVER INCLUDE THIS FILE ANYWHERE!!!
15  */
17 trait StrictIterable<+Tv> implements Iterable<Tv> {
19   /* HH_IGNORE_ERROR[2082] T30260145 */
20   public function toArray(): array;
22   public function toValuesArray(): varray<Tv>;
24   /* HH_FIXME[4120]: While this violates our variance annotations, we are
25    * returning a copy of the underlying collection, so it is actually safe
26    * See #6853603. */
27   public function toVector(): Vector<Tv>;
29   public function toImmVector(): ImmVector<Tv>;
31   /* HH_FIXME[4120]: While this violates our variance annotations, we are
32    * returning a copy of the underlying collection, so it is actually safe
33    * See #6853603. */
35   public function toSet(): Set<Tv> where Tv as arraykey;
37   public function toImmSet(): ImmSet<Tv> where Tv as arraykey;
39   public function lazy(): Iterable<Tv>;
41   public function values(): Iterable<Tv>;
43   public function map<Tu>((function(Tv): Tu) $callback): Iterable<Tu>;
45   public function filter((function(Tv): bool) $callback): Iterable<Tv>;
47   public function zip<Tu>(Traversable<Tu> $traversable): Iterable<Pair<Tv,Tu>>;
49   public function take(int $n): Iterable<Tv>;
51   public function takeWhile((function(Tv): bool) $n): Iterable<Tv>;
53   public function skip(int $n): Iterable<Tv>;
55   public function skipWhile((function(Tv): bool) $n): Iterable<Tv>;
57   public function slice(int $start, int $len): Iterable<Tv>;
59   public function concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>;
61   public function firstValue(): ?Tv;
63   public function lastValue(): ?Tv;
68 trait StrictKeyedIterable<Tk,+Tv> implements KeyedIterable<Tk,Tv> {
69   /* HH_IGNORE_ERROR[2082] T30260145 */
70   public function toArray(): array;
72   public function toValuesArray(): varray<Tv>;
74   public function toKeysArray(): varray<Tk>;
76   /* HH_FIXME[4120]: While this violates our variance annotations, we are
77    * returning a copy of the underlying collection, so it is actually safe
78    * See #6853603. */
79   public function toVector(): Vector<Tv>;
81   public function toImmVector(): ImmVector<Tv>;
83   /* HH_FIXME[4120]: While this violates our variance annotations, we are
84    * returning a copy of the underlying collection, so it is actually safe
85    * See #6853603. */
86   public function toMap(): Map<Tk, Tv> where Tk as arraykey;
88   public function toImmMap(): ImmMap<Tk, Tv> where Tk as arraykey;
90   /* HH_FIXME[4120]: While this violates our variance annotations, we are
91    * returning a copy of the underlying collection, so it is actually safe
92    * See #6853603. */
93   public function toSet(): Set<Tv> where Tv as arraykey;
95   public function toImmSet(): ImmSet<Tv> where Tv as arraykey;
97   public function lazy(): KeyedIterable<Tk,Tv>;
99   public function values(): Iterable<Tv>;
101   public function keys(): Iterable<Tk>;
103   public function map<Tu>((function(Tv): Tu) $callback): KeyedIterable<Tk,Tu>;
105   public function mapWithKey<Tu>(
106     (function(Tk,Tv): Tu) $callback
107   ): KeyedIterable<Tk,Tu>;
109   public function filter((function(Tv): bool) $callback): KeyedIterable<Tk,Tv>;
111   public function filterWithKey(
112     (function(Tk,Tv): bool) $callback
113   ): KeyedIterable<Tk,Tv>;
115   public function zip<Tu>(
116     Traversable<Tu> $traversable
117   ): KeyedIterable<Tk,Pair<Tv,Tu>>;
119   public function take(int $n): KeyedIterable<Tk, Tv>;
121   public function takeWhile((function(Tv): bool) $n): KeyedIterable<Tk, Tv>;
123   public function skip(int $n): KeyedIterable<Tk, Tv>;
125   public function skipWhile((function(Tv): bool) $n): KeyedIterable<Tk, Tv>;
127   public function slice(int $start, int $len): KeyedIterable<Tk, Tv>;
129   public function concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>;
131   public function firstValue(): ?Tv;
133   public function firstKey(): ?Tk;
135   public function lastValue(): ?Tv;
137   public function lastKey(): ?Tk;
142 trait LazyIterable<+Tv> implements Iterable<Tv> {
143   /* HH_IGNORE_ERROR[2082] T30260145 */
144   public function toArray(): array;
146   public function toValuesArray(): varray<Tv>;
148   /* HH_FIXME[4120]: While this violates our variance annotations, we are
149    * returning a copy of the underlying collection, so it is actually safe
150    * See #6853603. */
151   public function toVector(): Vector<Tv>;
153   public function toImmVector(): ImmVector<Tv>;
155   /* HH_FIXME[4120]: While this violates our variance annotations, we are
156    * returning a copy of the underlying collection, so it is actually safe
157    * See #6853603. */
158   public function toSet(): Set<Tv> where Tv as arraykey;
160   public function toImmSet(): ImmSet<Tv> where Tv as arraykey;
162   public function lazy(): Iterable<Tv>;
164   public function values(): Iterable<Tv>;
166   public function map<Tu>((function(Tv): Tu) $callback): Iterable<Tu>;
168   public function filter((function(Tv): bool) $callback): Iterable<Tv>;
170   public function zip<Tu>(Traversable<Tu> $traversable): Iterable<Pair<Tv,Tu>>;
172   public function take(int $n): Iterable<Tv>;
174   public function takeWhile((function(Tv): bool) $n): Iterable<Tv>;
176   public function skip(int $n): Iterable<Tv>;
178   public function skipWhile((function(Tv): bool) $n): Iterable<Tv>;
180   public function slice(int $start, int $len): Iterable<Tv>;
182   public function concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>;
184   public function firstValue(): ?Tv;
186   public function lastValue(): ?Tv;
191 trait LazyKeyedIterable<Tk,+Tv> implements KeyedIterable<Tk,Tv> {
192   /* HH_IGNORE_ERROR[2082] T30260145 */
193   public function toArray(): array;
195   public function toValuesArray(): varray<Tv>;
197   public function toKeysArray(): varray<Tk>;
199   /* HH_FIXME[4120]: While this violates our variance annotations, we are
200    * returning a copy of the underlying collection, so it is actually safe
201    * See #6853603. */
202   public function toVector(): Vector<Tv>;
204   public function toImmVector(): ImmVector<Tv>;
206   /* HH_FIXME[4120]: While this violates our variance annotations, we are
207    * returning a copy of the underlying collection, so it is actually safe
208    * See #6853603. */
210   public function toMap(): Map<Tk, Tv> where Tk as arraykey;
212   public function toImmMap(): ImmMap<Tk, Tv> where Tk as arraykey;
214   /* HH_FIXME[4120]: While this violates our variance annotations, we are
215    * returning a copy of the underlying collection, so it is actually safe
216    * See #6853603. */
218   public function toSet(): Set<Tv> where Tv as arraykey;
220   public function toImmSet(): ImmSet<Tv> where Tv as arraykey;
222   public function lazy(): KeyedIterable<Tk,Tv>;
224   public function values(): Iterable<Tv>;
226   public function keys(): Iterable<Tk>;
228   public function map<Tu>((function(Tv): Tu) $callback): KeyedIterable<Tk,Tu>;
230   public function mapWithKey<Tu>(
231     (function(Tk,Tv): Tu) $callback
232   ): KeyedIterable<Tk,Tu>;
234   public function filter((function(Tv): bool) $callback): KeyedIterable<Tk,Tv>;
236   public function filterWithKey(
237     (function(Tk,Tv): bool) $callback
238   ): KeyedIterable<Tk,Tv>;
240   public function zip<Tu>(
241     Traversable<Tu> $traversable
242   ): KeyedIterable<Tk,Pair<Tv,Tu>>;
244   public function take(int $n): KeyedIterable<Tk, Tv>;
246   public function takeWhile((function(Tv): bool) $n): KeyedIterable<Tk, Tv>;
248   public function skip(int $n): KeyedIterable<Tk, Tv>;
250   public function skipWhile((function(Tv): bool) $n): KeyedIterable<Tk, Tv>;
252   public function slice(int $start, int $len): KeyedIterable<Tk, Tv>;
254   public function concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>;
256   public function firstValue(): ?Tv;
258   public function firstKey(): ?Tk;
260   public function lastValue(): ?Tv;
262   public function lastKey(): ?Tk;