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