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