Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use explicitly nullable parameter types (implicit deprecated in php 8.4) #1369

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/amqp-bunny/AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(AmqpContext $context, InteropAmqpQueue $queue)
$this->flags = self::FLAG_NOPARAM;
}

public function setConsumerTag(string $consumerTag = null): void
public function setConsumerTag(?string $consumerTag = null): void
{
$this->consumerTag = $consumerTag;
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-bunny/AmqpProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function send(Destination $destination, Message $message): void
/**
* @return self
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
if (null === $this->delayStrategy) {
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
Expand All @@ -98,7 +98,7 @@ public function getDeliveryDelay(): ?int
/**
* @return self
*/
public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->priority = $priority;

Expand All @@ -113,7 +113,7 @@ public function getPriority(): ?int
/**
* @return self
*/
public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->timeToLive = $timeToLive;

Expand Down
2 changes: 1 addition & 1 deletion pkg/amqp-ext/AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(AmqpContext $context, InteropAmqpQueue $queue)
$this->flags = self::FLAG_NOPARAM;
}

public function setConsumerTag(string $consumerTag = null): void
public function setConsumerTag(?string $consumerTag = null): void
{
$this->consumerTag = $consumerTag;
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-ext/AmqpProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function send(Destination $destination, Message $message): void
}
}

public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
if (null === $this->delayStrategy) {
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
Expand All @@ -88,7 +88,7 @@ public function getDeliveryDelay(): ?int
return $this->deliveryDelay;
}

public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->priority = $priority;

Expand All @@ -100,7 +100,7 @@ public function getPriority(): ?int
return $this->priority;
}

public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->timeToLive = $timeToLive;

Expand Down
2 changes: 1 addition & 1 deletion pkg/amqp-lib/AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(AmqpContext $context, InteropAmqpQueue $queue)
$this->flags = self::FLAG_NOPARAM;
}

public function setConsumerTag(string $consumerTag = null): void
public function setConsumerTag(?string $consumerTag = null): void
{
$this->consumerTag = $consumerTag;
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-lib/AmqpProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function send(Destination $destination, Message $message): void
/**
* @return self
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
if (null === $this->delayStrategy) {
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
Expand All @@ -100,7 +100,7 @@ public function getDeliveryDelay(): ?int
/**
* @return self
*/
public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->priority = $priority;

Expand All @@ -115,7 +115,7 @@ public function getPriority(): ?int
/**
* @return self
*/
public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->timeToLive = $timeToLive;

Expand Down
2 changes: 1 addition & 1 deletion pkg/amqp-tools/DelayStrategyAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

interface DelayStrategyAware
{
public function setDelayStrategy(DelayStrategy $delayStrategy = null): self;
public function setDelayStrategy(?DelayStrategy $delayStrategy = null): self;
}
2 changes: 1 addition & 1 deletion pkg/amqp-tools/DelayStrategyAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait DelayStrategyAwareTrait
*/
protected $delayStrategy;

public function setDelayStrategy(DelayStrategy $delayStrategy = null): DelayStrategyAware
public function setDelayStrategy(?DelayStrategy $delayStrategy = null): DelayStrategyAware
{
$this->delayStrategy = $delayStrategy;

Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function send(Destination $destination, Message $message): void
{
}

public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
throw new \BadMethodCallException('This should not be called directly');
}
Expand All @@ -202,7 +202,7 @@ public function getDeliveryDelay(): ?int
throw new \BadMethodCallException('This should not be called directly');
}

public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
throw new \BadMethodCallException('This should not be called directly');
}
Expand All @@ -212,7 +212,7 @@ public function getPriority(): ?int
throw new \BadMethodCallException('This should not be called directly');
}

public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
throw new \BadMethodCallException('This should not be called directly');
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/async-event-dispatcher/AsyncEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
{
public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
$this->parentDispatch($event, $eventName);

Expand Down
2 changes: 1 addition & 1 deletion pkg/async-event-dispatcher/EventTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface EventTransformer
*
* @return Message
*/
public function toMessage($eventName, Event $event = null);
public function toMessage($eventName, ?Event $event = null);

/**
* If you able to transform message back to event return it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
{
public function toMessage($eventName, Event $event = null)
public function toMessage($eventName, ?Event $event = null)
{
return $this->context->createMessage(serialize($event));
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbal/DbalConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private function establishConnection(): Connection
return $this->connection;
}

private function parseDsn(string $dsn, array $config = null): array
private function parseDsn(string $dsn, ?array $config = null): array
{
$parsedDsn = Dsn::parseFirst($dsn);

Expand Down
18 changes: 9 additions & 9 deletions pkg/dbal/DbalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function setRedelivered(bool $redelivered): void
$this->redelivered = $redelivered;
}

public function setReplyTo(string $replyTo = null): void
public function setReplyTo(?string $replyTo = null): void
{
$this->setHeader('reply_to', $replyTo);
}
Expand All @@ -159,7 +159,7 @@ public function getPriority(): ?int
return $this->priority;
}

public function setPriority(int $priority = null): void
public function setPriority(?int $priority = null): void
{
$this->priority = $priority;
}
Expand All @@ -172,7 +172,7 @@ public function getDeliveryDelay(): ?int
/**
* Set delay in milliseconds.
*/
public function setDeliveryDelay(int $deliveryDelay = null): void
public function setDeliveryDelay(?int $deliveryDelay = null): void
{
$this->deliveryDelay = $deliveryDelay;
}
Expand All @@ -188,12 +188,12 @@ public function getTimeToLive(): ?int
/**
* Set time to live in milliseconds.
*/
public function setTimeToLive(int $timeToLive = null): void
public function setTimeToLive(?int $timeToLive = null): void
{
$this->timeToLive = $timeToLive;
}

public function setCorrelationId(string $correlationId = null): void
public function setCorrelationId(?string $correlationId = null): void
{
$this->setHeader('correlation_id', $correlationId);
}
Expand All @@ -203,7 +203,7 @@ public function getCorrelationId(): ?string
return $this->getHeader('correlation_id', null);
}

public function setMessageId(string $messageId = null): void
public function setMessageId(?string $messageId = null): void
{
$this->setHeader('message_id', $messageId);
}
Expand All @@ -220,7 +220,7 @@ public function getTimestamp(): ?int
return null === $value ? null : $value;
}

public function setTimestamp(int $timestamp = null): void
public function setTimestamp(?int $timestamp = null): void
{
$this->setHeader('timestamp', $timestamp);
}
Expand All @@ -240,7 +240,7 @@ public function getRedeliverAfter(): int
return $this->redeliverAfter;
}

public function setRedeliverAfter(int $redeliverAfter = null): void
public function setRedeliverAfter(?int $redeliverAfter = null): void
{
$this->redeliverAfter = $redeliverAfter;
}
Expand All @@ -250,7 +250,7 @@ public function getPublishedAt(): ?int
return $this->publishedAt;
}

public function setPublishedAt(int $publishedAt = null): void
public function setPublishedAt(?int $publishedAt = null): void
{
$this->publishedAt = $publishedAt;
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/dbal/DbalProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function send(Destination $destination, Message $message): void
}
}

public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
$this->deliveryDelay = $deliveryDelay;

Expand All @@ -140,7 +140,7 @@ public function getDeliveryDelay(): ?int
return $this->deliveryDelay;
}

public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->priority = $priority;

Expand All @@ -152,7 +152,7 @@ public function getPriority(): ?int
return $this->priority;
}

public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->timeToLive = $timeToLive;

Expand Down
8 changes: 4 additions & 4 deletions pkg/dbal/Tests/DbalConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function isRedelivered(): bool
throw new \BadMethodCallException('This should not be called directly');
}

public function setCorrelationId(string $correlationId = null): void
public function setCorrelationId(?string $correlationId = null): void
{
}

Expand All @@ -279,7 +279,7 @@ public function getCorrelationId(): ?string
throw new \BadMethodCallException('This should not be called directly');
}

public function setMessageId(string $messageId = null): void
public function setMessageId(?string $messageId = null): void
{
}

Expand All @@ -293,11 +293,11 @@ public function getTimestamp(): ?int
throw new \BadMethodCallException('This should not be called directly');
}

public function setTimestamp(int $timestamp = null): void
public function setTimestamp(?int $timestamp = null): void
{
}

public function setReplyTo(string $replyTo = null): void
public function setReplyTo(?string $replyTo = null): void
{
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/dsn/Dsn.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,27 @@ public function getQuery(): array
return $this->queryBag->toArray();
}

public function getString(string $name, string $default = null): ?string
public function getString(string $name, ?string $default = null): ?string
{
return $this->queryBag->getString($name, $default);
}

public function getDecimal(string $name, int $default = null): ?int
public function getDecimal(string $name, ?int $default = null): ?int
{
return $this->queryBag->getDecimal($name, $default);
}

public function getOctal(string $name, int $default = null): ?int
public function getOctal(string $name, ?int $default = null): ?int
{
return $this->queryBag->getOctal($name, $default);
}

public function getFloat(string $name, float $default = null): ?float
public function getFloat(string $name, ?float $default = null): ?float
{
return $this->queryBag->getFloat($name, $default);
}

public function getBool(string $name, bool $default = null): ?bool
public function getBool(string $name, ?bool $default = null): ?bool
{
return $this->queryBag->getBool($name, $default);
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/dsn/QueryBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function toArray(): array
return $this->query;
}

public function getString(string $name, string $default = null): ?string
public function getString(string $name, ?string $default = null): ?string
{
return array_key_exists($name, $this->query) ? $this->query[$name] : $default;
}

public function getDecimal(string $name, int $default = null): ?int
public function getDecimal(string $name, ?int $default = null): ?int
{
$value = $this->getString($name);
if (null === $value) {
Expand All @@ -40,7 +40,7 @@ public function getDecimal(string $name, int $default = null): ?int
return (int) $value;
}

public function getOctal(string $name, int $default = null): ?int
public function getOctal(string $name, ?int $default = null): ?int
{
$value = $this->getString($name);
if (null === $value) {
Expand All @@ -54,7 +54,7 @@ public function getOctal(string $name, int $default = null): ?int
return intval($value, 8);
}

public function getFloat(string $name, float $default = null): ?float
public function getFloat(string $name, ?float $default = null): ?float
{
$value = $this->getString($name);
if (null === $value) {
Expand All @@ -68,7 +68,7 @@ public function getFloat(string $name, float $default = null): ?float
return (float) $value;
}

public function getBool(string $name, bool $default = null): ?bool
public function getBool(string $name, ?bool $default = null): ?bool
{
$value = $this->getString($name);
if (null === $value) {
Expand Down
Loading