Code Duplication    Length = 9-9 lines in 3 locations

src/Assert.php 3 locations

@@ 466-474 (lines=9) @@
463
     *
464
     * @throws InvalidArgumentException
465
     */
466
    public static function isArrayAccessible($value, $message = '')
467
    {
468
        if (!\is_array($value) && !($value instanceof ArrayAccess)) {
469
            static::reportInvalidArgument(\sprintf(
470
                $message ?: 'Expected an array accessible. Got: %s',
471
                static::typeToString($value)
472
            ));
473
        }
474
    }
475
476
    /**
477
     * @psalm-assert countable $value
@@ 484-492 (lines=9) @@
481
     *
482
     * @throws InvalidArgumentException
483
     */
484
    public static function isCountable($value, $message = '')
485
    {
486
        if (!\is_array($value) && !($value instanceof Countable)) {
487
            static::reportInvalidArgument(\sprintf(
488
                $message ?: 'Expected a countable. Got: %s',
489
                static::typeToString($value)
490
            ));
491
        }
492
    }
493
494
    /**
495
     * @psalm-assert iterable $value
@@ 502-510 (lines=9) @@
499
     *
500
     * @throws InvalidArgumentException
501
     */
502
    public static function isIterable($value, $message = '')
503
    {
504
        if (!\is_array($value) && !($value instanceof Traversable)) {
505
            static::reportInvalidArgument(\sprintf(
506
                $message ?: 'Expected an iterable. Got: %s',
507
                static::typeToString($value)
508
            ));
509
        }
510
    }
511
512
    /**
513
     * @psalm-template ExpectedType of object