Fixed and silenced some inspections

This commit is contained in:
Dylan K. Taylor
2017-02-23 15:10:23 +00:00
parent 99995579d7
commit f98a964cdc
6 changed files with 23 additions and 17 deletions

View File

@ -453,20 +453,21 @@ namespace pocketmine {
exit(1); //Exit with error
}
$gitHash = str_repeat("00", 20);
if(file_exists(\pocketmine\PATH . ".git/HEAD")){ //Found Git information!
$ref = trim(file_get_contents(\pocketmine\PATH . ".git/HEAD"));
if(preg_match('/^[0-9a-f]{40}$/i', $ref)){
define('pocketmine\GIT_COMMIT', strtolower($ref));
$gitHash = strtolower($ref);
}elseif(substr($ref, 0, 5) === "ref: "){
$refFile = \pocketmine\PATH . ".git/" . substr($ref, 5);
if(is_file($refFile)){
define('pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents($refFile))));
$gitHash = strtolower(trim(file_get_contents($refFile)));
}
}
}
if(!defined('pocketmine\GIT_COMMIT')){ //Unknown :(
define('pocketmine\GIT_COMMIT', str_repeat("00", 20));
}
define('pocketmine\GIT_COMMIT', $gitHash);
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);