function Constraint::failureDescriptionInContext
Returns the description of the failure when this constraint appears in context of an $operator expression.
The purpose of this method is to provide meaningful failure description in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct messages in this context.
The method shall return empty string, when it does not handle customization by itself.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ Constraint.php, line 166
Class
- Constraint
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\ConstraintCode
protected function failureDescriptionInContext(Operator $operator, mixed $role, mixed $other) : string {
$string = $this->toStringInContext($operator, $role);
if ($string === '') {
return '';
}
return Exporter::export($other, true) . ' ' . $string;
}