Skip to content

Commit d9e389d

Browse files
authored
Merge pull request #12 from simplesamlphp/feature/replace-psalm
Feature/replace psalm
2 parents 6ad8877 + 11aa9f7 commit d9e389d

10 files changed

Lines changed: 88 additions & 109 deletions

File tree

.github/workflows/php.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
uses: shivammathur/setup-php@v2
116116
with:
117117
php-version: ${{ matrix.php-versions }}
118-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
118+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml, zip
119119
tools: composer
120120
ini-values: error_reporting=E_ALL
121121
coverage: none
@@ -162,9 +162,8 @@ jobs:
162162
with:
163163
# Should be the higest supported version, so we can use the newest tools
164164
php-version: '8.4'
165-
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
166-
# optional performance gain for psalm: opcache
167-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
165+
tools: composer, composer-require-checker, composer-unused, phpcs, phpstan
166+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
168167

169168
- name: Setup problem matchers for PHP
170169
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
@@ -196,27 +195,13 @@ jobs:
196195
- name: PHP Code Sniffer
197196
run: phpcs
198197

199-
- name: Psalm
200-
continue-on-error: true
201-
run: |
202-
psalm -c psalm.xml \
203-
--show-info=true \
204-
--shepherd \
205-
--php-version=${{ steps.setup-php.outputs.php-version }}
206-
207-
- name: Psalm (testsuite)
198+
- name: PHPStan
208199
run: |
209-
psalm -c psalm-dev.xml \
210-
--show-info=true \
211-
--shepherd \
212-
--php-version=${{ steps.setup-php.outputs.php-version }}
200+
vendor/bin/phpstan analyze -c phpstan.neon
213201
214-
- name: Psalter
202+
- name: PHPStan (testsuite)
215203
run: |
216-
psalm --alter \
217-
--issues=UnnecessaryVarAnnotation \
218-
--dry-run \
219-
--php-version=${{ steps.setup-php.outputs.php-version }}
204+
vendor/bin/phpstan analyze -c phpstan-dev.neon
220205
221206
security:
222207
name: Security checks

1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This is a combination of 2 commits.
2+
# This is the 1st commit message:
3+
4+
#eplace psalm with phpstan
5+
6+
# This is the commit message #2:
7+
8+
Replace psalm with phpstan
9+
10+
# Please enter the commit message for your changes. Lines starting
11+
# with '#' will be ignored, and an empty message aborts the commit.
12+
#
13+
# Date: Mon Aug 18 21:58:48 2025 +0200
14+
#
15+
# interactive rebase in progress; onto 1a4ff67
16+
# Last commands done (5 commands done):
17+
# pick 9e85746 Replace psalm with phpstan
18+
# squash e07af03 Replace psalm with phpstan
19+
# No commands remaining.
20+
# You are currently rebasing branch 'feature/replace-psalm' on '1a4ff67'.
21+
#
22+
# Changes to be committed:
23+
# modified: .github/workflows/php.yml
24+
# new file: phpstan-dev.neon
25+
# new file: phpstan.neon
26+
# deleted: psalm-dev.xml
27+
# deleted: psalm.xml
28+
# modified: src/Client.php
29+
# modified: src/Controller/CDC.php
30+
# modified: src/Server.php
31+
#

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 & 18 deletions
This file was deleted.

psalm.xml

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

src/Auth/Process/CDC.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CDC extends Auth\ProcessingFilter
3535
/**
3636
* Initialize this filter.
3737
*
38-
* @param array $config Configuration information about this filter.
38+
* @param array<mixed> $config Configuration information about this filter.
3939
* @param mixed $reserved For future use.
4040
*/
4141
public function __construct(array $config, $reserved)
@@ -54,7 +54,7 @@ public function __construct(array $config, $reserved)
5454
/**
5555
* Redirect to page setting CDC.
5656
*
57-
* @param array &$state The request state.
57+
* @param array<mixed> &$state The request state.
5858
*/
5959
public function process(array &$state): void
6060
{

src/Client.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@
1212

1313
class Client
1414
{
15-
/**
16-
* Our CDC domain.
17-
*
18-
* @var string
19-
*/
20-
private string $domain;
21-
2215
/**
2316
* The CDC server we send requests to.
2417
*
25-
* @var Server
18+
* @var \SimpleSAML\Module\cdc\Server
2619
*/
2720
private Server $server;
2821

@@ -32,17 +25,17 @@ class Client
3225
*
3326
* @param string $domain The domain we should query the server for.
3427
*/
35-
public function __construct(string $domain)
36-
{
37-
$this->domain = $domain;
28+
public function __construct(
29+
protected string $domain,
30+
) {
3831
$this->server = new Server($domain);
3932
}
4033

4134

4235
/**
4336
* Receive a CDC response.
4437
*
45-
* @return array|null The response, or NULL if no response is received.
38+
* @return array<mixed>|null The response, or NULL if no response is received.
4639
*/
4740
public function getResponse(): ?array
4841
{
@@ -55,7 +48,7 @@ public function getResponse(): ?array
5548
*
5649
* @param string $returnTo The URL we should return to afterwards.
5750
* @param string $op The operation we are performing.
58-
* @param array $params Additional parameters.
51+
* @param array<mixed> $params Additional parameters.
5952
*/
6053
public function sendRequest(string $returnTo, string $op, array $params = []): void
6154
{

src/Controller/CDC.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ public function resume(Request $request): RunnableResponse
8888
}
8989

9090
$state = Auth\State::loadState($response['id'], 'cdc:resume');
91-
if (is_null($state)) {
92-
throw new Error\NoState();
93-
}
94-
9591
return new RunnableResponse([Auth\ProcessingChain::class, 'resumeProcessing'], [$state]);
9692
}
9793
}

0 commit comments

Comments
 (0)