Skip to content

Commit

Permalink
forwards compatibility with PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Jul 22, 2019
1 parent 9ed930c commit a7cc103
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/NBTStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public function get($len) : string{
return substr($this->buffer, $this->offset);
}

return $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len);
return $len === 1 ? $this->buffer[$this->offset++] : substr($this->buffer, ($this->offset += $len) - $len, $len);
}

public function put(string $v) : void{
$this->buffer .= $v;
}

public function feof() : bool{
return !isset($this->buffer{$this->offset});
return !isset($this->buffer[$this->offset]);
}

/**
Expand Down Expand Up @@ -320,12 +320,12 @@ private static function tagFromArray(NamedTag $tag, array $data, callable $guess
$isIntArray = false;
}
}
$tag{$key} = $isNumeric ? ($isIntArray ? new IntArrayTag($key, []) : new ListTag($key, [])) : new CompoundTag($key, []);
$tag[$key] = $isNumeric ? ($isIntArray ? new IntArrayTag($key, []) : new ListTag($key, [])) : new CompoundTag($key, []);
self::tagFromArray($tag->{$key}, $value, $guesser);
}else{
$v = call_user_func($guesser, $key, $value);
if($v instanceof NamedTag){
$tag{$key} = $v;
$tag[$key] = $v;
}
}
}
Expand Down

0 comments on commit a7cc103

Please sign in to comment.