src/Verification/IterableVerifier.php
public function produced(
        $keyOrValue = null,
        $value = null
    ): ?EventCollection {
        $cardinality = $this->cardinality;
        $argumentCount = func_num_args();

        if (0 === $argumentCount) {
            $key = null;
            $arguments = [];
        } elseif (1 === $argumentCount) {
            $key = null;
            $value = $this->matcherFactory->adapt($keyOrValue);
            $arguments = [$value];
        } else {
            $key = $this->matcherFactory->adapt($keyOrValue);
            $value = $this->matcherFactory->adapt($value);
            $arguments = [$key, $value];
        }

        if ($result = $this->checkProduced(...$arguments)) {
            return $result;
        }

        return $this->assertionRecorder->createFailure(
            $this->assertionRenderer->renderIterableProduced(
                $this->subject,
                $cardinality,
                $this->isGenerator,
                $key,
                $value
            )
        );
    }
public function produced(
        $keyOrValue = null,
        $value = null
    ): ?EventCollection {
        $cardinality = $this->cardinality;
        $argumentCount = func_num_args();

        if (0 === $argumentCount) {
            $key = null;
            $arguments = [];
        } elseif (1 === $argumentCount) {
            $key = null;
            $value = $this->matcherFactory->adapt($keyOrValue);
            $arguments = [$value];
        } else {
            $key = $this->matcherFactory->adapt($keyOrValue);
            $value = $this->matcherFactory->adapt($value);
            $arguments = [$key, $value];
        }

        if ($result = $this->checkProduced(...$arguments)) {
            return $result;
        }

        return $this->assertionRecorder->createFailure(
            $this->assertionRenderer->renderIterableProduced(
                $this->subject,
                $cardinality,
                $this->isGenerator,
                $key,
                $value
            )
        );
    }
public function produced ( $ keyOrValue = null , $ value = null ) : ? EventCollection { $ cardinality = $ this -> cardinality ; $ argumentCount = func_num_args ( ) ; if ( 0 === $ argumentCount ) { $ key = null ; $ arguments = [ ] ; } elseif ( 1 === $ argumentCount ) { $ key = null ; $ value = $ this -> matcherFactory -> adapt ( $ keyOrValue ) ; $ arguments = [ $ value ] ; } else { $ key = $ this -> matcherFactory -> adapt ( $ keyOrValue ) ; $ value = $ this -> matcherFactory -> adapt ( $ value ) ; $ arguments = [ $ key , $ value ] ; } if ( $ result = $ this -> checkProduced ( ... $ arguments ) ) { return $ result ; } return $ this -> assertionRecorder -> createFailure ( $ this -> assertionRenderer -> renderIterableProduced ( $ this -> subject , $ cardinality , $ this -> isGenerator , $ key , $ value ) ) ; }
Throws an exception unless the subject produced the supplied values.

When called with no arguments, this method simply checks that the subject
produced any value.

With a single argument, it checks that a value matching the argument was
produced.

With two arguments, it checks that a key and value matching the
respective arguments were produced together.

@param mixed $keyOrValue The key or value.
@param mixed $value      The value.

@return EventCollection|null The result, or null if the assertion recorder does not throw exceptions.
@throws Throwable            If the assertion fails, and the assertion recorder throws exceptions.
Throws an exception unless the subject produced the supplied values .