Add some missing @throws annotations

This commit is contained in:
Dylan K. Taylor
2019-01-30 19:41:20 +00:00
parent 8387c08db2
commit 3e58708130
7 changed files with 18 additions and 3 deletions

View File

@ -73,6 +73,7 @@ interface ResourcePack{
* @param int $length Maximum length of data to return.
*
* @return string byte-array
* @throws \InvalidArgumentException if the chunk does not exist
*/
public function getPackChunk(int $start, int $length) : string;
}

View File

@ -75,6 +75,7 @@ class ZippedResourcePack implements ResourcePack{
/**
* @param string $zipPath Path to the resource pack zip
* @throws ResourcePackException
*/
public function __construct(string $zipPath){
$this->path = $zipPath;
@ -148,7 +149,7 @@ class ZippedResourcePack implements ResourcePack{
public function getPackChunk(int $start, int $length) : string{
fseek($this->fileResource, $start);
if(feof($this->fileResource)){
throw new \RuntimeException("Requested a resource pack chunk with invalid start offset");
throw new \InvalidArgumentException("Requested a resource pack chunk with invalid start offset");
}
return fread($this->fileResource, $length);
}