| @@ 508-516 (lines=9) @@ | ||
| 505 | * |
|
| 506 | * @throws InvalidArgumentException |
|
| 507 | */ |
|
| 508 | public static function isArrayAccessible($value, $message = '') |
|
| 509 | { |
|
| 510 | if (!\is_array($value) && !($value instanceof ArrayAccess)) { |
|
| 511 | static::reportInvalidArgument(\sprintf( |
|
| 512 | $message ?: 'Expected an array accessible. Got: %s', |
|
| 513 | static::typeToString($value) |
|
| 514 | )); |
|
| 515 | } |
|
| 516 | } |
|
| 517 | ||
| 518 | /** |
|
| 519 | * @psalm-pure |
|
| @@ 551-559 (lines=9) @@ | ||
| 548 | * |
|
| 549 | * @throws InvalidArgumentException |
|
| 550 | */ |
|
| 551 | public static function isIterable($value, $message = '') |
|
| 552 | { |
|
| 553 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
| 554 | static::reportInvalidArgument(\sprintf( |
|
| 555 | $message ?: 'Expected an iterable. Got: %s', |
|
| 556 | static::typeToString($value) |
|
| 557 | )); |
|
| 558 | } |
|
| 559 | } |
|
| 560 | ||
| 561 | /** |
|
| 562 | * @psalm-pure |
|