Issues (2)

src/AuthorizationTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace midorikocak\nanoauth;
6
7
trait AuthorizationTrait
8
{
9
    private ?AuthenticationInterface $authentication = null;
10
11 2
    public function checkLogin(): bool
12
    {
13 2
        if ($this->authentication && !$this->authentication->isLogged()) {
14 1
            throw new UnauthorizedException();
15
        }
16
17 1
        return $this->authentication->isLogged();
0 ignored issues
show
The method isLogged() does not exist on null. ( Ignorable by Annotation )

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

17
        return $this->authentication->/** @scrutinizer ignore-call */ isLogged();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
    }
19
20 1
    public function getAuthentication(): ?AuthenticationInterface
21
    {
22 1
        return $this->authentication;
23
    }
24
25 2
    public function setAuthentication(AuthenticationInterface $auth)
26
    {
27 2
        $this->authentication = $auth;
28 2
    }
29
}
30