is_countable

Supported Versions: PHP 7 >= 7.3.0, PHP 8
Verify that the contents of a variable is a countable value
<?php is_countable(mixed $value): bool
<?php     public static function plural($value, $count = 2)

    {

        if (is_countable($count)) {

            $count = count($count);

        }
<?php         if (is_countable($number)) {

            $number = count($number);

        }
<?php             return false;

        } elseif (is_string($value) && trim($value) === '') {

            return false;

        } elseif (is_countable($value) && count($value) < 1) {

            return false;

        } elseif ($value instanceof File) {

            return (string) $value->getPath() !== '';
<?php     public function addLoop($data)

    {

        $length = is_countable($data) && ! $data instanceof LazyCollection

                            ? count($data)

                            : null;
<?php     public function toHaveCount(int $count, string $message = ''): self

    {

        if (! is_countable($this->value) && ! is_iterable($this->value)) {

            InvalidExpectationValue::expected('countable|iterable');

        }
<?php     public function toHaveSameSize(Countable|iterable $expected, string $message = ''): self

    {

        if (! is_countable($this->value) && ! is_iterable($this->value)) {

            InvalidExpectationValue::expected('countable|iterable');

        }
<?php                 $message = str_replace(self::UNDEFINED_METHOD, 'Call to undefined method ', $message);



                if (class_exists((string) $class) && (is_countable(class_parents($class)) ? count(class_parents($class)) : 0) > 0 && array_values(class_parents($class))[0] === TestCase::class) { // @phpstan-ignore-line

                    $message .= '. Did you forget to use the [uses()] function? Read more at: https://pestphp.com/docs/configuring-tests';

                }