Skip to content

Commit 4a84b80

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent 67a1ad2 commit 4a84b80

13 files changed

+41
-62
lines changed

BufferedStompClient.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ public function readMessageFrame(string $subscriptionId, int $timeout): ?Frame
103103
}
104104
}
105105

106-
/**
107-
* {@inheritdoc}
108-
*/
109106
public function disconnect($sync = false)
110107
{
111108
parent::disconnect($sync);

ExtensionType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class ExtensionType
88
{
9-
const ACTIVEMQ = 'activemq';
10-
const RABBITMQ = 'rabbitmq';
11-
const ARTEMIS = 'artemis';
9+
public const ACTIVEMQ = 'activemq';
10+
public const RABBITMQ = 'rabbitmq';
11+
public const ARTEMIS = 'artemis';
1212
}

StompConnectionFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class StompConnectionFactory implements ConnectionFactory
1515
{
16-
const SUPPORTED_SCHEMES = [
16+
public const SUPPORTED_SCHEMES = [
1717
ExtensionType::ACTIVEMQ,
1818
ExtensionType::RABBITMQ,
1919
ExtensionType::ARTEMIS,
@@ -120,7 +120,7 @@ private function parseDsn(string $dsn): array
120120
$dsn = Dsn::parseFirst($dsn);
121121

122122
if ('stomp' !== $dsn->getSchemeProtocol()) {
123-
throw new \LogicException(sprintf('The given DSN is not supported. Must start with "stomp:".'));
123+
throw new \LogicException('The given DSN is not supported. Must start with "stomp:".');
124124
}
125125

126126
$schemeExtension = current($dsn->getSchemeExtensions());

StompConsumer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
class StompConsumer implements Consumer
1717
{
18-
const ACK_AUTO = 'auto';
19-
const ACK_CLIENT = 'client';
20-
const ACK_CLIENT_INDIVIDUAL = 'client-individual';
18+
public const ACK_AUTO = 'auto';
19+
public const ACK_CLIENT = 'client';
20+
public const ACK_CLIENT_INDIVIDUAL = 'client-individual';
2121

2222
/**
2323
* @var StompDestination

StompContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function createMessage(string $body = '', array $properties = [], array $
7474
*/
7575
public function createQueue(string $name): Queue
7676
{
77-
if (0 !== strpos($name, '/')) {
77+
if (!str_starts_with($name, '/')) {
7878
$destination = new StompDestination($this->extensionType);
7979
$destination->setType(StompDestination::TYPE_QUEUE);
8080
$destination->setStompName($name);
@@ -101,7 +101,7 @@ public function createTemporaryQueue(): Queue
101101
*/
102102
public function createTopic(string $name): Topic
103103
{
104-
if (0 !== strpos($name, '/')) {
104+
if (!str_starts_with($name, '/')) {
105105
$destination = new StompDestination($this->extensionType);
106106
$destination->setType($this->useExchangePrefix ? StompDestination::TYPE_EXCHANGE : StompDestination::TYPE_TOPIC);
107107
$destination->setStompName($name);
@@ -130,7 +130,7 @@ public function createDestination(string $destination): StompDestination
130130

131131
foreach ($types as $_type) {
132132
$typePrefix = '/'.$_type.'/';
133-
if (0 === strpos($dest, $typePrefix)) {
133+
if (str_starts_with($dest, $typePrefix)) {
134134
$type = $_type;
135135
$dest = substr($dest, strlen($typePrefix));
136136

@@ -225,7 +225,7 @@ private function createStomp(): BufferedStompClient
225225
$stomp = call_user_func($this->stompFactory);
226226

227227
if (false == $stomp instanceof BufferedStompClient) {
228-
throw new \LogicException(sprintf('The factory must return instance of BufferedStompClient. It returns %s', is_object($stomp) ? get_class($stomp) : gettype($stomp)));
228+
throw new \LogicException(sprintf('The factory must return instance of BufferedStompClient. It returns %s', is_object($stomp) ? $stomp::class : gettype($stomp)));
229229
}
230230

231231
return $stomp;

StompDestination.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
class StompDestination implements Topic, Queue
1111
{
12-
const TYPE_TOPIC = 'topic';
13-
const TYPE_EXCHANGE = 'exchange';
14-
const TYPE_QUEUE = 'queue';
15-
const TYPE_AMQ_QUEUE = 'amq/queue';
16-
const TYPE_TEMP_QUEUE = 'temp-queue';
17-
const TYPE_REPLY_QUEUE = 'reply-queue';
12+
public const TYPE_TOPIC = 'topic';
13+
public const TYPE_EXCHANGE = 'exchange';
14+
public const TYPE_QUEUE = 'queue';
15+
public const TYPE_AMQ_QUEUE = 'amq/queue';
16+
public const TYPE_TEMP_QUEUE = 'temp-queue';
17+
public const TYPE_REPLY_QUEUE = 'reply-queue';
1818

19-
const HEADER_DURABLE = 'durable';
20-
const HEADER_AUTO_DELETE = 'auto-delete';
21-
const HEADER_EXCLUSIVE = 'exclusive';
19+
public const HEADER_DURABLE = 'durable';
20+
public const HEADER_AUTO_DELETE = 'auto-delete';
21+
public const HEADER_EXCLUSIVE = 'exclusive';
2222

2323
/**
2424
* @var string
@@ -122,7 +122,7 @@ public function getRoutingKey(): ?string
122122
return $this->routingKey;
123123
}
124124

125-
public function setRoutingKey(string $routingKey = null): void
125+
public function setRoutingKey(?string $routingKey = null): void
126126
{
127127
$this->routingKey = $routingKey;
128128
}

StompHeadersEncoder.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
class StompHeadersEncoder
88
{
9-
const PROPERTY_PREFIX = '_property_';
10-
const TYPE_PREFIX = '_type_';
11-
const TYPE_STRING = 's';
12-
const TYPE_INT = 'i';
13-
const TYPE_FLOAT = 'f';
14-
const TYPE_BOOL = 'b';
15-
const TYPE_NULL = 'n';
9+
public const PROPERTY_PREFIX = '_property_';
10+
public const TYPE_PREFIX = '_type_';
11+
public const TYPE_STRING = 's';
12+
public const TYPE_INT = 'i';
13+
public const TYPE_FLOAT = 'f';
14+
public const TYPE_BOOL = 'b';
15+
public const TYPE_NULL = 'n';
1616

1717
public static function encode(array $headers = [], array $properties = []): array
1818
{
@@ -36,7 +36,7 @@ public static function decode(array $headers = []): array
3636

3737
// separate headers/properties
3838
foreach ($headers as $key => $value) {
39-
if (0 === strpos($key, self::PROPERTY_PREFIX)) {
39+
if (str_starts_with($key, self::PROPERTY_PREFIX)) {
4040
$encodedProperties[substr($key, $prefixLength)] = $value;
4141
} else {
4242
$encodedHeaders[$key] = $value;
@@ -94,7 +94,7 @@ private static function doDecode(array $headers = []): array
9494

9595
foreach ($headers as $key => $value) {
9696
// skip type header
97-
if (0 === strpos($key, self::TYPE_PREFIX)) {
97+
if (str_starts_with($key, self::TYPE_PREFIX)) {
9898
continue;
9999
}
100100

StompMessage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function setRedelivered(bool $redelivered): void
120120
$this->redelivered = $redelivered;
121121
}
122122

123-
public function setCorrelationId(string $correlationId = null): void
123+
public function setCorrelationId(?string $correlationId = null): void
124124
{
125125
$this->setHeader('correlation_id', (string) $correlationId);
126126
}
@@ -130,7 +130,7 @@ public function getCorrelationId(): ?string
130130
return $this->getHeader('correlation_id');
131131
}
132132

133-
public function setMessageId(string $messageId = null): void
133+
public function setMessageId(?string $messageId = null): void
134134
{
135135
$this->setHeader('message_id', (string) $messageId);
136136
}
@@ -147,7 +147,7 @@ public function getTimestamp(): ?int
147147
return null === $value ? null : (int) $value;
148148
}
149149

150-
public function setTimestamp(int $timestamp = null): void
150+
public function setTimestamp(?int $timestamp = null): void
151151
{
152152
$this->setHeader('timestamp', $timestamp);
153153
}
@@ -157,12 +157,12 @@ public function getFrame(): ?Frame
157157
return $this->frame;
158158
}
159159

160-
public function setFrame(Frame $frame = null): void
160+
public function setFrame(?Frame $frame = null): void
161161
{
162162
$this->frame = $frame;
163163
}
164164

165-
public function setReplyTo(string $replyTo = null): void
165+
public function setReplyTo(?string $replyTo = null): void
166166
{
167167
$this->setHeader('reply-to', $replyTo);
168168
}

StompProducer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function send(Destination $destination, Message $message): void
4545
/**
4646
* @return $this|Producer
4747
*/
48-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
48+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
4949
{
5050
if (empty($deliveryDelay)) {
5151
return $this;
@@ -64,7 +64,7 @@ public function getDeliveryDelay(): ?int
6464
*
6565
* @return $this|Producer
6666
*/
67-
public function setPriority(int $priority = null): Producer
67+
public function setPriority(?int $priority = null): Producer
6868
{
6969
if (empty($priority)) {
7070
return $this;
@@ -81,7 +81,7 @@ public function getPriority(): ?int
8181
/**
8282
* @return $this|Producer
8383
*/
84-
public function setTimeToLive(int $timeToLive = null): Producer
84+
public function setTimeToLive(?int $timeToLive = null): Producer
8585
{
8686
if (empty($timeToLive)) {
8787
return $this;

Tests/Spec/StompMessageTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class StompMessageTest extends MessageSpec
99
{
10-
/**
11-
* {@inheritdoc}
12-
*/
1310
protected function createMessage()
1411
{
1512
return new StompMessage();

Tests/StompConnectionFactoryConfigTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function testThrowIfDsnCouldNotBeParsed()
4141

4242
/**
4343
* @dataProvider provideConfigs
44-
*
45-
* @param mixed $config
46-
* @param mixed $expectedConfig
4744
*/
4845
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
4946
{

Tests/StompHeadersEncoderTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function propertyValuesDataProvider()
3232

3333
/**
3434
* @dataProvider headerValuesDataProvider
35-
*
36-
* @param mixed $originalValue
37-
* @param mixed $encodedValue
3835
*/
3936
public function testShouldEncodeHeaders($originalValue, $encodedValue)
4037
{
@@ -43,9 +40,6 @@ public function testShouldEncodeHeaders($originalValue, $encodedValue)
4340

4441
/**
4542
* @dataProvider propertyValuesDataProvider
46-
*
47-
* @param mixed $originalValue
48-
* @param mixed $encodedValue
4943
*/
5044
public function testShouldEncodeProperties($originalValue, $encodedValue)
5145
{
@@ -54,9 +48,6 @@ public function testShouldEncodeProperties($originalValue, $encodedValue)
5448

5549
/**
5650
* @dataProvider headerValuesDataProvider
57-
*
58-
* @param mixed $originalValue
59-
* @param mixed $encodedValue
6051
*/
6152
public function testShouldDecodeHeaders($originalValue, $encodedValue)
6253
{
@@ -65,9 +56,6 @@ public function testShouldDecodeHeaders($originalValue, $encodedValue)
6556

6657
/**
6758
* @dataProvider propertyValuesDataProvider
68-
*
69-
* @param mixed $originalValue
70-
* @param mixed $encodedValue
7159
*/
7260
public function testShouldDecodeProperties($originalValue, $encodedValue)
7361
{

Tests/StompMessageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testShouldUnsetHeaderIfNullPassed()
9393

9494
$message->setHeader('aHeader', 'aVal');
9595

96-
//guard
96+
// guard
9797
$this->assertSame('aVal', $message->getHeader('aHeader'));
9898

9999
$message->setHeader('aHeader', null);
@@ -108,7 +108,7 @@ public function testShouldUnsetPropertyIfNullPassed()
108108

109109
$message->setProperty('aProperty', 'aVal');
110110

111-
//guard
111+
// guard
112112
$this->assertSame('aVal', $message->getProperty('aProperty'));
113113

114114
$message->setProperty('aProperty', null);

0 commit comments

Comments
 (0)