Skip to content

Commit 88accf9

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent c53a498 commit 88accf9

15 files changed

+15
-66
lines changed

JsonSerializer.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ public function toString(WampMessage $message): string
1414
'headers' => $message->getHeaders(),
1515
]);
1616

17-
if (JSON_ERROR_NONE !== json_last_error()) {
18-
throw new \InvalidArgumentException(sprintf(
19-
'The malformed json given. Error %s and message %s',
20-
json_last_error(),
21-
json_last_error_msg()
22-
));
17+
if (\JSON_ERROR_NONE !== json_last_error()) {
18+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
2319
}
2420

2521
return $json;
@@ -28,12 +24,8 @@ public function toString(WampMessage $message): string
2824
public function toMessage(string $string): WampMessage
2925
{
3026
$data = json_decode($string, true);
31-
if (JSON_ERROR_NONE !== json_last_error()) {
32-
throw new \InvalidArgumentException(sprintf(
33-
'The malformed json given. Error %s and message %s',
34-
json_last_error(),
35-
json_last_error_msg()
36-
));
27+
if (\JSON_ERROR_NONE !== json_last_error()) {
28+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
3729
}
3830

3931
return new WampMessage($data['body'], $data['properties'], $data['headers']);

SerializerAwareTrait.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ trait SerializerAwareTrait
1111
*/
1212
private $serializer;
1313

14-
/**
15-
* @param Serializer $serializer
16-
*/
1714
public function setSerializer(Serializer $serializer)
1815
{
1916
$this->serializer = $serializer;

Tests/Functional/WampConsumerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/**
1313
* @group functional
1414
* @group Wamp
15+
*
1516
* @retry 5
1617
*/
1718
class WampConsumerTest extends TestCase

Tests/Spec/JsonSerializerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testThrowIfFailedToEncodeMessageToJson()
3737

3838
$resource = fopen(__FILE__, 'r');
3939

40-
//guard
40+
// guard
4141
$this->assertIsResource($resource);
4242

4343
$message = new WampMessage('theBody', ['aProp' => $resource]);

Tests/Spec/WampConnectionFactoryTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111
class WampConnectionFactoryTest extends ConnectionFactorySpec
1212
{
13-
/**
14-
* {@inheritdoc}
15-
*/
1613
protected function createConnectionFactory()
1714
{
1815
return new WampConnectionFactory();

Tests/Spec/WampContextTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class WampContextTest extends ContextSpec
1313
{
1414
use WampExtension;
1515

16-
/**
17-
* {@inheritdoc}
18-
*/
1916
protected function createContext()
2017
{
2118
return $this->buildWampContext();

Tests/Spec/WampMessageTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111
class WampMessageTest extends MessageSpec
1212
{
13-
/**
14-
* {@inheritdoc}
15-
*/
1613
protected function createMessage()
1714
{
1815
return new WampMessage();

Tests/Spec/WampProducerTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class WampProducerTest extends ProducerSpec
1313
{
1414
use WampExtension;
1515

16-
/**
17-
* {@inheritdoc}
18-
*/
1916
protected function createProducer()
2017
{
2118
return $this->buildWampContext()->createProducer();

Tests/Spec/WampQueueTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111
class WampQueueTest extends QueueSpec
1212
{
13-
/**
14-
* {@inheritdoc}
15-
*/
1613
protected function createQueue()
1714
{
1815
return new WampDestination(self::EXPECTED_QUEUE_NAME);

Tests/Spec/WampTopicTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111
class WampTopicTest extends TopicSpec
1212
{
13-
/**
14-
* {@inheritdoc}
15-
*/
1613
protected function createTopic()
1714
{
1815
return new WampDestination(self::EXPECTED_TOPIC_NAME);

WampConnectionFactory.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ private function parseDsn(string $dsn): array
8888
$dsn = Dsn::parseFirst($dsn);
8989

9090
if (false === in_array($dsn->getSchemeProtocol(), ['wamp', 'ws'], true)) {
91-
throw new \LogicException(sprintf(
92-
'The given scheme protocol "%s" is not supported. It must be "wamp"',
93-
$dsn->getSchemeProtocol()
94-
));
91+
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "wamp"', $dsn->getSchemeProtocol()));
9592
}
9693

9794
return array_filter(array_replace($dsn->getQuery(), [

WampConsumer.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function receive(int $timeout = 0): ?Message
8484
}
8585

8686
if ($timeout > 0) {
87-
$timeout = $timeout / 1000;
87+
$timeout /= 1000;
8888
$timeout = $timeout >= 0.1 ? $timeout : 0.1;
8989

9090
$this->timer = $this->client->getLoop()->addTimer($timeout, function () {
@@ -112,8 +112,6 @@ public function receiveNoWait(): ?Message
112112
}
113113

114114
/**
115-
* {@inheritdoc}
116-
*
117115
* @param WampMessage $message
118116
*/
119117
public function acknowledge(Message $message): void
@@ -122,8 +120,6 @@ public function acknowledge(Message $message): void
122120
}
123121

124122
/**
125-
* {@inheritdoc}
126-
*
127123
* @param WampMessage $message
128124
*/
129125
public function reject(Message $message, bool $requeue = false): void

WampContext.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ public function getNewClient(): Client
9797
$client = call_user_func($this->clientFactory);
9898

9999
if (false == $client instanceof Client) {
100-
throw new \LogicException(sprintf(
101-
'The factory must return instance of "%s". But it returns %s',
102-
Client::class,
103-
is_object($client) ? get_class($client) : gettype($client)
104-
));
100+
throw new \LogicException(sprintf('The factory must return instance of "%s". But it returns %s', Client::class, is_object($client) ? $client::class : gettype($client)));
105101
}
106102

107103
$this->clients[] = $client;

WampProducer.php

+3-11
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public function __construct(WampContext $context)
4848
}
4949

5050
/**
51-
* {@inheritdoc}
52-
*
5351
* @param WampDestination $destination
5452
* @param WampMessage $message
5553
*/
@@ -113,11 +111,9 @@ public function send(Destination $destination, Message $message): void
113111
}
114112

115113
/**
116-
* {@inheritdoc}
117-
*
118114
* @return WampProducer
119115
*/
120-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
116+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
121117
{
122118
if (null === $deliveryDelay) {
123119
return $this;
@@ -132,11 +128,9 @@ public function getDeliveryDelay(): ?int
132128
}
133129

134130
/**
135-
* {@inheritdoc}
136-
*
137131
* @return WampProducer
138132
*/
139-
public function setPriority(int $priority = null): Producer
133+
public function setPriority(?int $priority = null): Producer
140134
{
141135
if (null === $priority) {
142136
return $this;
@@ -151,11 +145,9 @@ public function getPriority(): ?int
151145
}
152146

153147
/**
154-
* {@inheritdoc}
155-
*
156148
* @return WampProducer
157149
*/
158-
public function setTimeToLive(int $timeToLive = null): Producer
150+
public function setTimeToLive(?int $timeToLive = null): Producer
159151
{
160152
if (null === $timeToLive) {
161153
return $this;

WampSubscriptionConsumer.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function consume(int $timeout = 0): void
8484
}
8585

8686
if ($timeout > 0) {
87-
$timeout = $timeout / 1000;
87+
$timeout /= 1000;
8888
$timeout = $timeout >= 0.1 ? $timeout : 0.1;
8989

9090
$this->timer = $this->client->getLoop()->addTimer($timeout, function () {
@@ -100,14 +100,12 @@ public function consume(int $timeout = 0): void
100100
}
101101

102102
/**
103-
* {@inheritdoc}
104-
*
105103
* @param WampConsumer $consumer
106104
*/
107105
public function subscribe(Consumer $consumer, callable $callback): void
108106
{
109107
if (false == $consumer instanceof WampConsumer) {
110-
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, get_class($consumer)));
108+
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, $consumer::class));
111109
}
112110

113111
if ($this->client) {
@@ -127,14 +125,12 @@ public function subscribe(Consumer $consumer, callable $callback): void
127125
}
128126

129127
/**
130-
* {@inheritdoc}
131-
*
132128
* @param WampConsumer $consumer
133129
*/
134130
public function unsubscribe(Consumer $consumer): void
135131
{
136132
if (false == $consumer instanceof WampConsumer) {
137-
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, get_class($consumer)));
133+
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', WampConsumer::class, $consumer::class));
138134
}
139135

140136
if ($this->client) {

0 commit comments

Comments
 (0)