DataPacket: apply @return void annotations to make phpstan happy

this eliminates 250+ errors on level 6.
This commit is contained in:
Dylan K. Taylor 2020-01-14 15:39:07 +00:00
parent 3400771770
commit 2d2c9379cd

View File

@ -77,6 +77,7 @@ abstract class DataPacket extends NetworkBinaryStream{
} }
/** /**
* @return void
* @throws \OutOfBoundsException * @throws \OutOfBoundsException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
@ -87,6 +88,7 @@ abstract class DataPacket extends NetworkBinaryStream{
} }
/** /**
* @return void
* @throws \OutOfBoundsException * @throws \OutOfBoundsException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
@ -100,6 +102,7 @@ abstract class DataPacket extends NetworkBinaryStream{
/** /**
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here. * Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
* *
* @return void
* @throws \OutOfBoundsException * @throws \OutOfBoundsException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
@ -107,6 +110,9 @@ abstract class DataPacket extends NetworkBinaryStream{
} }
/**
* @return void
*/
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->encodeHeader(); $this->encodeHeader();
@ -114,12 +120,17 @@ abstract class DataPacket extends NetworkBinaryStream{
$this->isEncoded = true; $this->isEncoded = true;
} }
/**
* @return void
*/
protected function encodeHeader(){ protected function encodeHeader(){
$this->putUnsignedVarInt(static::NETWORK_ID); $this->putUnsignedVarInt(static::NETWORK_ID);
} }
/** /**
* Note for plugin developers: If you're adding your own packets, you should perform encoding in here. * Note for plugin developers: If you're adding your own packets, you should perform encoding in here.
*
* @return void
*/ */
protected function encodePayload(){ protected function encodePayload(){
@ -137,6 +148,9 @@ abstract class DataPacket extends NetworkBinaryStream{
*/ */
abstract public function handle(NetworkSession $session) : bool; abstract public function handle(NetworkSession $session) : bool;
/**
* @return void
*/
public function clean(){ public function clean(){
$this->buffer = ""; $this->buffer = "";
$this->isEncoded = false; $this->isEncoded = false;