backport 3e58708130d9a77c261b3a1355fa2e0163a5c7c6: Add some missing @throws annotations

This commit is contained in:
Dylan K. Taylor 2019-01-30 19:41:20 +00:00
parent 93cb9390e0
commit 20af789963
5 changed files with 10 additions and 3 deletions

View File

@ -78,8 +78,6 @@ abstract class Event{
* Calls event handlers registered for this event.
*
* @throws \RuntimeException if event call recursion reaches the max depth limit
*
* @throws \ReflectionException
*/
public function call() : void{
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){

View File

@ -65,6 +65,7 @@ class CraftingTransaction extends InventoryTransaction{
* @param int $iterations
*
* @return int
* @throws TransactionValidationException
*/
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{
if(empty($recipeItems)){

View File

@ -83,6 +83,9 @@ class RegionLoader{
$this->filePath = $filePath;
}
/**
* @throws CorruptedRegionException
*/
public function open(){
$exists = file_exists($this->filePath);
if(!$exists){
@ -263,6 +266,9 @@ class RegionLoader{
}
}
/**
* @throws CorruptedRegionException
*/
protected function loadLocationTable(){
fseek($this->filePointer, 0);
$this->lastSector = 1;

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;
@ -150,7 +151,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);
}