Skip to content
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
50 changes: 50 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: PHPStan

on:
pull_request:
push:
branches:
- main
- develop
- release/**
schedule:
# Run Monday morning at 3 o'clock
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: 0 3 * * 1
workflow_dispatch:

jobs:
phpstan:
runs-on: ubuntu-latest
env:
COMPOSER_NO_INTERACTION: 1

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- run: composer update --prefer-dist --no-progress

- run: composer phpstan -- --no-progress
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"illuminate/console": "^6|^7|^8",
"illuminate/routing": "^6|^7|^8",
"mockery/mockery": "^1.4",
"phpstan/phpstan": "^1",
"phpunit/phpunit": "^8.5|^9.4",
"rector/rector": "^0.12.4",
"vlucas/phpdotenv": "^5.2.0",
Expand Down Expand Up @@ -86,6 +87,8 @@
"scripts": {
"php-cs-fixer": "php-cs-fixer fix --diff",
"test": "phpunit --colors=always",
"test:ci": "composer test -- --verbose --coverage-text --coverage-clover=coverage.xml"
"test:ci": "composer test -- --verbose --coverage-text --coverage-clover=coverage.xml",
"phpstan": "phpstan analyse --memory-limit=256M",
"phpstan-baseline": "phpstan analyse --generate-baseline --memory-limit=256M"
}
}
62 changes: 62 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
parameters:
ignoreErrors:
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/Claims/Collection.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Claims\\\\Expiration\\:\\:validatePayload\\(\\) should return bool but return statement is missing\\.$#"
count: 1
path: src/Claims/Expiration.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Claims\\\\IssuedAt\\:\\:validatePayload\\(\\) should return bool but return statement is missing\\.$#"
count: 1
path: src/Claims/IssuedAt.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Claims\\\\IssuedAt\\:\\:validateRefresh\\(\\) should return bool but return statement is missing\\.$#"
count: 1
path: src/Claims/IssuedAt.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Claims\\\\NotBefore\\:\\:validatePayload\\(\\) should return bool but return statement is missing\\.$#"
count: 1
path: src/Claims/NotBefore.php

-
message: "#^Result of method PHPOpenSourceSaver\\\\JWTAuth\\\\Console\\\\JWTGenerateSecretCommand\\:\\:displayKey\\(\\) \\(void\\) is used\\.$#"
count: 1
path: src/Console/JWTGenerateSecretCommand.php

-
message: "#^Function config not found\\.$#"
count: 1
path: src/Providers/AbstractServiceProvider.php

-
message: "#^Function config_path not found\\.$#"
count: 1
path: src/Providers/LaravelServiceProvider.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Test\\\\Stubs\\\\LaravelUserStub\\:\\:getAuthIdentifierName\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: tests/Stubs/LaravelUserStub.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Test\\\\Stubs\\\\LaravelUserStub\\:\\:getAuthPassword\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: tests/Stubs/LaravelUserStub.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Test\\\\Stubs\\\\LaravelUserStub\\:\\:getRememberToken\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: tests/Stubs/LaravelUserStub.php

-
message: "#^Method PHPOpenSourceSaver\\\\JWTAuth\\\\Test\\\\Stubs\\\\LaravelUserStub\\:\\:getRememberTokenName\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: tests/Stubs/LaravelUserStub.php

7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- ./phpstan-baseline.neon
parameters:
level: 1
paths:
- src/
- tests/
4 changes: 4 additions & 0 deletions src/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public function __toString()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
{
return Arr::has($this->toArray(), $key);
Expand All @@ -227,6 +228,7 @@ public function offsetGet($key)
*
* @throws PayloadException
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
throw new PayloadException('The payload is immutable');
Expand All @@ -241,6 +243,7 @@ public function offsetSet($key, $value)
* @throws PayloadException
*
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
throw new PayloadException('The payload is immutable');
Expand All @@ -251,6 +254,7 @@ public function offsetUnset($key)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->toArray());
Expand Down