Skip to content

Commit

Permalink
Psalm level 1 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Feb 9, 2024
1 parent 8b3fcef commit 5839332
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/static.yml
Expand Up @@ -29,4 +29,12 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
['8.1', '8.2', '8.3']
psalm80:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
psalm-config: psalm80.xml
os: >-
['ubuntu-latest']
php: >-
['8.0']
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -30,7 +30,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/aliases": "^3.0",
"yiisoft/di": "^1.2"
},
Expand Down
11 changes: 9 additions & 2 deletions psalm.xml
@@ -1,13 +1,20 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
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"
>
<projectFiles>
<directory name="src"/>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RiskyTruthyFalsyComparison errorLevel="suppress" />
</issueHandlers>
</psalm>
19 changes: 19 additions & 0 deletions psalm80.xml
@@ -0,0 +1,19 @@
<?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"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
</issueHandlers>
</psalm>
8 changes: 8 additions & 0 deletions src/FileCache.php
Expand Up @@ -418,6 +418,9 @@ private function validateKey(string $key): void
}
}

/**
* @param string[] $keys
*/
private function validateKeys(array $keys): void
{
foreach ($keys as $key) {
Expand All @@ -432,6 +435,11 @@ private function existsAndNotExpired(string $file): bool

/**
* Converts iterable to array.
*
* @psalm-template TKey
* @psalm-template TValue
* @psalm-param iterable<TKey, TValue> $iterable
* @psalm-return array<TKey, TValue>
*/
private function iterableToArray(iterable $iterable): array
{
Expand Down

0 comments on commit 5839332

Please sign in to comment.