| @@ 366-374 (lines=9) @@ | ||
| 363 | * |
|
| 364 | * @throws InvalidArgumentException |
|
| 365 | */ |
|
| 366 | public static function isArrayAccessible($value, $message = '') |
|
| 367 | { |
|
| 368 | if (!\is_array($value) && !($value instanceof ArrayAccess)) { |
|
| 369 | static::reportInvalidArgument(\sprintf( |
|
| 370 | $message ?: 'Expected an array accessible. Got: %s', |
|
| 371 | static::typeToString($value) |
|
| 372 | )); |
|
| 373 | } |
|
| 374 | } |
|
| 375 | ||
| 376 | /** |
|
| 377 | * @psalm-pure |
|
| @@ 409-417 (lines=9) @@ | ||
| 406 | * |
|
| 407 | * @throws InvalidArgumentException |
|
| 408 | */ |
|
| 409 | public static function isIterable($value, $message = '') |
|
| 410 | { |
|
| 411 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
| 412 | static::reportInvalidArgument(\sprintf( |
|
| 413 | $message ?: 'Expected an iterable. Got: %s', |
|
| 414 | static::typeToString($value) |
|
| 415 | )); |
|
| 416 | } |
|
| 417 | } |
|
| 418 | ||
| 419 | /** |
|
| 420 | * @psalm-pure |
|