mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
backport 3e58708130d9a77c261b3a1355fa2e0163a5c7c6: Add some missing @throws annotations
This commit is contained in:
parent
93cb9390e0
commit
20af789963
@ -78,8 +78,6 @@ abstract class Event{
|
|||||||
* Calls event handlers registered for this event.
|
* Calls event handlers registered for this event.
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException if event call recursion reaches the max depth limit
|
* @throws \RuntimeException if event call recursion reaches the max depth limit
|
||||||
*
|
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function call() : void{
|
public function call() : void{
|
||||||
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){
|
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){
|
||||||
|
@ -65,6 +65,7 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
* @param int $iterations
|
* @param int $iterations
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws TransactionValidationException
|
||||||
*/
|
*/
|
||||||
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{
|
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{
|
||||||
if(empty($recipeItems)){
|
if(empty($recipeItems)){
|
||||||
|
@ -83,6 +83,9 @@ class RegionLoader{
|
|||||||
$this->filePath = $filePath;
|
$this->filePath = $filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CorruptedRegionException
|
||||||
|
*/
|
||||||
public function open(){
|
public function open(){
|
||||||
$exists = file_exists($this->filePath);
|
$exists = file_exists($this->filePath);
|
||||||
if(!$exists){
|
if(!$exists){
|
||||||
@ -263,6 +266,9 @@ class RegionLoader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CorruptedRegionException
|
||||||
|
*/
|
||||||
protected function loadLocationTable(){
|
protected function loadLocationTable(){
|
||||||
fseek($this->filePointer, 0);
|
fseek($this->filePointer, 0);
|
||||||
$this->lastSector = 1;
|
$this->lastSector = 1;
|
||||||
|
@ -73,6 +73,7 @@ interface ResourcePack{
|
|||||||
* @param int $length Maximum length of data to return.
|
* @param int $length Maximum length of data to return.
|
||||||
*
|
*
|
||||||
* @return string byte-array
|
* @return string byte-array
|
||||||
|
* @throws \InvalidArgumentException if the chunk does not exist
|
||||||
*/
|
*/
|
||||||
public function getPackChunk(int $start, int $length) : string;
|
public function getPackChunk(int $start, int $length) : string;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ class ZippedResourcePack implements ResourcePack{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $zipPath Path to the resource pack zip
|
* @param string $zipPath Path to the resource pack zip
|
||||||
|
* @throws ResourcePackException
|
||||||
*/
|
*/
|
||||||
public function __construct(string $zipPath){
|
public function __construct(string $zipPath){
|
||||||
$this->path = $zipPath;
|
$this->path = $zipPath;
|
||||||
@ -150,7 +151,7 @@ class ZippedResourcePack implements ResourcePack{
|
|||||||
public function getPackChunk(int $start, int $length) : string{
|
public function getPackChunk(int $start, int $length) : string{
|
||||||
fseek($this->fileResource, $start);
|
fseek($this->fileResource, $start);
|
||||||
if(feof($this->fileResource)){
|
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);
|
return fread($this->fileResource, $length);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user