From 46f823eb182cdd05ab747b224899acbcae885f9b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 17 Feb 2022 08:37:19 -0600 Subject: [PATCH] chore: add phpstan for static analysis --- .github/workflows/tests.yml | 14 ++++++++++++++ src/JWT.php | 3 +++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 873eae24..80063a00 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,3 +41,17 @@ jobs: composer require friendsofphp/php-cs-fixer vendor/bin/php-cs-fixer fix --diff --dry-run . vendor/bin/php-cs-fixer fix --rules=native_function_invocation --allow-risky=yes --diff src + + staticanalysis: + runs-on: ubuntu-latest + name: PHPStan Static Analysis + steps: + - uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + - name: Run Script + run: | + composer global require phpstan/phpstan + ~/.composer/vendor/bin/phpstan analyse src diff --git a/src/JWT.php b/src/JWT.php index f5852dcd..b725aae4 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; use OpenSSLAsymmetricKey; +use TypeError; use UnexpectedValueException; use DateTime; use stdClass; @@ -229,6 +230,8 @@ public static function sign(string $msg, string|OpenSSLAsymmetricKey $key, strin throw new DomainException($e->getMessage(), 0, $e); } } + + throw new DomainException('Algorithm not supported'); } /**