Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StringMatchesFormatDescription.php

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\Constraint

Code

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);
}
RSS feed
Powered by Drupal