mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Filesystem: added fileGetContents to reduce ErrorToExceptionHandler boilerplate code
This commit is contained in:
@ -24,8 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\data\bedrock;
|
||||
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Utils;
|
||||
use function file_get_contents;
|
||||
use pocketmine\utils\Filesystem;
|
||||
use function is_array;
|
||||
use function is_int;
|
||||
use function is_string;
|
||||
@ -45,7 +44,7 @@ abstract class LegacyToStringBidirectionalIdMap{
|
||||
private array $stringToLegacy = [];
|
||||
|
||||
public function __construct(string $file){
|
||||
$stringToLegacyId = json_decode(Utils::assumeNotFalse(file_get_contents($file), "Missing required resource file"), true);
|
||||
$stringToLegacyId = json_decode(Filesystem::fileGetContents($file), true);
|
||||
if(!is_array($stringToLegacyId)){
|
||||
throw new AssumptionFailedError("Invalid format of ID map");
|
||||
}
|
||||
|
Reference in New Issue
Block a user