class ConfigurableMethod
@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\ConfigurableMethod
Expanded class hierarchy of ConfigurableMethod
3 files declare their use of ConfigurableMethod
- Generator.php in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - InvocationMocker.php in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Builder/ InvocationMocker.php - MockClass.php in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockClass.php
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ ConfigurableMethod.php, line 19
Namespace
PHPUnit\Framework\MockObjectView source
final class ConfigurableMethod {
/**
* @psalm-var non-empty-string
*/
private readonly string $name;
/**
* @psalm-var array<int, mixed>
*/
private readonly array $defaultParameterValues;
/**
* @psalm-var non-negative-int
*/
private readonly int $numberOfParameters;
private readonly Type $returnType;
/**
* @psalm-param non-empty-string $name
* @psalm-param array<int, mixed> $defaultParameterValues
* @psalm-param non-negative-int $numberOfParameters
*/
public function __construct(string $name, array $defaultParameterValues, int $numberOfParameters, Type $returnType) {
$this->name = $name;
$this->defaultParameterValues = $defaultParameterValues;
$this->numberOfParameters = $numberOfParameters;
$this->returnType = $returnType;
}
/**
* @psalm-return non-empty-string
*/
public function name() : string {
return $this->name;
}
/**
* @psalm-return array<int, mixed>
*/
public function defaultParameterValues() : array {
return $this->defaultParameterValues;
}
/**
* @psalm-return non-negative-int
*/
public function numberOfParameters() : int {
return $this->numberOfParameters;
}
public function mayReturn(mixed $value) : bool {
return $this->returnType
->isAssignable(Type::fromValue($value, false));
}
public function returnTypeDeclaration() : string {
return $this->returnType
->asString();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ConfigurableMethod::$defaultParameterValues | private | property | @psalm-var array<int, mixed> |
ConfigurableMethod::$name | private | property | @psalm-var non-empty-string |
ConfigurableMethod::$numberOfParameters | private | property | @psalm-var non-negative-int |
ConfigurableMethod::$returnType | private | property | |
ConfigurableMethod::defaultParameterValues | public | function | @psalm-return array<int, mixed> |
ConfigurableMethod::mayReturn | public | function | |
ConfigurableMethod::name | public | function | @psalm-return non-empty-string |
ConfigurableMethod::numberOfParameters | public | function | @psalm-return non-negative-int |
ConfigurableMethod::returnTypeDeclaration | public | function | |
ConfigurableMethod::__construct | public | function | @psalm-param non-empty-string $name @psalm-param array<int, mixed> $defaultParameterValues @psalm-param non-negative-int $numberOfParameters |