Skip to content

Commit a321840

Browse files
committed
Replace Psalm with PHPStan
1 parent 502ffb5 commit a321840

File tree

6 files changed

+19
-63
lines changed

6 files changed

+19
-63
lines changed

.gitattributes

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ codecov.yml export-ignore
55
.editorconfig export-ignore
66
.gitattributes export-ignore
77
.gitignore export-ignore
8-
psalm.xml export-ignore
9-
psalm-dev.xml export-ignore
8+
phpstan.neon export-ignore
9+
phpstan-dev.neon export-ignore
10+
phpstan-baseline.neon export-ignore
11+
phpstan-baseline-dev.neon export-ignore
1012
phpcs.xml export-ignore
1113
phpunit.xml export-ignore
1214
.php_cs.dist export-ignore

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: 8
3+
paths:
4+
- src

psalm-dev.xml

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

psalm.xml

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

src/Auth/Source/Radius.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Radius extends UserPassBase
3232
public const RADIUS_NAS_IDENTIFIER = 32;
3333

3434
/**
35-
* @var array The list of radius servers to use.
35+
* @var array<mixed> The list of radius servers to use.
3636
*/
3737
private array $servers;
3838

@@ -91,8 +91,8 @@ class Radius extends UserPassBase
9191
/**
9292
* Constructor for this authentication source.
9393
*
94-
* @param array $info Information about this authentication source.
95-
* @param array $config Configuration.
94+
* @param array<mixed> $info Information about this authentication source.
95+
* @param array<mixed> $config Configuration.
9696
*/
9797
public function __construct(array $info, array $config)
9898
{
@@ -135,7 +135,7 @@ public function __construct(array $info, array $config)
135135
*
136136
* @param string $username The username the user wrote.
137137
* @param string $password The password the user wrote.
138-
* @return array[] Associative array with the user's attributes.
138+
* @return array<mixed> Associative array with the user's attributes.
139139
*/
140140
protected function login(
141141
string $username,
@@ -223,7 +223,7 @@ protected function login(
223223

224224
/**
225225
* @param \Dapphp\Radius\Radius $radius
226-
* @return array
226+
* @return array<mixed>
227227
*/
228228
private function getAttributes(RadiusClient $radius): array
229229
{
@@ -244,7 +244,7 @@ private function getAttributes(RadiusClient $radius): array
244244
$resv = $resa['data'];
245245
if ($resv === false) {
246246
throw new Exception(sprintf(
247-
'Error getting vendor specific attribute',
247+
'Error getting vendor specific attribute: %s (%d)',
248248
$radius->getErrorMessage(),
249249
$radius->getErrorCode(),
250250
));
@@ -259,15 +259,9 @@ private function getAttributes(RadiusClient $radius): array
259259
}
260260

261261
$attrib_name = strtok($datav, '=');
262-
/** @psalm-suppress TooFewArguments */
263262
$attrib_value = strtok('=');
264263

265-
// if the attribute name is already in result set, add another value
266-
if (array_key_exists($attrib_name, $attributes)) {
267-
$attributes[$attrib_name][] = $attrib_value;
268-
} else {
269-
$attributes[$attrib_name] = [$attrib_value];
270-
}
264+
$attributes[$attrib_name] = [$attrib_value];
271265

272266
return $attributes;
273267
}

0 commit comments

Comments
 (0)