From 32c747c57af41b2f6261643b3f29000414630c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Mon, 20 May 2024 12:28:40 +0200 Subject: [PATCH] Remove unreachable condition This brings bunny to PHPStan Level 5 --- .github/workflows/ci.yml | 2 +- src/Connection.php | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 514e9b5..a29dda2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install Dependencies uses: ramsey/composer-install@v2 - name: Run PHPStan - run: ./vendor/bin/phpstan analyze src --level 0 + run: ./vendor/bin/phpstan analyze src --level 5 test: name: "Run Tests on PHP ${{ matrix.php }} against RabbitMQ ${{ matrix.rabbitmq }} (Composer: ${{ matrix.composer }}; TLS: ${{ matrix.ssl_test }})" runs-on: ubuntu-latest diff --git a/src/Connection.php b/src/Connection.php index bc039ba..a04035a 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -339,13 +339,7 @@ public function awaitConnectionClose(): Protocol\MethodConnectionCloseFrame $deferred = new Deferred(); $this->awaitList[] = [ 'filter' => function (Protocol\AbstractFrame $frame): bool { - if ($frame instanceof Protocol\MethodConnectionCloseFrame) { - return true; - } elseif ($frame instanceof Protocol\MethodConnectionCloseFrame) { - $this->connectionCloseOk(); - throw new ClientException($frame->replyText, $frame->replyCode); - } - return false; + return $frame instanceof Protocol\MethodConnectionCloseFrame; }, 'promise' => $deferred, ];