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