Skip to content

Commit

Permalink
Migrate Psalm to PHPstan
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 2, 2024
1 parent 5429e5a commit 6d76caf
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 82 deletions.
27 changes: 6 additions & 21 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ jobs:
with:
# Should be the higest supported version, so we can use the newest tools
php-version: '8.4'
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
# optional performance gain for psalm: opcache
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
tools: composer, composer-require-checker, composer-unused, phpcs, phpstan
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
Expand Down Expand Up @@ -88,27 +87,13 @@ jobs:
- name: PHP Code Sniffer
run: phpcs

- name: Psalm
continue-on-error: true
run: |
psalm -c psalm.xml \
--show-info=true \
--shepherd \
--php-version=${{ steps.setup-php.outputs.php-version }}
- name: Psalm (testsuite)
- name: PHPStan
run: |
psalm -c psalm-dev.xml \
--show-info=true \
--shepherd \
--php-version=${{ steps.setup-php.outputs.php-version }}
vendor/bin/phpstan analyze -c phpstan.neon --debug
- name: Psalter
- name: PHPStan (testsuite)
run: |
psalm --alter \
--issues=UnnecessaryVarAnnotation \
--dry-run \
--php-version=${{ steps.setup-php.outputs.php-version }}
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
security:
name: Security checks
Expand Down
4 changes: 4 additions & 0 deletions phpstan-dev.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 9
paths:
- tests
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 6
paths:
- src
27 changes: 0 additions & 27 deletions psalm-dev.xml

This file was deleted.

30 changes: 0 additions & 30 deletions psalm.xml

This file was deleted.

8 changes: 4 additions & 4 deletions src/Auth/Source/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ class Hash extends UserPassBase
* Our users, stored in an associative array. The key of the array is "<username>:<passwordhash>",
* while the value of each element is a new array with the attributes for each user.
*
* @var array
* @var array<string, array>
*/
private array $users;

Check failure on line 31 in src/Auth/Source/Hash.php

View workflow job for this annotation

GitHub Actions / Quality control

Property SimpleSAML\Module\authcrypt\Auth\Source\Hash::$users type has no value type specified in iterable type array.


/**
* Constructor for this authentication source.
*
* @param array $info Information about this authentication source.
* @param array $config Configuration.
* @param array<string, mixed> $info Information about this authentication source.
* @param array<string, mixed> $config Configuration.
*
* @throws \Exception in case of a configuration error.
*/
Expand Down Expand Up @@ -87,7 +87,7 @@ public function __construct(array $info, array $config)
* @param string $username The username the user wrote.
* @param string $password The password the user wrote.
*
* @return array Associative array with the users attributes.
* @return array<string, array> Associative array with the users attributes.
*
* @throws \SimpleSAML\Error\Error if authentication fails.
*/
Expand Down

0 comments on commit 6d76caf

Please sign in to comment.