| @@ 1719-1727 (lines=9) @@ | ||
| 1716 | * |
|
| 1717 | * @throws InvalidArgumentException |
|
| 1718 | */ |
|
| 1719 | public static function keyExists($array, $key, $message = '') |
|
| 1720 | { |
|
| 1721 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1722 | static::reportInvalidArgument(\sprintf( |
|
| 1723 | $message ?: 'Expected the key %s to exist.', |
|
| 1724 | static::valueToString($key) |
|
| 1725 | )); |
|
| 1726 | } |
|
| 1727 | } |
|
| 1728 | ||
| 1729 | /** |
|
| 1730 | * @psalm-pure |
|
| @@ 1738-1746 (lines=9) @@ | ||
| 1735 | * |
|
| 1736 | * @throws InvalidArgumentException |
|
| 1737 | */ |
|
| 1738 | public static function keyNotExists($array, $key, $message = '') |
|
| 1739 | { |
|
| 1740 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1741 | static::reportInvalidArgument(\sprintf( |
|
| 1742 | $message ?: 'Expected the key %s to not exist.', |
|
| 1743 | static::valueToString($key) |
|
| 1744 | )); |
|
| 1745 | } |
|
| 1746 | } |
|
| 1747 | ||
| 1748 | /** |
|
| 1749 | * Checks if a value is a valid array key (int or string). |
|