mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
Add some missing @throws annotations
This commit is contained in:
parent
8387c08db2
commit
3e58708130
@ -26,6 +26,7 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace pocketmine\command;
|
||||
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\lang\TextContainer;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use pocketmine\permission\PermissionManager;
|
||||
@ -92,6 +93,7 @@ abstract class Command{
|
||||
* @param string[] $args
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidCommandSyntaxException
|
||||
*/
|
||||
abstract public function execute(CommandSender $sender, string $commandLabel, array $args);
|
||||
|
||||
|
@ -48,8 +48,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){
|
||||
|
@ -50,6 +50,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)){
|
||||
|
@ -75,6 +75,9 @@ class RegionLoader{
|
||||
$this->filePath = $filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws CorruptedRegionException
|
||||
*/
|
||||
public function open() : void{
|
||||
$exists = file_exists($this->filePath);
|
||||
if(!$exists){
|
||||
@ -219,6 +222,9 @@ class RegionLoader{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws CorruptedRegionException
|
||||
*/
|
||||
protected function loadLocationTable() : void{
|
||||
fseek($this->filePointer, 0);
|
||||
$this->lastSector = 1;
|
||||
|
@ -63,6 +63,12 @@ class NetworkCipher{
|
||||
$this->encryptCipher->encryptInit($this->key, $iv);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $encrypted
|
||||
*
|
||||
* @return string
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function decrypt(string $encrypted) : string{
|
||||
if(strlen($encrypted) < 9){
|
||||
throw new \UnexpectedValueException("Payload is too short");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user