@@ 472-480 (lines=9) @@ | ||
469 | * |
|
470 | * @throws InvalidArgumentException |
|
471 | */ |
|
472 | public static function isArrayAccessible($value, $message = '') |
|
473 | { |
|
474 | if (!\is_array($value) && !($value instanceof ArrayAccess)) { |
|
475 | static::reportInvalidArgument(\sprintf( |
|
476 | $message ?: 'Expected an array accessible. Got: %s', |
|
477 | static::typeToString($value) |
|
478 | )); |
|
479 | } |
|
480 | } |
|
481 | ||
482 | /** |
|
483 | * @psalm-assert countable $value |
|
@@ 513-521 (lines=9) @@ | ||
510 | * |
|
511 | * @throws InvalidArgumentException |
|
512 | */ |
|
513 | public static function isIterable($value, $message = '') |
|
514 | { |
|
515 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
516 | static::reportInvalidArgument(\sprintf( |
|
517 | $message ?: 'Expected an iterable. Got: %s', |
|
518 | static::typeToString($value) |
|
519 | )); |
|
520 | } |
|
521 | } |
|
522 | ||
523 | /** |
|
524 | * @psalm-template ExpectedType of object |