@@ 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 |
|
@@ 1904-1914 (lines=11) @@ | ||
1901 | * |
|
1902 | * @throws InvalidArgumentException |
|
1903 | */ |
|
1904 | public static function isMap($array, $message = '') |
|
1905 | { |
|
1906 | if ( |
|
1907 | !\is_array($array) || |
|
1908 | \array_keys($array) !== \array_filter(\array_keys($array), '\is_string') |
|
1909 | ) { |
|
1910 | static::reportInvalidArgument( |
|
1911 | $message ?: 'Expected map - associative array with string keys.' |
|
1912 | ); |
|
1913 | } |
|
1914 | } |
|
1915 | ||
1916 | /** |
|
1917 | * @psalm-pure |