Skip to content

Commit a6e3d42

Browse files
committed
Fix deprecation warnings
1 parent 1b9cc87 commit a6e3d42

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

src/Contracts/ConsumerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
interface ConsumerBuilder extends InteractsWithConfigCallbacks
99
{
1010
/** Creates a new ConsumerBuilder instance. */
11-
public static function create(string $brokers, array $topics = [], string $groupId = null): self;
11+
public static function create(string $brokers, array $topics = [], ?string $groupId = null): self;
1212

1313
/** Subscribe to a Kafka topic. */
1414
public function subscribe(...$topics): self;

src/Contracts/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
interface Logger
99
{
10-
public function error(Message $message, Throwable $e = null, string $prefix = 'ERROR'): void;
10+
public function error(Message $message, ?Throwable $e = null, string $prefix = 'ERROR'): void;
1111
}

src/Contracts/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function fresh(): self;
1111
public function publish(?string $broker = null): MessageProducer;
1212

1313
/** Return a ConsumerBuilder instance. */
14-
public function consumer(array $topics = [], string $groupId = null, string $brokers = null): ConsumerBuilder;
14+
public function consumer(array $topics = [], ?string $groupId = null, ?string $brokers = null): ConsumerBuilder;
1515

1616
public function shouldFake(): self;
1717

src/Contracts/ProducerMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
interface ProducerMessage extends KafkaMessage
66
{
7-
public static function create(string $topicName = null, int $partition = RD_KAFKA_PARTITION_UA): ProducerMessage;
7+
public static function create(?string $topicName = null, int $partition = RD_KAFKA_PARTITION_UA): ProducerMessage;
88

99
public function withKey(mixed $key): ProducerMessage;
1010

src/Factory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Factory implements Manager
2222
private ?ProducerBuilder $builder = null;
2323

2424
/** Creates a new ProducerBuilder instance, setting brokers and topic. */
25-
public function publish(string $broker = null): MessageProducer
25+
public function publish(?string $broker = null): MessageProducer
2626
{
2727
if ($this->shouldFake) {
2828
return Kafka::fake()->publish($broker);
@@ -44,7 +44,7 @@ public function fresh(): self
4444
* The producer will be flushed only when the application terminates,
4545
* and doing SEND does not mean that the message was flushed!
4646
*/
47-
public function asyncPublish(string $broker = null): MessageProducer
47+
public function asyncPublish(?string $broker = null): MessageProducer
4848
{
4949
if ($this->shouldFake) {
5050
return Kafka::fake()->publish($broker);
@@ -63,13 +63,13 @@ public function asyncPublish(string $broker = null): MessageProducer
6363
}
6464

6565
/** This is an alias for the asyncPublish method. */
66-
public function publishAsync(string $broker = null): MessageProducer
66+
public function publishAsync(?string $broker = null): MessageProducer
6767
{
6868
return $this->asyncPublish($broker);
6969
}
7070

7171
/** Return a ConsumerBuilder instance. */
72-
public function consumer(array $topics = [], string $groupId = null, string $brokers = null): ConsumerBuilder
72+
public function consumer(array $topics = [], ?string $groupId = null, ?string $brokers = null): ConsumerBuilder
7373
{
7474
if ($this->shouldFake) {
7575
return Kafka::fake()->consumer(

src/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct()
3131
}
3232

3333
/** Log an error message. */
34-
public function error(Message $message, Throwable $e = null, string $prefix = 'ERROR'): void
34+
public function error(Message $message, ?Throwable $e = null, string $prefix = 'ERROR'): void
3535
{
3636
$this->logger->error("[{$prefix}] Error to consume message", [
3737
'message' => $message,

src/Message/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Message extends AbstractMessage implements Arrayable, ProducerMessage
1313
{
1414
/** Creates a new message instance.*/
1515
#[Pure]
16-
public static function create(string $topicName = null, int $partition = RD_KAFKA_PARTITION_UA): ProducerMessage
16+
public static function create(?string $topicName = null, int $partition = RD_KAFKA_PARTITION_UA): ProducerMessage
1717
{
1818
return new self($topicName, $partition);
1919
}

src/Producers/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
}
4040

4141
/** Return a new Junges\Commit\ProducerBuilder instance. */
42-
public static function create(string $broker = null): self
42+
public static function create(?string $broker = null): self
4343
{
4444
return new Builder(
4545
broker: $broker ?? config('kafka.brokers')

0 commit comments

Comments
 (0)