function TestCase::assertSniffError
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ TestCase.php, line 97
Class
- TestCase
- @codeCoverageIgnore
Namespace
SlevomatCodingStandard\SniffsCode
protected static function assertSniffError(File $phpcsFile, int $line, string $code, ?string $message = null) : void {
$errors = $phpcsFile->getErrors();
self::assertTrue(isset($errors[$line]), sprintf('Expected error on line %s, but none found.', $line));
$sniffCode = sprintf('%s.%s', self::getSniffName(), $code);
self::assertTrue(self::hasError($errors[$line], $sniffCode, $message), sprintf('Expected error %s%s, but none found on line %d.%sErrors found on line %d:%s%s%s', $sniffCode, $message !== null ? sprintf(' with message "%s"', $message) : '', $line, PHP_EOL . PHP_EOL, $line, PHP_EOL, self::getFormattedErrors($errors[$line]), PHP_EOL));
}