| @@ 347-355 (lines=9) @@ | ||
| 344 | * |
|
| 345 | * @throws InvalidArgumentException |
|
| 346 | */ |
|
| 347 | public static function isArrayAccessible($value, $message = '') |
|
| 348 | { |
|
| 349 | if (!\is_array($value) && !($value instanceof ArrayAccess)) { |
|
| 350 | static::reportInvalidArgument(\sprintf( |
|
| 351 | $message ?: 'Expected an array accessible. Got: %s', |
|
| 352 | static::typeToString($value) |
|
| 353 | )); |
|
| 354 | } |
|
| 355 | } |
|
| 356 | ||
| 357 | /** |
|
| 358 | * @psalm-pure |
|
| @@ 390-398 (lines=9) @@ | ||
| 387 | * |
|
| 388 | * @throws InvalidArgumentException |
|
| 389 | */ |
|
| 390 | public static function isIterable($value, $message = '') |
|
| 391 | { |
|
| 392 | if (!\is_array($value) && !($value instanceof Traversable)) { |
|
| 393 | static::reportInvalidArgument(\sprintf( |
|
| 394 | $message ?: 'Expected an iterable. Got: %s', |
|
| 395 | static::typeToString($value) |
|
| 396 | )); |
|
| 397 | } |
|
| 398 | } |
|
| 399 | ||
| 400 | /** |
|
| 401 | * @psalm-pure |
|