Skip to content

Commit

Permalink
Merge pull request #21 from clue-labs/imports
Browse files Browse the repository at this point in the history
Clean up imports and left-overs
  • Loading branch information
clue authored Aug 6, 2024
2 parents 18cc679 + b05307f commit 4320803
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/Clue/Redis/Protocol/Model/BulkReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Clue\Redis\Protocol\Model;

use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Serializer\SerializerInterface;

class BulkReply implements ModelInterface
Expand Down
4 changes: 2 additions & 2 deletions src/Clue/Redis/Protocol/Model/ErrorReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Clue\Redis\Protocol\Model;

use Exception;
use Clue\Redis\Protocol\Serializer\SerializerInterface;
use Exception;

/**
*
Expand All @@ -14,7 +14,7 @@ class ErrorReply extends Exception implements ModelInterface
/**
* create error status reply (single line error message)
*
* @param string|ErrorReplyException $message
* @param string $message
* @return string
*/
public function __construct($message, $code = 0, $previous = null)
Expand Down
1 change: 0 additions & 1 deletion src/Clue/Redis/Protocol/Model/IntegerReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Clue\Redis\Protocol\Model;

use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Serializer\SerializerInterface;

class IntegerReply implements ModelInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Clue/Redis/Protocol/Model/MultiBulkReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Clue\Redis\Protocol\Model;

use Clue\Redis\Protocol\Serializer\SerializerInterface;
use InvalidArgumentException;
use UnexpectedValueException;
use Clue\Redis\Protocol\Serializer\SerializerInterface;

class MultiBulkReply implements ModelInterface
{
Expand Down
3 changes: 0 additions & 3 deletions src/Clue/Redis/Protocol/Model/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Clue\Redis\Protocol\Model;

use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Model\BulkReply;
use Clue\Redis\Protocol\Model\MultiBulkReply;
use Clue\Redis\Protocol\Serializer\SerializerInterface;

class Request implements ModelInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Clue/Redis/Protocol/Model/StatusReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StatusReply implements ModelInterface
/**
* create status reply (single line message)
*
* @param string|Status $message
* @param string $message
* @return string
*/
public function __construct($message)
Expand Down
7 changes: 2 additions & 5 deletions src/Clue/Redis/Protocol/Parser/ParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Clue\Redis\Protocol\Parser;

use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Parser\ParserException;

interface ParserInterface
{
/**
Expand All @@ -20,8 +17,8 @@ interface ParserInterface
* message model will be returned once the parser has sufficient data.
*
* @param string $dataChunk
* @return ModelInterface[] 0+ message models
* @throws ParserException if the message can not be parsed
* @return \Clue\Redis\Protocol\Model\ModelInterface[] 0+ message models
* @throws \Clue\Redis\Protocol\Parser\ParserException if the message can not be parsed
* @see self::popIncomingModel()
*/
public function pushIncoming($dataChunk);
Expand Down
1 change: 0 additions & 1 deletion src/Clue/Redis/Protocol/Parser/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Clue\Redis\Protocol\Parser;

use Clue\Redis\Protocol\Parser\ParserException;
use Clue\Redis\Protocol\Model\Request;

class RequestParser implements ParserInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Clue/Redis/Protocol/Parser/ResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Clue\Redis\Protocol\Parser;

use Clue\Redis\Protocol\Parser\ParserInterface;
use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Model\BulkReply;
use Clue\Redis\Protocol\Model\ErrorReply;
use Clue\Redis\Protocol\Model\IntegerReply;
use Clue\Redis\Protocol\Model\MultiBulkReply;
use Clue\Redis\Protocol\Model\StatusReply;
use Clue\Redis\Protocol\Parser\ParserException;

/**
* Simple recursive redis wire protocol parser
Expand Down
3 changes: 1 addition & 2 deletions src/Clue/Redis/Protocol/Serializer/RecursiveSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace Clue\Redis\Protocol\Serializer;

use Clue\Redis\Protocol\Model\StatusReply;
use InvalidArgumentException;
use Exception;
use Clue\Redis\Protocol\Model\BulkReply;
use Clue\Redis\Protocol\Model\IntegerReply;
use Clue\Redis\Protocol\Model\ErrorReply;
use Clue\Redis\Protocol\Model\MultiBulkReply;
use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Model\MultiBulkReply;
use Clue\Redis\Protocol\Model\Request;

class RecursiveSerializer implements SerializerInterface
Expand Down
1 change: 0 additions & 1 deletion src/Clue/Redis/Protocol/Serializer/SerializerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Clue\Redis\Protocol\Serializer;

use Clue\Redis\Protocol\Model\ErrorReplyException;
use Clue\Redis\Protocol\Model\ModelInterface;
use Clue\Redis\Protocol\Model\MultiBulkReply;

Expand Down
2 changes: 1 addition & 1 deletion tests/Model/MultiBulkReplyTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Clue\Redis\Protocol\Model\MultiBulkReply;
use Clue\Redis\Protocol\Model\BulkReply;
use Clue\Redis\Protocol\Model\IntegerReply;
use Clue\Redis\Protocol\Model\MultiBulkReply;

class MultiBulkReplyTest extends AbstractModelTest
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Parser/AbstractParserTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Clue\Redis\Protocol\Parser\ParserInterface;
use Clue\Redis\Protocol\Parser\MessageBuffer;
use Clue\Redis\Protocol\Parser\ParserInterface;

abstract class AbstractParserTest extends TestCase
{
Expand All @@ -25,7 +25,7 @@ public function setUpParser()
public function testParsingMessageOne()
{
// getRequestMessage('test')
$message = $expected = "*1\r\n$4\r\ntest\r\n";
$message = "*1\r\n$4\r\ntest\r\n";

$models = $this->parser->pushIncoming($message);
$this->assertCount(1, $models);
Expand Down
7 changes: 4 additions & 3 deletions tests/Parser/RequestParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Clue\Redis\Protocol\Model\Request;
use Clue\Redis\Protocol\Parser\RequestParser;

class RequestParserTest extends AbstractParserTest
Expand Down Expand Up @@ -29,7 +30,7 @@ public function testSimplePingRequest()
* @param Request $expected
* @depends testSimplePingRequest
*/
public function testInlinePingRequest($expected)
public function testInlinePingRequest(Request $expected)
{
$message = "ping\r\n";

Expand Down Expand Up @@ -58,7 +59,7 @@ public function testIncompleteSuccessive()
$this->assertEquals(array(), $this->parser->pushIncoming("*1\r\n"));
$this->assertEquals(array(), $this->parser->pushIncoming("$4\r\n"));
$this->assertEquals(array(), $this->parser->pushIncoming("test"));
$this->assertCount(1, $models = $this->parser->pushIncoming("\r\n"));
$this->assertCount(1, $this->parser->pushIncoming("\r\n"));
}

public function testNullMultiBulkRequestIsIgnored()
Expand Down Expand Up @@ -86,7 +87,7 @@ public function testInlineParsesMultipleRequestsAtOnce()
{
$message = "hello\r\n\world\r\ntest\r\n";

$this->assertCount(3, $models = $this->parser->pushIncoming($message));
$this->assertCount(3, $this->parser->pushIncoming($message));
}


Expand Down

0 comments on commit 4320803

Please sign in to comment.