Issues (6)

src/Exceptions/InvalidCredentialsException.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Signifly\Janitor\Exceptions;
4
5
use Illuminate\Auth\AuthenticationException;
6
7
class InvalidCredentialsException extends AuthenticationException
8
{
9
    /** @var string */
10
    private $username;
11
12
    public static function forUsername(string $username): self
13
    {
14
        $exception = new static(trans('auth.failed'));
0 ignored issues
show
It seems like trans('auth.failed') can also be of type array and array; however, parameter $message of Signifly\Janitor\Excepti...xception::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

14
        $exception = new static(/** @scrutinizer ignore-type */ trans('auth.failed'));
Loading history...
15
        $exception->username = $username;
16
17
        return $exception;
18
    }
19
20
    public static function withDefaultMessage(): self
21
    {
22
        return new static(trans('auth.failed'));
0 ignored issues
show
It seems like trans('auth.failed') can also be of type array and array; however, parameter $message of Signifly\Janitor\Excepti...xception::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        return new static(/** @scrutinizer ignore-type */ trans('auth.failed'));
Loading history...
23
    }
24
25
    protected function getUsername(): string
26
    {
27
        return $this->username;
28
    }
29
}
30