| @@ 1674-1682 (lines=9) @@ | ||
| 1671 | * |
|
| 1672 | * @throws InvalidArgumentException |
|
| 1673 | */ |
|
| 1674 | public static function keyExists($array, $key, $message = '') |
|
| 1675 | { |
|
| 1676 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1677 | static::reportInvalidArgument(\sprintf( |
|
| 1678 | $message ?: 'Expected the key %s to exist.', |
|
| 1679 | static::valueToString($key) |
|
| 1680 | )); |
|
| 1681 | } |
|
| 1682 | } |
|
| 1683 | ||
| 1684 | /** |
|
| 1685 | * @psalm-pure |
|
| @@ 1693-1701 (lines=9) @@ | ||
| 1690 | * |
|
| 1691 | * @throws InvalidArgumentException |
|
| 1692 | */ |
|
| 1693 | public static function keyNotExists($array, $key, $message = '') |
|
| 1694 | { |
|
| 1695 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1696 | static::reportInvalidArgument(\sprintf( |
|
| 1697 | $message ?: 'Expected the key %s to not exist.', |
|
| 1698 | static::valueToString($key) |
|
| 1699 | )); |
|
| 1700 | } |
|
| 1701 | } |
|
| 1702 | ||
| 1703 | /** |
|
| 1704 | * Checks if a value is a valid array key (int or string). |
|