Fix PHPStan errors

This commit is contained in:
Dylan K. Taylor 2022-06-30 20:16:55 +01:00
parent ba079bd9aa
commit a64adbfffe
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -38,8 +38,14 @@ final class CreativeInventory{
private function __construct(){
$creativeItems = json_decode(file_get_contents(Path::join(\pocketmine\BEDROCK_DATA_PATH, "creativeitems.json")), true);
if(!is_array($creativeItems)){
throw new SavedDataLoadingException("Invalid creative items file, expected array as root type");
}
foreach($creativeItems as $data){
if(!is_array($data)){
throw new SavedDataLoadingException("Invalid creative items file, expected array as item type");
}
try{
$item = Item::legacyJsonDeserialize($data);
}catch(SavedDataLoadingException){