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

Breadcrumb

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

function Issue::calculateHash

@psalm-param non-empty-string $file @psalm-param positive-int $line

@psalm-return non-empty-string

Throws

FileDoesNotExistException

FileDoesNotHaveLineException

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

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal