static analysis

This commit is contained in:
Dylan K. Taylor 2017-07-13 16:45:24 +01:00
parent 23866359c9
commit 4d874e7e78
6 changed files with 7 additions and 6 deletions

View File

@ -125,7 +125,7 @@ class FormattedCommandAlias extends Command{
$replacement = "";
if($rest and $position < count($args)){
for($i = $position; $i < count($args); ++$i){
for($i = $position, $c = count($args); $i < $c; ++$i){
if($i !== $position){
$replacement .= " ";
}

View File

@ -76,6 +76,8 @@ class Attribute{
* @param bool $shouldSend
*
* @return Attribute
*
* @throws \InvalidArgumentException
*/
public static function addAttribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend = true){
if($minValue > $maxValue or $defaultValue > $maxValue or $defaultValue < $minValue){

View File

@ -37,7 +37,7 @@ class BaseLang{
}
if(is_dir($path)){
$allFiles = scandir($path);
$allFiles = scandir($path, SCANDIR_SORT_NONE);
if($allFiles !== false){
$files = array_filter($allFiles, function($filename){

View File

@ -223,7 +223,7 @@ class McRegion extends BaseLevelProvider{
$isValid = (file_exists($path . "/level.dat") and is_dir($path . "/region/"));
if($isValid){
$files = array_filter(scandir($path . "/region/"), function($file){
$files = array_filter(scandir($path . "/region/", SCANDIR_SORT_NONE), function($file){
return substr($file, strrpos($file, ".") + 1, 2) === "mc"; //region file
});

View File

@ -64,7 +64,7 @@ class ResourcePackManager{
}
if(!file_exists($this->path . "resource_packs.yml")){
file_put_contents($this->path . "resource_packs.yml", file_get_contents($this->server->getFilePath() . "src/pocketmine/resources/resource_packs.yml"));
copy($this->server->getFilePath() . "src/pocketmine/resources/resource_packs.yml", $this->path . "resource_packs.yml");
}
$this->resourcePacksConfig = new Config($this->path . "resource_packs.yml", Config::YAML, []);

View File

@ -305,7 +305,6 @@ class Utils{
break;
case "bsd":
case "mac":
$processors = (int) `sysctl -n hw.ncpu`;
$processors = (int) `sysctl -n hw.ncpu`;
break;
case "win":
@ -477,7 +476,7 @@ class Utils{
public static function javaStringHash($string){
$hash = 0;
for($i = 0; $i < strlen($string); $i++){
for($i = 0, $len = strlen($string); $i < $len; $i++){
$ord = ord($string{$i});
if($ord & 0x80){
$ord -= 0x100;