Show Vector/Map/Set doc comments when hovering over literals
[hiphop-php.git] / hphp / hack / test / hover / map_literal.php.exp
blobb15d7f1c763f674cb26f2d8e521ee42d38a26cdb
1 final class Map
2 `Map` is an ordered dictionary-style collection. HHVM provides a native
3 implementation for this class. The PHP class definition below is not
4 actually used at run time; it is simply provided for the typechecker and for
5 developer reference.
7 Like all objects in PHP, `Map`s have reference-like semantics. When a caller
8 passes a `Map` to a callee, the callee can modify the `Map` and the caller
9 will see the changes. `Map`s do not have "copy-on-write" semantics.
11 `Map`s preserve insertion order of key/value pairs. When iterating over a
12 `Map`, the key/value pairs appear in the order they were inserted. Also,
13 `Map`s do not automagically convert integer-like `string` keys (ex. `"123"`)
14 into integer keys.
16 `Map`s only support `int` keys and `string` keys. If a key of a different
17 type is used, an exception will be thrown.
19 `Map`s support `$m[$k]` style syntax for getting and setting values by key.
20 `Map`s also support `isset($m[$k])` and `empty($m[$k])` syntax, and they
21 provide similar semantics as arrays. Adding an element with square bracket
22 syntax `[]` is supported either by providing a key between the brackets or
23 a `Pair` on the right-hand side. e.g.,
24 `$m[$k] = $v` is supported
25 `$m[] = Pair {$k, $v}` is supported
26 `$m[] = $v` is not supported.
28 `Map`s do not support iterating while new keys are being added or elements
29 are being removed. When a new key is added or an element is removed, all
30 iterators that point to the `Map` shall be considered invalid.
32 @guide /hack/collections/introduction
33 @guide /hack/collections/classes