Skip to content

Commit 1bce9fe

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent 1a3a5d4 commit 1bce9fe

8 files changed

+28
-54
lines changed

ConsumedMessageStats.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
class ConsumedMessageStats implements Stats
88
{
9-
const STATUS_ACK = 'acknowledged';
10-
const STATUS_REJECTED = 'rejected';
11-
const STATUS_REQUEUED = 'requeued';
12-
const STATUS_FAILED = 'failed';
9+
public const STATUS_ACK = 'acknowledged';
10+
public const STATUS_REJECTED = 'rejected';
11+
public const STATUS_REQUEUED = 'requeued';
12+
public const STATUS_FAILED = 'failed';
1313

1414
/**
1515
* @var string
@@ -102,12 +102,12 @@ public function __construct(
102102
array $properties,
103103
bool $redelivered,
104104
string $status,
105-
string $errorClass = null,
106-
string $errorMessage = null,
107-
int $errorCode = null,
108-
string $errorFile = null,
109-
int $errorLine = null,
110-
string $trace = null
105+
?string $errorClass = null,
106+
?string $errorMessage = null,
107+
?int $errorCode = null,
108+
?string $errorFile = null,
109+
?int $errorLine = null,
110+
?string $trace = null,
111111
) {
112112
$this->consumerId = $consumerId;
113113
$this->timestampMs = $timestampMs;

ConsumerStats.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public function __construct(
121121
int $requeued,
122122
int $memoryUsage,
123123
float $systemLoad,
124-
string $errorClass = null,
125-
string $errorMessage = null,
126-
int $errorCode = null,
127-
string $errorFile = null,
128-
int $errorLine = null,
129-
string $trace = null
124+
?string $errorClass = null,
125+
?string $errorMessage = null,
126+
?int $errorCode = null,
127+
?string $errorFile = null,
128+
?int $errorLine = null,
129+
?string $trace = null,
130130
) {
131131
$this->consumerId = $consumerId;
132132
$this->timestampMs = $timestampMs;

DatadogStorage.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($config = 'datadog:')
3030
$this->config = $this->prepareConfig($config);
3131

3232
if (null === $this->datadog) {
33-
if (true === filter_var($this->config['batched'], FILTER_VALIDATE_BOOLEAN)) {
33+
if (true === filter_var($this->config['batched'], \FILTER_VALIDATE_BOOLEAN)) {
3434
$this->datadog = new BatchedDogStatsd($this->config);
3535
} else {
3636
$this->datadog = new DogStatsd($this->config);
@@ -104,10 +104,7 @@ private function parseDsn(string $dsn): array
104104
$dsn = Dsn::parseFirst($dsn);
105105

106106
if ('datadog' !== $dsn->getSchemeProtocol()) {
107-
throw new \LogicException(sprintf(
108-
'The given scheme protocol "%s" is not supported. It must be "datadog"',
109-
$dsn->getSchemeProtocol()
110-
));
107+
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "datadog"', $dsn->getSchemeProtocol()));
111108
}
112109

113110
return array_filter(array_replace($dsn->getQuery(), [
@@ -132,11 +129,6 @@ private function parseDsn(string $dsn): array
132129
});
133130
}
134131

135-
/**
136-
* @param $config
137-
*
138-
* @return array
139-
*/
140132
private function prepareConfig($config): array
141133
{
142134
if (empty($config)) {

InfluxDbStorage.php

+5-16
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public function __construct($config = 'influxdb:')
6767
// and causes library to use defaults.
6868
@trigger_error(
6969
sprintf('Passing %s as %s argument is deprecated. Pass it as "client" array property or use createWithClient instead',
70-
Client::class,
71-
__METHOD__
72-
), E_USER_DEPRECATED);
70+
Client::class,
71+
__METHOD__
72+
), \E_USER_DEPRECATED);
7373
$this->client = $config;
7474
$config = [];
7575
} else {
@@ -91,12 +91,7 @@ public function __construct($config = 'influxdb:')
9191

9292
if (null !== $config['client']) {
9393
if (!$config['client'] instanceof Client) {
94-
throw new \InvalidArgumentException(sprintf(
95-
'%s configuration property is expected to be an instance of %s class. %s was passed instead.',
96-
'client',
97-
Client::class,
98-
gettype($config['client'])
99-
));
94+
throw new \InvalidArgumentException(sprintf('%s configuration property is expected to be an instance of %s class. %s was passed instead.', 'client', Client::class, gettype($config['client'])));
10095
}
10196
$this->client = $config['client'];
10297
}
@@ -105,10 +100,7 @@ public function __construct($config = 'influxdb:')
105100
}
106101

107102
/**
108-
* @param Client $client
109103
* @param string $config
110-
*
111-
* @return InfluxDbStorage
112104
*/
113105
public static function createWithClient(Client $client, $config = 'influxdb:'): self
114106
{
@@ -254,10 +246,7 @@ private static function parseDsn(string $dsn): array
254246
$dsn = Dsn::parseFirst($dsn);
255247

256248
if (false === in_array($dsn->getSchemeProtocol(), ['influxdb'], true)) {
257-
throw new \LogicException(sprintf(
258-
'The given scheme protocol "%s" is not supported. It must be "influxdb"',
259-
$dsn->getSchemeProtocol()
260-
));
249+
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "influxdb"', $dsn->getSchemeProtocol()));
261250
}
262251

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

JsonSerializer.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ public function toString(Stats $stats): string
2222

2323
$json = json_encode($data);
2424

25-
if (JSON_ERROR_NONE !== json_last_error()) {
26-
throw new \InvalidArgumentException(sprintf(
27-
'The malformed json given. Error %s and message %s',
28-
json_last_error(),
29-
json_last_error_msg()
30-
));
25+
if (\JSON_ERROR_NONE !== json_last_error()) {
26+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
3127
}
3228

3329
return $json;

Resources.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ final class Resources
77
/**
88
* @var array
99
*/
10-
private static $knownStorages = null;
10+
private static $knownStorages;
1111

1212
private function __construct()
1313
{

SentMessageStats.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
?string $messageId,
4949
?string $correlationId,
5050
array $headers,
51-
array $properties
51+
array $properties,
5252
) {
5353
$this->timestampMs = $timestampMs;
5454
$this->destination = $destination;

WampStorage.php

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

197197
if (false === in_array($dsn->getSchemeProtocol(), ['wamp', 'ws'], true)) {
198-
throw new \LogicException(sprintf(
199-
'The given scheme protocol "%s" is not supported. It must be "wamp"',
200-
$dsn->getSchemeProtocol()
201-
));
198+
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "wamp"', $dsn->getSchemeProtocol()));
202199
}
203200

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

0 commit comments

Comments
 (0)