Skip to content

Commit

Permalink
Running php-cs-fixer
Browse files Browse the repository at this point in the history
Running php-cs-fixer to fix CS drift
  • Loading branch information
JimTools committed Jan 17, 2025
1 parent 1a3a5d4 commit 1bce9fe
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 54 deletions.
20 changes: 10 additions & 10 deletions ConsumedMessageStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

class ConsumedMessageStats implements Stats
{
const STATUS_ACK = 'acknowledged';
const STATUS_REJECTED = 'rejected';
const STATUS_REQUEUED = 'requeued';
const STATUS_FAILED = 'failed';
public const STATUS_ACK = 'acknowledged';
public const STATUS_REJECTED = 'rejected';
public const STATUS_REQUEUED = 'requeued';
public const STATUS_FAILED = 'failed';

/**
* @var string
Expand Down Expand Up @@ -102,12 +102,12 @@ public function __construct(
array $properties,
bool $redelivered,
string $status,
string $errorClass = null,
string $errorMessage = null,
int $errorCode = null,
string $errorFile = null,
int $errorLine = null,
string $trace = null
?string $errorClass = null,
?string $errorMessage = null,
?int $errorCode = null,
?string $errorFile = null,
?int $errorLine = null,
?string $trace = null,
) {
$this->consumerId = $consumerId;
$this->timestampMs = $timestampMs;
Expand Down
12 changes: 6 additions & 6 deletions ConsumerStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ public function __construct(
int $requeued,
int $memoryUsage,
float $systemLoad,
string $errorClass = null,
string $errorMessage = null,
int $errorCode = null,
string $errorFile = null,
int $errorLine = null,
string $trace = null
?string $errorClass = null,
?string $errorMessage = null,
?int $errorCode = null,
?string $errorFile = null,
?int $errorLine = null,
?string $trace = null,
) {
$this->consumerId = $consumerId;
$this->timestampMs = $timestampMs;
Expand Down
12 changes: 2 additions & 10 deletions DatadogStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct($config = 'datadog:')
$this->config = $this->prepareConfig($config);

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

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

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

/**
* @param $config
*
* @return array
*/
private function prepareConfig($config): array
{
if (empty($config)) {
Expand Down
21 changes: 5 additions & 16 deletions InfluxDbStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public function __construct($config = 'influxdb:')
// and causes library to use defaults.
@trigger_error(
sprintf('Passing %s as %s argument is deprecated. Pass it as "client" array property or use createWithClient instead',
Client::class,
__METHOD__
), E_USER_DEPRECATED);
Client::class,
__METHOD__
), \E_USER_DEPRECATED);
$this->client = $config;
$config = [];
} else {
Expand All @@ -91,12 +91,7 @@ public function __construct($config = 'influxdb:')

if (null !== $config['client']) {
if (!$config['client'] instanceof Client) {
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'])
));
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'])));
}
$this->client = $config['client'];
}
Expand All @@ -105,10 +100,7 @@ public function __construct($config = 'influxdb:')
}

/**
* @param Client $client
* @param string $config
*
* @return InfluxDbStorage
*/
public static function createWithClient(Client $client, $config = 'influxdb:'): self
{
Expand Down Expand Up @@ -254,10 +246,7 @@ private static function parseDsn(string $dsn): array
$dsn = Dsn::parseFirst($dsn);

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

return array_filter(array_replace($dsn->getQuery(), [
Expand Down
8 changes: 2 additions & 6 deletions JsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ public function toString(Stats $stats): string

$json = json_encode($data);

if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf(
'The malformed json given. Error %s and message %s',
json_last_error(),
json_last_error_msg()
));
if (\JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
}

return $json;
Expand Down
2 changes: 1 addition & 1 deletion Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class Resources
/**
* @var array
*/
private static $knownStorages = null;
private static $knownStorages;

private function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion SentMessageStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
?string $messageId,
?string $correlationId,
array $headers,
array $properties
array $properties,
) {
$this->timestampMs = $timestampMs;
$this->destination = $destination;
Expand Down
5 changes: 1 addition & 4 deletions WampStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ private function parseDsn(string $dsn): array
$dsn = Dsn::parseFirst($dsn);

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

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

0 comments on commit 1bce9fe

Please sign in to comment.