Added Inventory interfaces and types, updated long array() to []

This commit is contained in:
Shoghi Cervantes
2014-05-22 18:59:16 +02:00
parent 0be679c9d5
commit 6cbd39de9b
102 changed files with 637 additions and 334 deletions

View File

@ -113,7 +113,7 @@ class Binary{
*/
public static function readMetadata($value, $types = false){
$offset = 0;
$m = array();
$m = [];
$b = ord($value{$offset});
++$offset;
while($b !== 127 and isset($value{$offset})){
@ -143,7 +143,7 @@ class Binary{
$offset += $len;
break;
case 5:
$r = array();
$r = [];
$r[] = self::readLShort(substr($value, $offset, 2));
$offset += 2;
$r[] = ord($value{$offset});
@ -152,7 +152,7 @@ class Binary{
$offset += 2;
break;
case 6:
$r = array();
$r = [];
for($i = 0; $i < 3; ++$i){
$r[] = self::readLInt(substr($value, $offset, 4));
$offset += 4;

View File

@ -23,7 +23,7 @@ namespace pocketmine\utils;
class Cache{
public static $cached = array();
public static $cached = [];
/**
* Adds something to the cache

View File

@ -71,7 +71,7 @@ class Config{
* @param array $default Array with the default values, will be set if not existent
* @param null &$correct Sets correct to true if everything has been loaded correctly
*/
public function __construct($file, $type = Config::DETECT, $default = array(), &$correct = null){
public function __construct($file, $type = Config::DETECT, $default = [], &$correct = null){
$this->load($file, $type, $default);
$correct = $this->correct;
}
@ -102,12 +102,12 @@ class Config{
*
* @return bool
*/
public function load($file, $type = Config::DETECT, $default = array()){
public function load($file, $type = Config::DETECT, $default = []){
$this->correct = true;
$this->type = (int) $type;
$this->file = $file;
if(!is_array($default)){
$default = array();
$default = [];
}
if(!file_exists($file)){
$this->config = $default;
@ -275,7 +275,7 @@ class Config{
$final = array_pop($components);
foreach($components as $component){
if(!isset($currPath[$component])){
$currPath[$component] = array();
$currPath[$component] = [];
}
$currPath =& $currPath[$component];
}
@ -347,7 +347,7 @@ class Config{
foreach($default as $k => $v){
if(is_array($v)){
if(!isset($data[$k]) or !is_array($data[$k])){
$data[$k] = array();
$data[$k] = [];
}
$changed += $this->fillDefaults($v, $data[$k]);
}elseif(!isset($data[$k])){