Skip to content

Commit e26e6fb

Browse files
authored
Change the implicit nullable type declaration to a nullable type declaration (#66)
1 parent 40fa2e0 commit e26e6fb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/ConnectionManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(Application $application, array $config)
5454
* @throws ConnectionNotAvailableException
5555
* @throws ProtocolNotSupportedException
5656
*/
57-
public function connection(string $name = null): MqttClientContract
57+
public function connection(?string $name = null): MqttClientContract
5858
{
5959
if ($name === null) {
6060
$name = $this->defaultConnection;
@@ -79,7 +79,7 @@ public function connection(string $name = null): MqttClientContract
7979
* @param string|null $connection
8080
* @throws DataTransferException
8181
*/
82-
public function disconnect(string $connection = null): void
82+
public function disconnect(?string $connection = null): void
8383
{
8484
if ($connection === null) {
8585
$connection = $this->defaultConnection;
@@ -106,7 +106,7 @@ public function disconnect(string $connection = null): void
106106
* @throws ProtocolNotSupportedException
107107
* @throws RepositoryException
108108
*/
109-
public function publish(string $topic, string $message, bool $retain = false, string $connection = null): void
109+
public function publish(string $topic, string $message, bool $retain = false, ?string $connection = null): void
110110
{
111111
$client = $this->connection($connection);
112112

src/Facades/MQTT.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use PhpMqtt\Client\Contracts\MqttClient;
1010

1111
/**
12-
* @method static MqttClient connection(string $name = null)
13-
* @method static void disconnect(string $connection = null)
14-
* @method static void publish(string $topic, string $message, bool $retain = false, string $connection = null)
12+
* @method static MqttClient connection(string|null $name = null)
13+
* @method static void disconnect(string|null $connection = null)
14+
* @method static void publish(string $topic, string $message, bool $retain = false, string|null $connection = null)
1515
*
1616
* @package PhpMqtt\Client\Facades
1717
* @see ConnectionManager
@@ -21,9 +21,9 @@ class MQTT extends Facade
2121
/**
2222
* Get the registered name of the component.
2323
*
24-
* @return string
24+
* @return class-string
2525
*/
26-
protected static function getFacadeAccessor()
26+
protected static function getFacadeAccessor(): string
2727
{
2828
return ConnectionManager::class;
2929
}

0 commit comments

Comments
 (0)