Skip to content

Commit d8ce583

Browse files
committed
Replace Psalm with PHPstan
1 parent b969760 commit d8ce583

File tree

9 files changed

+28
-86
lines changed

9 files changed

+28
-86
lines changed

.github/workflows/php.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ jobs:
5151
with:
5252
# Should be the higest supported version, so we can use the newest tools
5353
php-version: '8.3'
54-
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
55-
# optional performance gain for psalm: opcache
56-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, opcache, openssl, pcre, posix, spl, xml
54+
tools: composer, composer-require-checker, composer-unused, phpcs
55+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, posix, spl, xml
5756

5857
- name: Setup problem matchers for PHP
5958
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
@@ -85,27 +84,13 @@ jobs:
8584
- name: PHP Code Sniffer
8685
run: phpcs
8786

88-
- name: Psalm
89-
continue-on-error: true
90-
run: |
91-
psalm -c psalm.xml \
92-
--show-info=true \
93-
--shepherd \
94-
--php-version=${{ steps.setup-php.outputs.php-version }}
95-
96-
- name: Psalm (testsuite)
87+
- name: PHPStan
9788
run: |
98-
psalm -c psalm-dev.xml \
99-
--show-info=true \
100-
--shepherd \
101-
--php-version=${{ steps.setup-php.outputs.php-version }}
89+
vendor/bin/phpstan analyze -c phpstan.neon --debug
10290
103-
- name: Psalter
91+
- name: PHPStan (testsuite)
10492
run: |
105-
psalm --alter \
106-
--issues=UnnecessaryVarAnnotation \
107-
--dry-run \
108-
--php-version=${{ steps.setup-php.outputs.php-version }}
93+
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
10994
11095
security:
11196
name: Security checks

phpstan-dev.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 9
3+
paths:
4+
- tests

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 6
3+
paths:
4+
- src

psalm-dev.xml

Lines changed: 0 additions & 27 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Auth/Source/Ldap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function loginSasl(string $username, #[\SensitiveParameter]string $pas
164164
*
165165
* @param string $username The username the user wrote.
166166
* @param string $password The password the user wrote.
167-
* @return array Associative array with the users attributes.
167+
* @return array<mixed> Associative array with the users attributes.
168168
*/
169169
protected function login(string $username, #[\SensitiveParameter]string $password): array
170170
{
@@ -176,7 +176,7 @@ protected function login(string $username, #[\SensitiveParameter]string $passwor
176176
* Attempt to find a user's attributes given its username.
177177
*
178178
* @param string $username The username who's attributes we want.
179-
* @return array Associative array with the users attributes.
179+
* @return array<mixed> Associative array with the users attributes.
180180
*/
181181
public function getAttributes(string $username): array
182182
{
@@ -232,7 +232,7 @@ public function getAttributes(string $username): array
232232

233233
/**
234234
* @param \Symfony\Component\Ldap\Entry $entry
235-
* @return array
235+
* @return array<mixed>
236236
*/
237237
private function processAttributes(Entry $entry): array
238238
{

src/Auth/Source/LdapMulti.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,22 @@ class LdapMulti extends UserPassOrgBase
3333

3434
/**
3535
* An array with mappings for organization => authsource.
36+
*
37+
* @param array<mixed>
3638
*/
3739
private array $mapping;
3840

3941
/**
4042
* An array with descriptions for organizations.
43+
*
44+
* @param array<mixed>
4145
*/
4246
private array $orgs;
4347

4448
/**
4549
* An array of organization IDs to LDAP configuration objects.
50+
*
51+
* @param array<mixed>
4652
*/
4753
private array $ldapOrgs;
4854

src/Connector/Ldap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Ldap implements ConnectorInterface
4444
* @param int $version
4545
* @param string $extension
4646
* @param bool $debug
47-
* @param array $options
47+
* @param array<mixed> $options
4848
*/
4949
public function __construct(
5050
string $connection_strings,

src/ConnectorInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public function whoami(): string;
6464
/**
6565
* Search the LDAP-directory for a specific object
6666
*
67-
* @param array $searchBase
67+
* @param string[] $searchBase
6868
* @param string $filter
69-
* @param array $options
69+
* @param array<mixed> $options
7070
* @param boolean $allowMissing
7171
* @return \Symfony\Component\Ldap\Entry|null The result of the search or null if none found
7272
* @psalm-return ($allowMissing is true ? \Symfony\Component\Ldap\Entry|null : \Symfony\Component\Ldap\Entry)
@@ -85,9 +85,9 @@ public function search(
8585
/**
8686
* Search the LDAP-directory for any object matching the search filter
8787
*
88-
* @param array $searchBase
88+
* @param string[] $searchBase
8989
* @param string $filter
90-
* @param array $options
90+
* @param array<mixed> $options
9191
* @param boolean $allowMissing
9292
* @return \Symfony\Component\Ldap\Entry[] The result of the search
9393
*

0 commit comments

Comments
 (0)