function Issue::calculateHash
@psalm-param non-empty-string $file @psalm-param positive-int $line
@psalm-return non-empty-string
Throws
1 call to Issue::calculateHash()
- Issue::from in vendor/
phpunit/ phpunit/ src/ Runner/ Baseline/ Issue.php - @psalm-param non-empty-string $file @psalm-param positive-int $line @psalm-param ?non-empty-string $hash @psalm-param non-empty-string $description
File
-
vendor/
phpunit/ phpunit/ src/ Runner/ Baseline/ Issue.php, line 127
Class
- Issue
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Runner\BaselineCode
private static function calculateHash(string $file, int $line) : string {
$lines = @file($file, FILE_IGNORE_NEW_LINES);
if ($lines === false && !is_file($file)) {
throw new FileDoesNotExistException($file);
}
$key = $line - 1;
if (!isset($lines[$key])) {
throw new FileDoesNotHaveLineException($file, $line);
}
$hash = sha1($lines[$key]);
assert($hash !== '');
return $hash;
}