add annotations for thrown exceptions

This commit is contained in:
Marco Perone
2018-07-09 09:04:12 +02:00
parent 8a8b1c0d2a
commit 4b7374129c
21 changed files with 106 additions and 3 deletions
+22
View File
@@ -180,17 +180,26 @@ class UuidFactory implements UuidFactoryInterface
$this->uuidBuilder = $builder;
}
/**
* @inheritdoc
*/
public function fromBytes($bytes)
{
return $this->codec->decodeBytes($bytes);
}
/**
* @inheritdoc
*/
public function fromString($uuid)
{
$uuid = strtolower($uuid);
return $this->codec->decode($uuid);
}
/**
* @inheritdoc
*/
public function fromInteger($integer)
{
$hex = $this->numberConverter->toHex($integer);
@@ -199,6 +208,9 @@ class UuidFactory implements UuidFactoryInterface
return $this->fromString($hex);
}
/**
* @inheritdoc
*/
public function uuid1($node = null, $clockSeq = null)
{
$bytes = $this->timeGenerator->generate($node, $clockSeq);
@@ -207,11 +219,17 @@ class UuidFactory implements UuidFactoryInterface
return $this->uuidFromHashedName($hex, 1);
}
/**
* @inheritdoc
*/
public function uuid3($ns, $name)
{
return $this->uuidFromNsAndName($ns, $name, 3, 'md5');
}
/**
* @inheritdoc
*/
public function uuid4()
{
$bytes = $this->randomGenerator->generate(16);
@@ -224,6 +242,9 @@ class UuidFactory implements UuidFactoryInterface
return $this->uuidFromHashedName($hex, 4);
}
/**
* @inheritdoc
*/
public function uuid5($ns, $name)
{
return $this->uuidFromNsAndName($ns, $name, 5, 'sha1');
@@ -253,6 +274,7 @@ class UuidFactory implements UuidFactoryInterface
* @param string $hashFunction The hash function to use when hashing together
* the namespace and name
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
{