function StringMatchesFormatDescription::additionalFailureDescription
Overrides Constraint::additionalFailureDescription
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ String/ StringMatchesFormatDescription.php, line 63
Class
- StringMatchesFormatDescription
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\ConstraintCode
protected function additionalFailureDescription(mixed $other) : string {
$from = explode("\n", $this->formatDescription);
$to = explode("\n", $this->convertNewlines($other));
foreach ($from as $index => $line) {
if (isset($to[$index]) && $line !== $to[$index]) {
$line = $this->regularExpressionForFormatDescription($line);
if (preg_match($line, $to[$index]) > 0) {
$from[$index] = $to[$index];
}
}
}
$from = implode("\n", $from);
$to = implode("\n", $to);
return $this->differ()
->diff($from, $to);
}