class ConsecutiveCalls
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@internal This class is not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls implements \PHPUnit\Framework\MockObject\Stub\Stub
Expanded class hierarchy of ConsecutiveCalls
3 files declare their use of ConsecutiveCalls
- Functions.php in vendor/
phpunit/ phpunit/ src/ Framework/ Assert/ Functions.php - InvocationMocker.php in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Builder/ InvocationMocker.php - TestCase.php in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Stub/ ConsecutiveCalls.php, line 22
Namespace
PHPUnit\Framework\MockObject\StubView source
final class ConsecutiveCalls implements Stub {
private array $stack;
private int $numberOfConfiguredReturnValues;
public function __construct(array $stack) {
$this->stack = $stack;
$this->numberOfConfiguredReturnValues = count($stack);
}
/**
* @throws NoMoreReturnValuesConfiguredException
*/
public function invoke(Invocation $invocation) : mixed {
if (empty($this->stack)) {
throw new NoMoreReturnValuesConfiguredException($invocation, $this->numberOfConfiguredReturnValues);
}
$value = array_shift($this->stack);
if ($value instanceof Stub) {
$value = $value->invoke($invocation);
}
return $value;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ConsecutiveCalls::$numberOfConfiguredReturnValues | private | property | ||
ConsecutiveCalls::$stack | private | property | ||
ConsecutiveCalls::invoke | public | function | Overrides Stub::invoke | |
ConsecutiveCalls::__construct | public | function |