Skip to content

Commit

Permalink
Update vimeo/psalm requirement from ^4.18 to ^5.6 + fix BC checker (#44)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
  • Loading branch information
dependabot[bot] and vjik committed Feb 5, 2023
1 parent 60660c5 commit 21ce10b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/bc.yml
@@ -1,15 +1,13 @@
on:
pull_request:
push:
- pull_request
- push

name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
uses: yiisoft/actions/.github/workflows/bc.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -41,7 +41,7 @@
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.18"
"vimeo/psalm": "^4.30|^5.6"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
9 changes: 7 additions & 2 deletions src/Flash/Flash.php
Expand Up @@ -70,7 +70,10 @@ public function getAll(): array
public function set(string $key, $value = true, bool $removeAfterAccess = true): void
{
$flashes = $this->fetch();

/** @psalm-suppress MixedArrayAssignment */
$flashes[self::COUNTERS][$key] = $removeAfterAccess ? -1 : 0;

/** @var mixed */
$flashes[$key] = $value;
$this->save($flashes);
Expand All @@ -79,6 +82,8 @@ public function set(string $key, $value = true, bool $removeAfterAccess = true):
public function add(string $key, $value = true, bool $removeAfterAccess = true): void
{
$flashes = $this->fetch();

/** @psalm-suppress MixedArrayAssignment */
$flashes[self::COUNTERS][$key] = $removeAfterAccess ? -1 : 0;

if (empty($flashes[$key])) {
Expand Down Expand Up @@ -146,7 +151,7 @@ private function updateCounters(): void
* Obtains flash messages. Updates counters once per session.
*
* @return array Flash messages array.
* @psalm-return array{__counters:array<string,int>,mixed}
* @psalm-return array{__counters:array<string,int>}&array
*/
private function fetch(): array
{
Expand All @@ -157,7 +162,7 @@ private function fetch(): array
$this->updateCounters();
}

/** @psalm-var array{__counters:array<string,int>,mixed} */
/** @psalm-var array{__counters:array<string,int>}&array */
return $this->session->get(self::FLASH_PARAM, []);
}

Expand Down

0 comments on commit 21ce10b

Please sign in to comment.