| @@ 320-332 (lines=13) @@ | ||
| 317 | * |
|
| 318 | * @throws InvalidArgumentException |
|
| 319 | */ |
|
| 320 | public static function isArray($value, $message = '') |
|
| 321 | { |
|
| 322 | if (!\is_array($value)) { |
|
| 323 | static::reportInvalidArgument( |
|
| 324 | is_callable($message) |
|
| 325 | ? $message() |
|
| 326 | : sprintf( |
|
| 327 | $message ?: 'Expected an array. Got: %s', |
|
| 328 | static::typeToString($value) |
|
| 329 | ) |
|
| 330 | ); |
|
| 331 | } |
|
| 332 | } |
|
| 333 | ||
| 334 | /** |
|
| 335 | * @psalm-pure |
|
| @@ 1903-1913 (lines=11) @@ | ||
| 1900 | * |
|
| 1901 | * @throws InvalidArgumentException |
|
| 1902 | */ |
|
| 1903 | public static function isMap($array, $message = '') |
|
| 1904 | { |
|
| 1905 | if ( |
|
| 1906 | !\is_array($array) || |
|
| 1907 | \array_keys($array) !== \array_filter(\array_keys($array), '\is_string') |
|
| 1908 | ) { |
|
| 1909 | static::reportInvalidArgument( |
|
| 1910 | $message ?: 'Expected map - associative array with string keys.' |
|
| 1911 | ); |
|
| 1912 | } |
|
| 1913 | } |
|
| 1914 | ||
| 1915 | /** |
|
| 1916 | * @psalm-pure |
|