-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEquatableInterface.php
More file actions
31 lines (27 loc) · 810 Bytes
/
EquatableInterface.php
File metadata and controls
31 lines (27 loc) · 810 Bytes
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
<?php
declare(strict_types=1);
namespace SonsOfPHP\Contract\Common;
use InvalidArgumentException;
use RuntimeException;
/**
* Equatable Interface is used for objects that can be checked to see if they
* are equal to each other.
*
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface EquatableInterface
{
/**
* Checks object to see if it is equal to another object.
*
* @param bool $strict
* When true, this MUST compare objects using === and when false objects
* MUST be compared using ==
*
* @throws InvalidArgumentException
* If $other is unexpected type
* @throws RuntimeException
* When it cannot be determined if the objects are equal to each other
*/
public function equals(mixed $other, bool $strict = true): bool;
}