@@ 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 |
|
@@ 488-496 (lines=9) @@ | ||
485 | * |
|
486 | * @throws InvalidArgumentException |
|
487 | */ |
|
488 | public static function isCountable($value, $message = '') |
|
489 | { |
|
490 | if (!\is_array($value) && !($value instanceof Countable)) { |
|
491 | static::reportInvalidArgument(\sprintf( |
|
492 | $message ?: 'Expected a countable. Got: %s', |
|
493 | static::typeToString($value) |
|
494 | )); |
|
495 | } |
|
496 | } |
|
497 | ||
498 | /** |
|
499 | * @psalm-assert iterable $value |
|
@@ 506-514 (lines=9) @@ | ||
503 | * |
|
504 | * @throws InvalidArgumentException |
|
505 | */ |
|
506 | public static function isIterable($value, $message = '') |
|
507 | { |
|
508 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
509 | static::reportInvalidArgument(\sprintf( |
|
510 | $message ?: 'Expected an iterable. Got: %s', |
|
511 | static::typeToString($value) |
|
512 | )); |
|
513 | } |
|
514 | } |
|
515 | ||
516 | /** |
|
517 | * @psalm-template ExpectedType of object |