mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
LightArray: do not accept NULL in the constructor
it makes more sense to pass LightArray::ZERO or just use LightArray::fill(0) if a zeroed light array is desired.
This commit is contained in:
parent
be0cec531a
commit
5fbc842f7a
@ -45,12 +45,12 @@ final class LightArray{
|
||||
/** @var string */
|
||||
private $data;
|
||||
|
||||
public function __construct(?string $payload){
|
||||
if($payload !== null and ($len = strlen($payload)) !== 2048){
|
||||
public function __construct(string $payload){
|
||||
if(($len = strlen($payload)) !== 2048){
|
||||
throw new \InvalidArgumentException("Payload size must be 2048 bytes, but got $len bytes");
|
||||
}
|
||||
|
||||
$this->data = $payload ?? self::ZERO;
|
||||
$this->data = $payload;
|
||||
$this->collectGarbage();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user