From 2dbc2dbbb9f3ea1dbcb63989995260cb9337a5f5 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 31 May 2023 12:40:03 +0200 Subject: [PATCH] add phpstan --- .github/workflows/ci.yml | 18 ++++++++++++++++++ composer.json | 3 ++- src/Bunny/Protocol/AbstractFrame.php | 1 + src/Bunny/Protocol/ContentHeaderFrame.php | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d78f24..f48e9af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,24 @@ jobs: - uses: actions/checkout@v2 - id: supported-versions-matrix uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 + static-anylsis: + name: "Run static analysis" + runs-on: ubuntu-latest + strategy: + fail-fast: true + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + extensions: mbstring, ctype, iconv, bcmath, filter, json + tools: composer + - name: Install Dependencies + uses: ramsey/composer-install@v2 + - name: Run PHPStan + run: ./vendor/bin/phpstan analyze src --level 0 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/composer.json b/composer.json index b4273e8..7121f38 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "require-dev": { "ext-pcntl": "*", "phpunit/phpunit": "^9.5 || ^7.5.20", - "symfony/process": "^6.1 || ^4.4" + "symfony/process": "^6.1 || ^4.4", + "phpstan/phpstan": "^1.10" }, "suggest": { "ext-pcntl": "For using synchronous AMQP/RabbitMQ client" diff --git a/src/Bunny/Protocol/AbstractFrame.php b/src/Bunny/Protocol/AbstractFrame.php index a502ddb..bc32efa 100644 --- a/src/Bunny/Protocol/AbstractFrame.php +++ b/src/Bunny/Protocol/AbstractFrame.php @@ -18,6 +18,7 @@ * uint8 uint16 uint32 size octets uint8 * * @author Jakub Kulhan + * @phpstan-consistent-constructor */ abstract class AbstractFrame { diff --git a/src/Bunny/Protocol/ContentHeaderFrame.php b/src/Bunny/Protocol/ContentHeaderFrame.php index 1b43ffa..146facb 100644 --- a/src/Bunny/Protocol/ContentHeaderFrame.php +++ b/src/Bunny/Protocol/ContentHeaderFrame.php @@ -17,6 +17,7 @@ * * * @author Jakub Kulhan + * @phpstan-consistent-constructor */ class ContentHeaderFrame extends AbstractFrame {