Skip to content

Commit bc11436

Browse files
committed
Fix phpstan-issues and baseline
1 parent cd1c9c6 commit bc11436

File tree

6 files changed

+47
-3
lines changed

6 files changed

+47
-3
lines changed

phpstan-baseline-dev.neon

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Parameter \\#1 \\$array of function asort expects array, mixed given\\.$#"
5+
count: 4
6+
path: tests/src/Auth/Source/PasswordVerifyTest.php
7+
8+
-
9+
message: "#^Property SimpleSAML\\\\Test\\\\Module\\\\sqlauth\\\\Auth\\\\Source\\\\PasswordVerifyTest\\:\\:\\$config \\(array\\<string, string\\|null\\>\\) does not accept array\\<string, array\\<int, string\\>\\|string\\|null\\>\\.$#"
10+
count: 4
11+
path: tests/src/Auth/Source/PasswordVerifyTest.php
12+
13+
-
14+
message: "#^Parameter \\#1 \\$array of function asort expects array, mixed given\\.$#"
15+
count: 4
16+
path: tests/src/Auth/Source/SQLTest.php
17+
18+
-
19+
message: "#^Property SimpleSAML\\\\Test\\\\Module\\\\sqlauth\\\\Auth\\\\Source\\\\SQLTest\\:\\:\\$config \\(array\\<string, string\\|null\\>\\) does not accept array\\<string, array\\<int, string\\>\\|string\\|null\\>\\.$#"
20+
count: 4
21+
path: tests/src/Auth/Source/SQLTest.php

phpstan-dev.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ parameters:
22
level: 9
33
paths:
44
- tests
5+
includes:
6+
- phpstan-baseline-dev.neon

tests/src/Auth/Source/PasswordVerifyTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
*/
1515
class PasswordVerifyTest extends TestCase
1616
{
17+
/** @var array<string, string> */
1718
private array $info = ['AuthId' => 'testAuthId'];
1819

20+
/** @var array<string, string|null> */
1921
private array $config = [
2022
"dsn" => 'sqlite:file::memory:?cache=shared',
2123
"username" => "notused",

tests/src/Auth/Source/PasswordVerifyWrapper.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
1515

1616
class PasswordVerifyWrapper extends PasswordVerify
1717
{
18+
/**
19+
* @param array<mixed> $info
20+
* @param array<mixed> $config
21+
*/
1822
public function __construct(array $info, array $config)
1923
{
2024
parent::__construct($info, $config);
2125
}
2226

27+
28+
/**
29+
* @return array<mixed>
30+
*/
2331
public function callLogin(string $username, string $password): array
2432
{
2533
return $this->login($username, $password);

tests/src/Auth/Source/SQLTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
class SQLTest extends TestCase
1717
{
18+
/** @var array<string, string> */
1819
private array $info = ['AuthId' => 'testAuthId'];
20+
21+
/** @var array<string, string|null> */
1922
private array $config = [
2023
"dsn" => 'sqlite:file::memory:?cache=shared',
2124
"username" => "notused",
@@ -123,7 +126,7 @@ public function testBasicSingleUsernameRegexFailedLoginNonExistingUser(): void
123126
$this->assertCount(0, $ret);
124127
}
125128

126-
public function testBasicSingleFailedLogin()
129+
public function testBasicSingleFailedLogin(): void
127130
{
128131
$this->expectException(\SimpleSAML\Error\Error::class);
129132
// Wrong username/password
@@ -150,7 +153,7 @@ public function testJoinSingleSuccess(): void
150153
]);
151154
}
152155

153-
public function testJoinSingleFailedLogin()
156+
public function testJoinSingleFailedLogin(): void
154157
{
155158
$this->expectException(\SimpleSAML\Error\Error::class);
156159
// Wrong username/password
@@ -180,7 +183,7 @@ public function testMultiQuerySuccess(): void
180183
]);
181184
}
182185

183-
public function testMultiQueryFailedLogin()
186+
public function testMultiQueryFailedLogin(): void
184187
{
185188
$this->expectException(\SimpleSAML\Error\Error::class);
186189
// Wrong username/password

tests/src/Auth/Source/SQLWrapper.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
1515

1616
class SQLWrapper extends SQL
1717
{
18+
/**
19+
* @param array<mixed> $info
20+
* @param array<mixed> $config
21+
*/
1822
public function __construct(array $info, array $config)
1923
{
2024
parent::__construct($info, $config);
2125
}
2226

27+
28+
/**
29+
* @return array<mixed>
30+
*/
2331
public function callLogin(string $username, string $password): array
2432
{
2533
return $this->login($username, $password);

0 commit comments

Comments
 (0)