mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 21:35:21 +00:00
Fix PHPStan errors
This commit is contained in:
parent
ba079bd9aa
commit
a64adbfffe
@ -38,8 +38,14 @@ final class CreativeInventory{
|
|||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$creativeItems = json_decode(file_get_contents(Path::join(\pocketmine\BEDROCK_DATA_PATH, "creativeitems.json")), true);
|
$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){
|
foreach($creativeItems as $data){
|
||||||
|
if(!is_array($data)){
|
||||||
|
throw new SavedDataLoadingException("Invalid creative items file, expected array as item type");
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
$item = Item::legacyJsonDeserialize($data);
|
$item = Item::legacyJsonDeserialize($data);
|
||||||
}catch(SavedDataLoadingException){
|
}catch(SavedDataLoadingException){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user