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