mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Add tools/ to PHPStan analysis
This commit is contained in:
parent
6bbc0aae7d
commit
ee8b854f30
@ -27,6 +27,7 @@ parameters:
|
||||
- tests/phpstan/bootstrap.php
|
||||
scanDirectories:
|
||||
- tests/plugins/TesterPlugin
|
||||
- tools
|
||||
scanFiles:
|
||||
- src/PocketMine.php
|
||||
- build/make-release.php
|
||||
@ -39,6 +40,7 @@ parameters:
|
||||
- build/server-phar.php
|
||||
- tests/phpunit
|
||||
- tests/plugins/TesterPlugin
|
||||
- tools
|
||||
dynamicConstantNames:
|
||||
- pocketmine\VersionInfo::IS_DEVELOPMENT_BUILD
|
||||
- pocketmine\DEBUG
|
||||
|
@ -59,7 +59,11 @@ const SUPPORTED_EXTENSIONS = [
|
||||
* @phpstan-param array<string, int> $files
|
||||
*/
|
||||
function find_regions_recursive(string $dir, array &$files) : void{
|
||||
foreach(scandir($dir, SCANDIR_SORT_NONE) as $file){
|
||||
$dirFiles = scandir($dir, SCANDIR_SORT_NONE);
|
||||
if($dirFiles === false){
|
||||
return;
|
||||
}
|
||||
foreach($dirFiles as $file){
|
||||
if($file === "." or $file === ".."){
|
||||
continue;
|
||||
}
|
||||
|
@ -39,11 +39,13 @@ $usageMessage = "Options:\n";
|
||||
foreach($requiredOpts as $_opt => $_desc){
|
||||
$usageMessage .= "\t--$_opt : $_desc\n";
|
||||
}
|
||||
$args = getopt("", array_map(function(string $str){ return "$str:"; }, array_keys($requiredOpts)));
|
||||
$plainArgs = getopt("", array_map(function(string $str){ return "$str:"; }, array_keys($requiredOpts)));
|
||||
$args = [];
|
||||
foreach($requiredOpts as $opt => $desc){
|
||||
if(!isset($args[$opt])){
|
||||
if(!isset($plainArgs[$opt]) || !is_string($plainArgs[$opt])){
|
||||
die($usageMessage);
|
||||
}
|
||||
$args[$opt] = $plainArgs[$opt];
|
||||
}
|
||||
if(!array_key_exists($args["format"], $writableFormats)){
|
||||
die($usageMessage);
|
||||
@ -53,9 +55,9 @@ $inputPath = realpath($args["world"]);
|
||||
if($inputPath === false){
|
||||
die("Cannot find input world at location: " . $args["world"]);
|
||||
}
|
||||
$backupPath = $args["backup"];
|
||||
if((!@mkdir($backupPath, 0777, true) and !is_dir($backupPath)) or !is_writable($backupPath)){
|
||||
die("Backup file path " . $backupPath . " is not writable (permission error or doesn't exist), aborting");
|
||||
$backupPath = realpath($args["backup"]);
|
||||
if($backupPath === false || (!@mkdir($backupPath, 0777, true) and !is_dir($backupPath)) or !is_writable($backupPath)){
|
||||
die("Backup file path " . $args["backup"] . " is not writable (permission error or doesn't exist), aborting");
|
||||
}
|
||||
|
||||
$oldProviderClasses = $providerManager->getMatchingProviders($inputPath);
|
||||
@ -68,5 +70,5 @@ if(count($oldProviderClasses) > 1){
|
||||
$oldProviderClass = array_shift($oldProviderClasses);
|
||||
$oldProvider = $oldProviderClass->fromPath($inputPath);
|
||||
|
||||
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], realpath($backupPath), GlobalLogger::get());
|
||||
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], $backupPath, GlobalLogger::get());
|
||||
$converter->execute();
|
||||
|
Loading…
x
Reference in New Issue
Block a user