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

Breadcrumb

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

function TestCase::hasError

*

Parameters

list<list<array{source: string, message: string}>> $errorsOnLine:

2 calls to TestCase::hasError()
TestCase::assertSniffError in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TestCase.php
TestCase::assertSniffWarning in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TestCase.php

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TestCase.php, line 197

Class

TestCase
@codeCoverageIgnore

Namespace

SlevomatCodingStandard\Sniffs

Code

private static function hasError(array $errorsOnLine, string $sniffCode, ?string $message) : bool {
    $hasError = false;
    foreach ($errorsOnLine as $errorsOnPosition) {
        foreach ($errorsOnPosition as $error) {
            
            /** @var string $errorSource */
            $errorSource = $error['source'];
            
            /** @var string $errorMessage */
            $errorMessage = $error['message'];
            if ($errorSource === $sniffCode && ($message === null || strpos($errorMessage, $message) !== false)) {
                $hasError = true;
                break;
            }
        }
    }
    return $hasError;
}
RSS feed
Powered by Drupal