Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Counts all elements in an array or in a Countable object
Alias sizeof
<?php count(Countable|array $value, int $mode = COUNT_NORMAL): int
<?php             $matches = [];

            preg_match('/\((.*?)\)/', $description, $matches);



            if (count($matches) > 1) {

                if (str_contains($description, 'with '.$matches[0].' /')) {

                    $description = str_replace('with '.$matches[0].' /', '', $description);

                } else {
<?php         $underlyingTest = Reflection::getFunctionVariable($this->__test, 'closure');

        $testParameterTypes = array_values(Reflection::getFunctionArguments($underlyingTest));



        if (count($arguments) !== 1) {

            foreach ($arguments as $argumentIndex => $argumentValue) {

                if (! $argumentValue instanceof Closure) {

                    continue;
<?php         }



        $boundDatasetResult = $this->__callClosure($arguments[0], []);

        if (count($testParameterTypes) === 1) {

            return [$boundDatasetResult];

        }

        if (! is_array($boundDatasetResult)) {
<?php         $underlyingTest = Reflection::getFunctionVariable($this->__test, 'closure');

        $testReflection = new ReflectionFunction($underlyingTest);

        $requiredParametersCount = $testReflection->getNumberOfRequiredParameters();

        $suppliedParametersCount = count($arguments);



        if ($suppliedParametersCount >= $requiredParametersCount) {

            return;
<?php     protected function __MarkTestIncompleteIfSnapshotHaveChanged(): void

    {

        if (count($this->__snapshotChanges) === 0) {

            return;

        }
<?php             return;

        }



        if (count($this->__snapshotChanges) === 1) {

            $this->markTestIncomplete($this->__snapshotChanges[0]);



            return;
<?php         parent::__construct(sprintf(

            "A test with the description '%s' has %d argument(s) ([%s]) and no dataset(s) provided in %s",

            $name,

            count($arguments),

            implode(', ', array_map(static fn (string $arg, string $type): string => sprintf('%s $%s', $type, $arg), array_keys($arguments), $arguments)),

            $file,

        ));
<?php             throw new BadMethodCallException('Expectation value is not iterable.');

        }



        if (count($callbacks) == 0) {

            throw new InvalidArgumentException('No sequence expectations defined.');

        }
<?php             $index = isset($callbacks[$index + 1]) ? $index + 1 : 0;

        }



        if ($valuesCount < count($callbacks)) {

            throw new OutOfRangeException('Sequence expectations are more than the iterable items.');

        }
<?php         return Targeted::make(

            $this,

            fn (ObjectDescription $object): bool => count($interfaces) === count($object->reflectionClass->getInterfaceNames())

                && array_diff($interfaces, $object->reflectionClass->getInterfaceNames()) === [],

            "to only implement '".implode("', '", $interfaces)."'",

            FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),
<?php             ...$result->testMarkedIncompleteEvents(),

        ];



        $numberOfNotPassedTests = count(

            array_unique(

                array_map(

                    function (BeforeFirstTestMethodErrored|Errored|Failed|Skipped|ConsideredRisky|MarkedIncomplete $event): string {

                        if ($event instanceof BeforeFirstTestMethodErrored) {

                            return $event->testClassName();

                        }



                        return $this->getTestCaseLocation($event->test());

                    },

                    $events

                )

            )

        );



        $numberOfPassedTests = $result->numberOfTestsRun() - $numberOfNotPassedTests;
<?php             $callback = $exception;

            $parameters = (new ReflectionFunction($exception))->getParameters();



            if (count($parameters) !== 1) {

                throw new InvalidArgumentException('The given closure must have a single parameter type-hinted as the class string.');

            }
<?php     {

        $batchSize = $this->options->maxBatchSize;



        while (count($this->pending) > 0 && count($this->workers) > 0) {

            foreach ($this->workers as $token => $worker) {

                if (! $worker->isRunning()) {

                    throw $worker->getWorkerCrashedException();
<?php     private function waitForAllToFinish(): void

    {

        $stopped = [];

        while (count($this->workers) > 0) {

            foreach ($this->workers as $index => $worker) {

                if ($worker->isRunning()) {

                    if (! isset($stopped[$index]) && $worker->isFree()) {
<?php     public function count(): int

    {

        return count($this->testCases);

    }