Skip to content

Commit 22bf063

Browse files
paulbalandandimtrovich
authored andcommitted
chore: fix phpstan (codeigniter4#1325)
1 parent 4f28d51 commit 22bf063

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,18 +427,6 @@
427427
'count' => 1,
428428
'path' => __DIR__ . '/tests/Authentication/Authenticators/SessionAuthenticatorTest.php',
429429
];
430-
$ignoreErrors[] = [
431-
'rawMessage' => 'Parameter #1 $headers of method Tests\\Authentication\\Filters\\AbstractFilterTestCase::withHeaders() expects array<string, CodeIgniter\\HTTP\\Header|list<CodeIgniter\\HTTP\\Header>>, array{Authorization: non-falsy-string} given.',
432-
'identifier' => 'argument.type',
433-
'count' => 7,
434-
'path' => __DIR__ . '/tests/Authentication/Filters/HmacFilterTest.php',
435-
];
436-
$ignoreErrors[] = [
437-
'rawMessage' => 'Parameter #1 $headers of method Tests\\Authentication\\Filters\\JWTFilterTest::withHeaders() expects array<string, CodeIgniter\\HTTP\\Header|list<CodeIgniter\\HTTP\\Header>>, array{Authorization: non-falsy-string} given.',
438-
'identifier' => 'argument.type',
439-
'count' => 1,
440-
'path' => __DIR__ . '/tests/Authentication/Filters/JWTFilterTest.php',
441-
];
442430
$ignoreErrors[] = [
443431
'rawMessage' => 'Implicit array creation is not allowed - variable $users might not exist.',
444432
'identifier' => 'variable.implicitArray',

src/Authentication/Authenticators/JWT.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ public function getTokenFromRequest(RequestInterface $request): string
221221
/** @var AuthJWT $config */
222222
$config = config('AuthJWT');
223223

224-
$tokenHeader = $request->getHeaderLine(
225-
$config->authenticatorHeader ?? 'Authorization',
226-
);
224+
$tokenHeader = $request->getHeaderLine($config->authenticatorHeader);
227225

228226
if (str_starts_with($tokenHeader, 'Bearer')) {
229227
return trim(substr($tokenHeader, 6));

src/Authentication/Authenticators/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ private function recordLoginAttempt(
280280
// Determine the type of ID we're using.
281281
// Standard fields would be email, username,
282282
// but any column within config('Auth')->validFields can be used.
283-
$field = array_intersect(config('Auth')->validFields ?? [], array_keys($credentials));
283+
$field = array_intersect(config('Auth')->validFields, array_keys($credentials));
284284

285285
if (count($field) !== 1) {
286286
throw new InvalidArgumentException('Invalid credentials passed to recordLoginAttempt.');

0 commit comments

Comments
 (0)