mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 01:16:15 +00:00
Deal with a whole lot of PHPStan suppressed key casting errors
closes #6534
This commit is contained in:
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\tools\compact_regions;
|
||||
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\format\io\exception\CorruptedChunkException;
|
||||
use pocketmine\world\format\io\region\CorruptedRegionException;
|
||||
use pocketmine\world\format\io\region\RegionLoader;
|
||||
@ -59,6 +60,7 @@ const SUPPORTED_EXTENSIONS = [
|
||||
/**
|
||||
* @param int[] $files
|
||||
* @phpstan-param array<string, int> $files
|
||||
* @phpstan-param-out array<string, int> $files
|
||||
*/
|
||||
function find_regions_recursive(string $dir, array &$files) : void{
|
||||
$dirFiles = scandir($dir, SCANDIR_SORT_NONE);
|
||||
@ -112,7 +114,7 @@ function main(array $argv) : int{
|
||||
$corruptedFiles = [];
|
||||
$doneCount = 0;
|
||||
$totalCount = count($files);
|
||||
foreach($files as $file => $size){
|
||||
foreach(Utils::stringifyKeys($files) as $file => $size){
|
||||
try{
|
||||
$oldRegion = RegionLoader::loadExisting($file);
|
||||
}catch(CorruptedRegionException $e){
|
||||
@ -162,7 +164,7 @@ function main(array $argv) : int{
|
||||
|
||||
clearstatcache();
|
||||
$newSize = 0;
|
||||
foreach($files as $file => $oldSize){
|
||||
foreach(Utils::stringifyKeys($files) as $file => $oldSize){
|
||||
$newSize += file_exists($file) ? filesize($file) : 0;
|
||||
}
|
||||
$diff = $currentSize - $newSize;
|
||||
|
Reference in New Issue
Block a user