-
Notifications
You must be signed in to change notification settings - Fork 0
/
Identity.php
40 lines (34 loc) · 921 Bytes
/
Identity.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
<?php
/**
* @author: Julien Mercier-Rojas <[email protected]>
* Created at: 15/06/2020
*/
namespace JeckelLab\Contract\Domain\Identity;
use JeckelLab\Contract\Domain\Equality;
use JeckelLab\Contract\Domain\Identity\Exception\InvalidIdException;
use JsonSerializable;
use Stringable;
/**
* Interface Identity
* @package JeckelLab\Contract\Domain\Identity
* @psalm-immutable
* @template IdentityType of int|string|Stringable
*/
interface Identity extends Equality, Stringable, JsonSerializable
{
/**
* @return static
*/
public static function new(): static;
/**
* @param int|string|Stringable $identity
* @return static
* @throws InvalidIdException
*/
public static function from(int|string|Stringable $identity): static;
/**
* @return int|string|Stringable
* @psalm-return IdentityType
*/
public function id(): int|string|Stringable;
}