forked from azjezz/psl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexAccessInterface.php
47 lines (42 loc) · 950 Bytes
/
IndexAccessInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
namespace Psl\Collection;
/**
* The interface for all keyed collections to enable access its values.
*
* @template Tk of array-key
* @template Tv
*/
interface IndexAccessInterface
{
/**
* Returns the value at the specified key in the current collection.
*
* @param Tk $k
*
* @throws Exception\OutOfBoundsException If $k is out-of-bounds.
*
* @return Tv
*
* @psalm-mutation-free
*/
public function at(string|int $k): mixed;
/**
* Determines if the specified key is in the current collection.
*
* @param Tk $k
*
* @psalm-mutation-free
*/
public function contains(int|string $k): bool;
/**
* Returns the value at the specified key in the current collection.
*
* @param Tk $k
*
* @return Tv|null
*
* @psalm-mutation-free
*/
public function get(string|int $k): mixed;
}