Skip to content

Commit

Permalink
style: set phpcs php version to 8.1 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Dec 14, 2022
1 parent 26bfe20 commit f868d20
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Expand Up @@ -6,7 +6,7 @@
<arg name="cache" value=".phpcs-cache" />
<arg name="colors" />

<config name="php_version" value="70400" />
<config name="php_version" value="81000" />

<!-- Ignore warnings, show progress of the run and show sniff names -->
<arg value="nps" />
Expand Down
24 changes: 12 additions & 12 deletions src/Clients/Consumer/KafkaConsumer.php
Expand Up @@ -31,7 +31,7 @@ final class KafkaConsumer extends RdKafkaConsumer

private bool $shouldRun = true;

public function __construct(ConsumerConfig $config, ?LoggerInterface $logger = null)
public function __construct(ConsumerConfig $config, LoggerInterface|null $logger = null)
{
$this->logger = $logger ?? new NullLogger();

Expand All @@ -48,7 +48,7 @@ function (RdKafkaConsumer $kafka, int $err, string $reason): void {

$rebalanceCallback =
/** @param array<string, TopicPartition>|null $partitions */
function (RdKafkaConsumer $kafka, int $err, ?array $partitions = null): void {
function (RdKafkaConsumer $kafka, int $err, array|null $partitions = null): void {
switch ($err) {
case RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS:
$this->logger->debug(
Expand Down Expand Up @@ -92,8 +92,8 @@ static function (TopicPartition $partition): string {
public function start(
int $timeoutMs,
callable $onSuccess,
?callable $onPartitionEof = null,
?callable $onTimedOut = null
callable|null $onPartitionEof = null,
callable|null $onTimedOut = null,
): void {
$this->doStart($timeoutMs, $onSuccess, $onPartitionEof, $onTimedOut);
}
Expand All @@ -105,8 +105,8 @@ public function start(
public function startBatch(
int $maxBatchSize,
int $timeoutMs,
?callable $processRecord = null,
?callable $onBatchProcessed = null
callable|null $processRecord = null,
callable|null $onBatchProcessed = null,
): void {
$batchTime = new BatchTime($timeoutMs, new DateTimeImmutable());
$consumerRecords = new ConsumerRecords();
Expand All @@ -119,7 +119,7 @@ function (Message $message) use (
$batchTime,
$processRecord,
$onBatchProcessed,
$consumerRecords
$consumerRecords,
): void {
$consumerRecords->add($message);
if ($processRecord !== null) {
Expand Down Expand Up @@ -152,8 +152,8 @@ function (Message $message) use (
private function doStart(
int $timeoutMs,
callable $onSuccess,
?callable $onPartitionEof = null,
?callable $onTimedOut = null
callable|null $onPartitionEof = null,
callable|null $onTimedOut = null,
): void {
$this->registerSignals($this->shouldRun);

Expand Down Expand Up @@ -199,14 +199,14 @@ private function doStart(
private function checkBatchTimedOut(
int $timeoutMs,
BatchTime $batchTime,
?callable $onBatchProcessed,
ConsumerRecords $consumerRecords
callable|null $onBatchProcessed,
ConsumerRecords $consumerRecords,
): callable {
return static function () use (
$timeoutMs,
$batchTime,
$onBatchProcessed,
$consumerRecords
$consumerRecords,
): void {
$remainingTimeout = $batchTime->endMsTimestamp - (new DateTimeImmutable())->getTimestamp() * 1000;

Expand Down
10 changes: 5 additions & 5 deletions src/Clients/Producer/KafkaProducer.php
Expand Up @@ -22,7 +22,7 @@ class KafkaProducer extends Producer
private $exitCallback;

/** @param callable(KafkaProducer):void|null $exitCallback */
public function __construct(ProducerConfig $config, ?callable $exitCallback = null)
public function __construct(ProducerConfig $config, callable|null $exitCallback = null)
{
$this->exitCallback = $exitCallback;

Expand All @@ -41,11 +41,11 @@ public function __destruct()
/** @param array<string, string>|null $headers */
public function produce(
string $topicName,
?int $partition,
int|null $partition,
string $value,
?string $key = null,
?array $headers = null,
?int $timestampMs = null
string|null $key = null,
array|null $headers = null,
int|null $timestampMs = null,
): void {
if ($partition < 0) {
throw new InvalidArgumentException(
Expand Down

0 comments on commit f868d20

Please sign in to comment.