Skip to content

Changed the implicit nullable type declaration to a nullable type declaration #66

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

Merged
merged 1 commit into from
May 19, 2025
Merged
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
6 changes: 3 additions & 3 deletions src/ConnectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(Application $application, array $config)
* @throws ConnectionNotAvailableException
* @throws ProtocolNotSupportedException
*/
public function connection(string $name = null): MqttClientContract
public function connection(?string $name = null): MqttClientContract
{
if ($name === null) {
$name = $this->defaultConnection;
Expand All @@ -79,7 +79,7 @@ public function connection(string $name = null): MqttClientContract
* @param string|null $connection
* @throws DataTransferException
*/
public function disconnect(string $connection = null): void
public function disconnect(?string $connection = null): void
{
if ($connection === null) {
$connection = $this->defaultConnection;
Expand All @@ -106,7 +106,7 @@ public function disconnect(string $connection = null): void
* @throws ProtocolNotSupportedException
* @throws RepositoryException
*/
public function publish(string $topic, string $message, bool $retain = false, string $connection = null): void
public function publish(string $topic, string $message, bool $retain = false, ?string $connection = null): void
{
$client = $this->connection($connection);

Expand Down
10 changes: 5 additions & 5 deletions src/Facades/MQTT.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use PhpMqtt\Client\Contracts\MqttClient;

/**
* @method static MqttClient connection(string $name = null)
* @method static void disconnect(string $connection = null)
* @method static void publish(string $topic, string $message, bool $retain = false, string $connection = null)
* @method static MqttClient connection(string|null $name = null)
* @method static void disconnect(string|null $connection = null)
* @method static void publish(string $topic, string $message, bool $retain = false, string|null $connection = null)
*
* @package PhpMqtt\Client\Facades
* @see ConnectionManager
Expand All @@ -21,9 +21,9 @@ class MQTT extends Facade
/**
* Get the registered name of the component.
*
* @return string
* @return class-string
*/
protected static function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return ConnectionManager::class;
}
Expand Down