diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 8c35143..4424408 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -41,6 +41,5 @@ body: label: Optional packet capture logs description: | You can also provide tcpdump packet capture logs. - Example command: `tcpdump -i en0 port 1883 -w mqtt.pcap` + Example command: `tcpdump -i eth0 port 1883 -w mqtt.pcap` Please change the network card and port to match your environment, then attach `mqtt.pcap`. - diff --git a/.github/ISSUE_TEMPLATE/support-question.yml b/.github/ISSUE_TEMPLATE/support-question.yml index ec2ddc8..a031585 100644 --- a/.github/ISSUE_TEMPLATE/support-question.yml +++ b/.github/ISSUE_TEMPLATE/support-question.yml @@ -18,4 +18,3 @@ body: attributes: label: Context description: Add relevant code snippets, logs, or environment details. - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a2603f..7564fd9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] - swoole-version: [ 'v4.8.13', 'v5.1.8', 'v6.2.0', 'master' ] + swoole-version: [ 'v4.8.13', 'v5.1.8', 'v6.2.1', 'master' ] exclude: - php-version: '8.5' swoole-version: 'v5.1.8' @@ -36,7 +36,7 @@ jobs: - php-version: '8.3' swoole-version: 'v4.8.13' - php-version: '8.1' - swoole-version: 'v6.2.0' + swoole-version: 'v6.2.1' - php-version: '8.1' swoole-version: 'master' max-parallel: 10 diff --git a/src/BaseClient.php b/src/BaseClient.php index b688e33..4225410 100644 --- a/src/BaseClient.php +++ b/src/BaseClient.php @@ -179,15 +179,11 @@ public function setConnectData(array $connectData): self */ public function getConnectData(?string $key = null) { - if ($key) { - if (isset($this->connectData[$key])) { - return $this->connectData[$key]; - } - - return null; + if ($key === null) { + return $this->connectData; } - return $this->connectData; + return $this->connectData[$key] ?? null; } protected function isCoroutineClientType(): bool diff --git a/tests/Unit/ClientTest.php b/tests/Unit/ClientTest.php index 5543039..b413d33 100644 --- a/tests/Unit/ClientTest.php +++ b/tests/Unit/ClientTest.php @@ -39,7 +39,7 @@ public function testConnectException() public function testBase64() { $topic = 'simps-mqtt/test/base64'; - $base64 = base64_encode(file_get_contents(TESTS_DIR . '/files/wechat.jpg')); + $base64 = base64_encode(file_get_contents(TESTS_DIR . '/files/wechat.png')); $client = new MQTTClient(SIMPS_MQTT_REMOTE_HOST, SIMPS_MQTT_PORT, getTestConnectConfig()); $client->connect(false); $client->subscribe([$topic => 0]); diff --git a/tests/files/wechat.jpg b/tests/files/wechat.jpg deleted file mode 100644 index caaeea0..0000000 Binary files a/tests/files/wechat.jpg and /dev/null differ diff --git a/tests/files/wechat.png b/tests/files/wechat.png new file mode 100644 index 0000000..45683e6 Binary files /dev/null and b/tests/files/wechat.png differ