Compare commits

..

No commits in common. '3bfc073211590cfc2fedb962ab77d516f88a8bcd' and 'cd3624704ebd2ef6f6b21cb139e3b82a9e866147' have entirely different histories.

@ -7,14 +7,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
php: ['7.4', '8.0'] php: [7.4]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install dependencies - name: Install dependencies
run: composer install --no-interaction --no-progress run: composer install --no-interaction --no-progress
- name: Run tests - name: Run tests
run: php${{ matrix.php }} vendor/bin/phpunit --configuration Tests/phpunit.xml --verbose --fail-on-warning run: php${{ matrix.php }} vendor/bin/phpunit --configuration Tests/phpunit.xml --verbose --fail-on-warning
- name: Run phpstan
run: php${{ matrix.php }} vendor/bin/phpstan
- name: Run psalm - name: Run psalm
run: php${{ matrix.php }} vendor/bin/psalm run: php${{ matrix.php }} vendor/bin/psalm

@ -4,8 +4,8 @@
use xPaw\SourceQuery\SourceQuery; use xPaw\SourceQuery\SourceQuery;
// For the sake of this example // For the sake of this example
header( 'Content-Type: text/plain' ); Header( 'Content-Type: text/plain' );
header( 'X-Content-Type-Options: nosniff' ); Header( 'X-Content-Type-Options: nosniff' );
// Edit this -> // Edit this ->
define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_ADDR', 'localhost' );

@ -4,8 +4,8 @@
use xPaw\SourceQuery\SourceQuery; use xPaw\SourceQuery\SourceQuery;
// For the sake of this example // For the sake of this example
header( 'Content-Type: text/plain' ); Header( 'Content-Type: text/plain' );
header( 'X-Content-Type-Options: nosniff' ); Header( 'X-Content-Type-Options: nosniff' );
// Edit this -> // Edit this ->
define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_ADDR', 'localhost' );

@ -10,13 +10,13 @@
define( 'SQ_ENGINE', SourceQuery::SOURCE ); define( 'SQ_ENGINE', SourceQuery::SOURCE );
// Edit this <- // Edit this <-
$Timer = microtime( true ); $Timer = MicroTime( true );
$Query = new SourceQuery( ); $Query = new SourceQuery( );
$Info = []; $Info = Array( );
$Rules = []; $Rules = Array( );
$Players = []; $Players = Array( );
$Exception = null; $Exception = null;
try try
@ -37,7 +37,7 @@
$Query->Disconnect( ); $Query->Disconnect( );
} }
$Timer = number_format( microtime( true ) - $Timer, 4, '.', '' ); $Timer = Number_Format( MicroTime( true ) - $Timer, 4, '.', '' );
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -103,12 +103,12 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if( !empty( $Info ) ): ?> <?php if( Is_Array( $Info ) ): ?>
<?php foreach( $Info as $InfoKey => $InfoValue ): ?> <?php foreach( $Info as $InfoKey => $InfoValue ): ?>
<tr> <tr>
<td><?php echo htmlspecialchars( $InfoKey ); ?></td> <td><?php echo htmlspecialchars( $InfoKey ); ?></td>
<td><?php <td><?php
if( is_array( $InfoValue ) ) if( Is_Array( $InfoValue ) )
{ {
echo "<pre>"; echo "<pre>";
print_r( $InfoValue ); print_r( $InfoValue );
@ -176,7 +176,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if( !empty( $Rules ) ): ?> <?php if( Is_Array( $Rules ) ): ?>
<?php foreach( $Rules as $Rule => $Value ): ?> <?php foreach( $Rules as $Rule => $Value ): ?>
<tr> <tr>
<td><?php echo htmlspecialchars( $Rule ); ?></td> <td><?php echo htmlspecialchars( $Rule ); ?></td>

@ -25,7 +25,7 @@
*/ */
abstract class BaseSocket abstract class BaseSocket
{ {
/** @var ?resource */ /** @var resource */
public $Socket; public $Socket;
public int $Engine; public int $Engine;
@ -108,30 +108,30 @@
} }
while( $ReadMore && $SherlockFunction( $Buffer, $Length ) ); while( $ReadMore && $SherlockFunction( $Buffer, $Length ) );
$Data = implode( $Packets ); $Data = Implode( $Packets );
// TODO: Test this // TODO: Test this
if( $IsCompressed ) if( $IsCompressed )
{ {
// Let's make sure this function exists, it's not included in PHP by default // Let's make sure this function exists, it's not included in PHP by default
if( !function_exists( 'bzdecompress' ) ) if( !Function_Exists( 'bzdecompress' ) )
{ {
throw new \RuntimeException( 'Received compressed packet, PHP doesn\'t have Bzip2 library installed, can\'t decompress.' ); throw new \RuntimeException( 'Received compressed packet, PHP doesn\'t have Bzip2 library installed, can\'t decompress.' );
} }
$Data = bzdecompress( $Data ); $Data = bzdecompress( $Data );
if( !is_string( $Data ) || crc32( $Data ) !== $PacketChecksum ) if( !is_string( $Data ) || CRC32( $Data ) !== $PacketChecksum )
{ {
throw new InvalidPacketException( 'CRC32 checksum mismatch of uncompressed packet data.', InvalidPacketException::CHECKSUM_MISMATCH ); throw new InvalidPacketException( 'CRC32 checksum mismatch of uncompressed packet data.', InvalidPacketException::CHECKSUM_MISMATCH );
} }
} }
$Buffer->Set( substr( $Data, 4 ) ); $Buffer->Set( SubStr( $Data, 4 ) );
} }
else else
{ {
throw new InvalidPacketException( 'Socket read: Raw packet header mismatch. (0x' . dechex( $Header ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); throw new InvalidPacketException( 'Socket read: Raw packet header mismatch. (0x' . DecHex( $Header ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
} }
return $Buffer; return $Buffer;

@ -44,7 +44,7 @@
public function Set( string $Buffer ) : void public function Set( string $Buffer ) : void
{ {
$this->Buffer = $Buffer; $this->Buffer = $Buffer;
$this->Length = strlen( $Buffer ); $this->Length = StrLen( $Buffer );
$this->Position = 0; $this->Position = 0;
} }
@ -81,7 +81,7 @@
return ''; return '';
} }
$Data = substr( $this->Buffer, $this->Position, $Length ); $Data = SubStr( $this->Buffer, $this->Position, $Length );
$this->Position += $Length; $this->Position += $Length;
@ -93,7 +93,7 @@
*/ */
public function GetByte( ) : int public function GetByte( ) : int
{ {
return ord( $this->Get( 1 ) ); return Ord( $this->Get( 1 ) );
} }
/** /**
@ -106,7 +106,7 @@
throw new InvalidPacketException( 'Not enough data to unpack a short.', InvalidPacketException::BUFFER_EMPTY ); throw new InvalidPacketException( 'Not enough data to unpack a short.', InvalidPacketException::BUFFER_EMPTY );
} }
$Data = unpack( 'v', $this->Get( 2 ) ); $Data = UnPack( 'v', $this->Get( 2 ) );
return (int)$Data[ 1 ]; return (int)$Data[ 1 ];
} }
@ -121,7 +121,7 @@
throw new InvalidPacketException( 'Not enough data to unpack a long.', InvalidPacketException::BUFFER_EMPTY ); throw new InvalidPacketException( 'Not enough data to unpack a long.', InvalidPacketException::BUFFER_EMPTY );
} }
$Data = unpack( 'l', $this->Get( 4 ) ); $Data = UnPack( 'l', $this->Get( 4 ) );
return (int)$Data[ 1 ]; return (int)$Data[ 1 ];
} }
@ -136,7 +136,7 @@
throw new InvalidPacketException( 'Not enough data to unpack a float.', InvalidPacketException::BUFFER_EMPTY ); throw new InvalidPacketException( 'Not enough data to unpack a float.', InvalidPacketException::BUFFER_EMPTY );
} }
$Data = unpack( 'f', $this->Get( 4 ) ); $Data = UnPack( 'f', $this->Get( 4 ) );
return (float)$Data[ 1 ]; return (float)$Data[ 1 ];
} }
@ -151,7 +151,7 @@
throw new InvalidPacketException( 'Not enough data to unpack an usigned long.', InvalidPacketException::BUFFER_EMPTY ); throw new InvalidPacketException( 'Not enough data to unpack an usigned long.', InvalidPacketException::BUFFER_EMPTY );
} }
$Data = unpack( 'V', $this->Get( 4 ) ); $Data = UnPack( 'V', $this->Get( 4 ) );
return (int)$Data[ 1 ]; return (int)$Data[ 1 ];
} }
@ -161,7 +161,7 @@
*/ */
public function GetString( ) : string public function GetString( ) : string
{ {
$ZeroBytePosition = strpos( $this->Buffer, "\0", $this->Position ); $ZeroBytePosition = StrPos( $this->Buffer, "\0", $this->Position );
if( $ZeroBytePosition === false ) if( $ZeroBytePosition === false )
{ {

@ -53,10 +53,10 @@
public function Write( int $Header, string $String = '' ) : bool public function Write( int $Header, string $String = '' ) : bool
{ {
$Command = pack( 'cccca*', 0xFF, 0xFF, 0xFF, 0xFF, $String ); $Command = Pack( 'cccca*', 0xFF, 0xFF, 0xFF, 0xFF, $String );
$Length = strlen( $Command ); $Length = StrLen( $Command );
return $Length === fwrite( $this->Socket->Socket, $Command, $Length ); return $Length === FWrite( $this->Socket->Socket, $Command, $Length );
} }
/** /**
@ -89,7 +89,7 @@
//$StringBuffer .= SubStr( $Packet, 0, -2 ); //$StringBuffer .= SubStr( $Packet, 0, -2 );
// Let's assume if this packet is not long enough, there are no more after this one // Let's assume if this packet is not long enough, there are no more after this one
$ReadMore = strlen( $Packet ) > 1000; // use 1300? $ReadMore = StrLen( $Packet ) > 1000; // use 1300?
if( $ReadMore ) if( $ReadMore )
{ {
@ -140,6 +140,6 @@
throw new AuthenticationException( 'Failed to get RCON challenge.', AuthenticationException::BAD_PASSWORD ); throw new AuthenticationException( 'Failed to get RCON challenge.', AuthenticationException::BAD_PASSWORD );
} }
$this->RconChallenge = trim( $Buffer->Get( ) ); $this->RconChallenge = Trim( $Buffer->Get( ) );
} }
} }

@ -29,7 +29,7 @@
{ {
if( $this->Socket !== null ) if( $this->Socket !== null )
{ {
fclose( $this->Socket ); FClose( $this->Socket );
$this->Socket = null; $this->Socket = null;
} }
@ -42,24 +42,23 @@
$this->Port = $Port; $this->Port = $Port;
$this->Address = $Address; $this->Address = $Address;
$Socket = @fsockopen( 'udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout ); $this->Socket = @FSockOpen( 'udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout );
if( $ErrNo || $Socket === false ) if( $ErrNo || $this->Socket === false )
{ {
throw new SocketException( 'Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET ); throw new SocketException( 'Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET );
} }
$this->Socket = $Socket; Stream_Set_Timeout( $this->Socket, $Timeout );
stream_set_timeout( $this->Socket, $Timeout ); Stream_Set_Blocking( $this->Socket, true );
stream_set_blocking( $this->Socket, true );
} }
public function Write( int $Header, string $String = '' ) : bool public function Write( int $Header, string $String = '' ) : bool
{ {
$Command = pack( 'ccccca*', 0xFF, 0xFF, 0xFF, 0xFF, $Header, $String ); $Command = Pack( 'ccccca*', 0xFF, 0xFF, 0xFF, 0xFF, $Header, $String );
$Length = strlen( $Command ); $Length = StrLen( $Command );
return $Length === fwrite( $this->Socket, $Command, $Length ); return $Length === FWrite( $this->Socket, $Command, $Length );
} }
/** /**
@ -72,7 +71,7 @@
public function Read( int $Length = 1400 ) : Buffer public function Read( int $Length = 1400 ) : Buffer
{ {
$Buffer = new Buffer( ); $Buffer = new Buffer( );
$Buffer->Set( fread( $this->Socket, $Length ) ); $Buffer->Set( FRead( $this->Socket, $Length ) );
$this->ReadInternal( $Buffer, $Length, [ $this, 'Sherlock' ] ); $this->ReadInternal( $Buffer, $Length, [ $this, 'Sherlock' ] );
@ -81,9 +80,9 @@
public function Sherlock( Buffer $Buffer, int $Length ) : bool public function Sherlock( Buffer $Buffer, int $Length ) : bool
{ {
$Data = fread( $this->Socket, $Length ); $Data = FRead( $this->Socket, $Length );
if( strlen( $Data ) < 4 ) if( StrLen( $Data ) < 4 )
{ {
return false; return false;
} }

@ -240,8 +240,8 @@
$Server[ 'Players' ] = $Buffer->GetByte( ); $Server[ 'Players' ] = $Buffer->GetByte( );
$Server[ 'MaxPlayers' ] = $Buffer->GetByte( ); $Server[ 'MaxPlayers' ] = $Buffer->GetByte( );
$Server[ 'Protocol' ] = $Buffer->GetByte( ); $Server[ 'Protocol' ] = $Buffer->GetByte( );
$Server[ 'Dedicated' ] = chr( $Buffer->GetByte( ) ); $Server[ 'Dedicated' ] = Chr( $Buffer->GetByte( ) );
$Server[ 'Os' ] = chr( $Buffer->GetByte( ) ); $Server[ 'Os' ] = Chr( $Buffer->GetByte( ) );
$Server[ 'Password' ] = $Buffer->GetByte( ) === 1; $Server[ 'Password' ] = $Buffer->GetByte( ) === 1;
$Server[ 'IsMod' ] = $Buffer->GetByte( ) === 1; $Server[ 'IsMod' ] = $Buffer->GetByte( ) === 1;
@ -266,7 +266,7 @@
if( $Type !== self::S2A_INFO_SRC ) if( $Type !== self::S2A_INFO_SRC )
{ {
throw new InvalidPacketException( 'GetInfo: Packet header mismatch. (0x' . dechex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); throw new InvalidPacketException( 'GetInfo: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
} }
$Server[ 'Protocol' ] = $Buffer->GetByte( ); $Server[ 'Protocol' ] = $Buffer->GetByte( );
@ -278,8 +278,8 @@
$Server[ 'Players' ] = $Buffer->GetByte( ); $Server[ 'Players' ] = $Buffer->GetByte( );
$Server[ 'MaxPlayers' ] = $Buffer->GetByte( ); $Server[ 'MaxPlayers' ] = $Buffer->GetByte( );
$Server[ 'Bots' ] = $Buffer->GetByte( ); $Server[ 'Bots' ] = $Buffer->GetByte( );
$Server[ 'Dedicated' ] = chr( $Buffer->GetByte( ) ); $Server[ 'Dedicated' ] = Chr( $Buffer->GetByte( ) );
$Server[ 'Os' ] = chr( $Buffer->GetByte( ) ); $Server[ 'Os' ] = Chr( $Buffer->GetByte( ) );
$Server[ 'Password' ] = $Buffer->GetByte( ) === 1; $Server[ 'Password' ] = $Buffer->GetByte( ) === 1;
$Server[ 'Secure' ] = $Buffer->GetByte( ) === 1; $Server[ 'Secure' ] = $Buffer->GetByte( ) === 1;
@ -390,7 +390,7 @@
if( $Type !== self::S2A_PLAYER ) if( $Type !== self::S2A_PLAYER )
{ {
throw new InvalidPacketException( 'GetPlayers: Packet header mismatch. (0x' . dechex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); throw new InvalidPacketException( 'GetPlayers: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
} }
$Players = []; $Players = [];
@ -403,7 +403,7 @@
$Player[ 'Name' ] = $Buffer->GetString( ); $Player[ 'Name' ] = $Buffer->GetString( );
$Player[ 'Frags' ] = $Buffer->GetLong( ); $Player[ 'Frags' ] = $Buffer->GetLong( );
$Player[ 'Time' ] = (int)$Buffer->GetFloat( ); $Player[ 'Time' ] = (int)$Buffer->GetFloat( );
$Player[ 'TimeF' ] = gmdate( ( $Player[ 'Time' ] > 3600 ? 'H:i:s' : 'i:s' ), $Player[ 'Time' ] ); $Player[ 'TimeF' ] = GMDate( ( $Player[ 'Time' ] > 3600 ? "H:i:s" : "i:s" ), $Player[ 'Time' ] );
$Players[ ] = $Player; $Players[ ] = $Player;
} }
@ -435,7 +435,7 @@
if( $Type !== self::S2A_RULES ) if( $Type !== self::S2A_RULES )
{ {
throw new InvalidPacketException( 'GetRules: Packet header mismatch. (0x' . dechex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); throw new InvalidPacketException( 'GetRules: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
} }
$Rules = []; $Rules = [];
@ -446,7 +446,7 @@
$Rule = $Buffer->GetString( ); $Rule = $Buffer->GetString( );
$Value = $Buffer->GetString( ); $Value = $Buffer->GetString( );
if( !empty( $Rule ) ) if( !Empty( $Rule ) )
{ {
$Rules[ $Rule ] = $Value; $Rules[ $Rule ] = $Value;
} }
@ -497,7 +497,7 @@
} }
default: default:
{ {
throw new InvalidPacketException( 'GetChallenge: Packet header mismatch. (0x' . dechex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); throw new InvalidPacketException( 'GetChallenge: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
} }
} }
} }

@ -32,7 +32,7 @@
*/ */
private BaseSocket $Socket; private BaseSocket $Socket;
/** @var ?resource */ /** @var resource */
private $RconSocket; private $RconSocket;
private int $RconRequestId = 0; private int $RconRequestId = 0;
@ -45,7 +45,7 @@
{ {
if( $this->RconSocket ) if( $this->RconSocket )
{ {
fclose( $this->RconSocket ); FClose( $this->RconSocket );
$this->RconSocket = null; $this->RconSocket = null;
} }
@ -57,35 +57,34 @@
{ {
if( !$this->RconSocket ) if( !$this->RconSocket )
{ {
$RconSocket = @fsockopen( $this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout ); $this->RconSocket = @FSockOpen( $this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout );
if( $ErrNo || !$RconSocket ) if( $ErrNo || !$this->RconSocket )
{ {
throw new SocketException( 'Can\'t connect to RCON server: ' . $ErrStr, SocketException::CONNECTION_FAILED ); throw new SocketException( 'Can\'t connect to RCON server: ' . $ErrStr, SocketException::CONNECTION_FAILED );
} }
$this->RconSocket = $RconSocket; Stream_Set_Timeout( $this->RconSocket, $this->Socket->Timeout );
stream_set_timeout( $this->RconSocket, $this->Socket->Timeout ); Stream_Set_Blocking( $this->RconSocket, true );
stream_set_blocking( $this->RconSocket, true );
} }
} }
public function Write( int $Header, string $String = '' ) : bool public function Write( int $Header, string $String = '' ) : bool
{ {
// Pack the packet together // Pack the packet together
$Command = pack( 'VV', ++$this->RconRequestId, $Header ) . $String . "\x00\x00"; $Command = Pack( 'VV', ++$this->RconRequestId, $Header ) . $String . "\x00\x00";
// Prepend packet length // Prepend packet length
$Command = pack( 'V', strlen( $Command ) ) . $Command; $Command = Pack( 'V', StrLen( $Command ) ) . $Command;
$Length = strlen( $Command ); $Length = StrLen( $Command );
return $Length === fwrite( $this->RconSocket, $Command, $Length ); return $Length === FWrite( $this->RconSocket, $Command, $Length );
} }
public function Read( ) : Buffer public function Read( ) : Buffer
{ {
$Buffer = new Buffer( ); $Buffer = new Buffer( );
$Buffer->Set( fread( $this->RconSocket, 4 ) ); $Buffer->Set( FRead( $this->RconSocket, 4 ) );
if( $Buffer->Remaining( ) < 4 ) if( $Buffer->Remaining( ) < 4 )
{ {
@ -94,21 +93,23 @@
$PacketSize = $Buffer->GetLong( ); $PacketSize = $Buffer->GetLong( );
$Buffer->Set( fread( $this->RconSocket, $PacketSize ) ); $Buffer->Set( FRead( $this->RconSocket, $PacketSize ) );
$Data = $Buffer->Get( ); $Data = $Buffer->Get( );
$Remaining = $PacketSize - strlen( $Data ); $Remaining = $PacketSize - StrLen( $Data );
while( $Remaining > 0 ) while( $Remaining > 0 )
{ {
$Data2 = fread( $this->RconSocket, $Remaining ); $Data2 = FRead( $this->RconSocket, $Remaining );
$PacketSize = strlen( $Data2 ); $PacketSize = StrLen( $Data2 );
if( $PacketSize === 0 ) if( $PacketSize === 0 )
{ {
throw new InvalidPacketException( 'Read ' . strlen( $Data ) . ' bytes from socket, ' . $Remaining . ' remaining', InvalidPacketException::BUFFER_EMPTY ); throw new InvalidPacketException( 'Read ' . strlen( $Data ) . ' bytes from socket, ' . $Remaining . ' remaining', InvalidPacketException::BUFFER_EMPTY );
break;
} }
$Data .= $Data2; $Data .= $Data2;
@ -142,7 +143,7 @@
// We do this stupid hack to handle split packets // We do this stupid hack to handle split packets
// See https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Multiple-packet_Responses // See https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Multiple-packet_Responses
if( strlen( $Data ) >= 4000 ) if( StrLen( $Data ) >= 4000 )
{ {
$this->Write( SourceQuery::SERVERDATA_REQUESTVALUE ); $this->Write( SourceQuery::SERVERDATA_REQUESTVALUE );

@ -6,12 +6,10 @@
class TestableSocket extends BaseSocket class TestableSocket extends BaseSocket
{ {
/** @var \SplQueue<string> */
private \SplQueue $PacketQueue; private \SplQueue $PacketQueue;
public function __construct( ) public function __construct( )
{ {
/** @var \SplQueue<string> */
$this->PacketQueue = new \SplQueue(); $this->PacketQueue = new \SplQueue();
$this->PacketQueue->setIteratorMode( \SplDoublyLinkedList::IT_MODE_DELETE ); $this->PacketQueue->setIteratorMode( \SplDoublyLinkedList::IT_MODE_DELETE );
@ -43,7 +41,7 @@
public function Read( int $Length = 1400 ) : Buffer public function Read( int $Length = 1400 ) : Buffer
{ {
$Buffer = new Buffer( ); $Buffer = new Buffer( );
$Buffer->Set( $this->PacketQueue->shift() ); $Buffer->Set( (string)$this->PacketQueue->shift() );
$this->ReadInternal( $Buffer, $Length, [ $this, 'Sherlock' ] ); $this->ReadInternal( $Buffer, $Length, [ $this, 'Sherlock' ] );
@ -57,7 +55,7 @@
return false; return false;
} }
$Buffer->Set( $this->PacketQueue->shift() ); $Buffer->Set( (string)$this->PacketQueue->shift() );
return $Buffer->GetLong( ) === -2; return $Buffer->GetLong( ) === -2;
} }
@ -247,7 +245,6 @@
/** /**
* @dataProvider RulesProvider * @dataProvider RulesProvider
* @param array<string> $RawInput
*/ */
public function testGetRules( array $RawInput, array $ExpectedOutput ) : void public function testGetRules( array $RawInput, array $ExpectedOutput ) : void
{ {
@ -283,7 +280,6 @@
/** /**
* @dataProvider PlayersProvider * @dataProvider PlayersProvider
* @param array<string> $RawInput
*/ */
public function testGetPlayers( array $RawInput, array $ExpectedOutput ) : void public function testGetPlayers( array $RawInput, array $ExpectedOutput ) : void
{ {

@ -22,9 +22,8 @@
}, },
"require-dev": "require-dev":
{ {
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "9.2",
"vimeo/psalm": "^4.7", "vimeo/psalm": "^3.12"
"phpstan/phpstan": "^0.12.83"
}, },
"autoload": "autoload":
{ {

@ -1,8 +0,0 @@
parameters:
checkMissingIterableValueType: false
checkFunctionNameCase: true
level: 6
paths:
- .
excludes_analyse:
- vendor
Loading…
Cancel
Save