mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-15 16:07:55 +03:00
chore(deps-dev): upgrade PHPStan
This commit is contained in:
@@ -29,19 +29,12 @@ class DefaultNameGenerator implements NameGeneratorInterface
|
||||
public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string
|
||||
{
|
||||
try {
|
||||
/** @var string|bool $bytes */
|
||||
$bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true);
|
||||
return hash($hashAlgorithm, $ns->getBytes() . $name, true);
|
||||
} catch (ValueError $e) {
|
||||
$bytes = false; // keep same behavior than PHP 7
|
||||
throw new NameException(
|
||||
message: sprintf('Unable to hash namespace and name with algorithm \'%s\'', $hashAlgorithm),
|
||||
previous: $e,
|
||||
);
|
||||
}
|
||||
|
||||
if ($bytes === false) {
|
||||
throw new NameException(sprintf(
|
||||
'Unable to hash namespace and name with algorithm \'%s\'',
|
||||
$hashAlgorithm
|
||||
));
|
||||
}
|
||||
|
||||
return (string) $bytes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user