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