From 4209ab7b03ffc3f31d9e51e8ef6e7d6412ee9cde Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Wed, 7 Feb 2024 20:54:46 +0300 Subject: [PATCH] Fix psalm --- .github/workflows/static.yml | 11 ++++++++++- composer.json | 2 +- psalm.xml | 4 ++++ psalm74-80.xml | 19 +++++++++++++++++++ src/CsrfMiddleware.php | 1 - .../Storage/SessionCsrfTokenStorage.php | 1 - 6 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 psalm74-80.xml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 40ac260..d904be7 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -10,6 +10,7 @@ on: - 'phpunit.xml.dist' push: + branches: [ 'master' ] paths-ignore: - 'docs/**' - 'README.md' @@ -28,4 +29,12 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['7.4', '8.0', '8.1'] + ['8.1', '8.2', '8.3'] + psalm74-80: + uses: yiisoft/actions/.github/workflows/psalm.yml@master + with: + psalm-config: psalm74-80.xml + os: >- + ['ubuntu-latest'] + php: >- + ['7.4', '8.0'] diff --git a/composer.json b/composer.json index 9d637bf..dac960d 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "rector/rector": "^1.0.0", "roave/infection-static-analysis-plugin": "^1.16", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.30|^5.6", + "vimeo/psalm": "^4.30|^5.21", "yiisoft/di": "^1.1" }, "autoload": { diff --git a/psalm.xml b/psalm.xml index 277e73d..b48c894 100644 --- a/psalm.xml +++ b/psalm.xml @@ -13,4 +13,8 @@ + + + + diff --git a/psalm74-80.xml b/psalm74-80.xml new file mode 100644 index 0000000..d091d59 --- /dev/null +++ b/psalm74-80.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/src/CsrfMiddleware.php b/src/CsrfMiddleware.php index 467712c..cffab6c 100644 --- a/src/CsrfMiddleware.php +++ b/src/CsrfMiddleware.php @@ -98,7 +98,6 @@ private function getTokenFromRequest(ServerRequestInterface $request): ?string { $parsedBody = $request->getParsedBody(); - /** @var mixed $token */ $token = $parsedBody[$this->parameterName] ?? null; if (empty($token)) { $headers = $request->getHeader($this->headerName); diff --git a/src/Synchronizer/Storage/SessionCsrfTokenStorage.php b/src/Synchronizer/Storage/SessionCsrfTokenStorage.php index db47458..d9ff131 100644 --- a/src/Synchronizer/Storage/SessionCsrfTokenStorage.php +++ b/src/Synchronizer/Storage/SessionCsrfTokenStorage.php @@ -33,7 +33,6 @@ public function __construct(SessionInterface $session, string $key = self::KEY) public function get(): ?string { - /** @var mixed $value */ $value = $this->session->get($this->key); return is_string($value) ? $value : null; }