@@ 482-490 (lines=9) @@ | ||
479 | * |
|
480 | * @throws InvalidArgumentException |
|
481 | */ |
|
482 | public static function isArrayAccessible($value, $message = '') |
|
483 | { |
|
484 | if (!\is_array($value) && !($value instanceof ArrayAccess)) { |
|
485 | static::reportInvalidArgument(\sprintf( |
|
486 | $message ?: 'Expected an array accessible. Got: %s', |
|
487 | static::typeToString($value) |
|
488 | )); |
|
489 | } |
|
490 | } |
|
491 | ||
492 | /** |
|
493 | * @psalm-assert countable $value |
|
@@ 523-531 (lines=9) @@ | ||
520 | * |
|
521 | * @throws InvalidArgumentException |
|
522 | */ |
|
523 | public static function isIterable($value, $message = '') |
|
524 | { |
|
525 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
526 | static::reportInvalidArgument(\sprintf( |
|
527 | $message ?: 'Expected an iterable. Got: %s', |
|
528 | static::typeToString($value) |
|
529 | )); |
|
530 | } |
|
531 | } |
|
532 | ||
533 | /** |
|
534 | * @psalm-template ExpectedType of object |