These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminBundle\Helper\Security\OAuth; |
||
4 | |||
5 | use Doctrine\ORM\EntityManagerInterface; |
||
6 | |||
7 | class OAuthUserFinder implements OAuthUserFinderInterface |
||
8 | { |
||
9 | /** @var EntityManager */ |
||
10 | private $em; |
||
11 | |||
12 | /** @var string */ |
||
13 | private $userClass; |
||
14 | |||
15 | /** |
||
16 | * OAuthUserCreator constructor. |
||
17 | * |
||
18 | * @param $userClass |
||
19 | */ |
||
20 | 1 | public function __construct(EntityManagerInterface $em, $userClass) |
|
21 | { |
||
22 | 1 | $this->em = $em; |
|
0 ignored issues
–
show
|
|||
23 | 1 | $this->userClass = $userClass; |
|
24 | 1 | } |
|
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | 1 | public function findUserByGoogleSignInData($email, $googleId) |
|
30 | { |
||
31 | //Check if already logged in before via Google auth |
||
32 | 1 | $user = $this->em->getRepository($this->userClass) |
|
33 | 1 | ->findOneBy(['googleId' => $googleId]); |
|
34 | |||
35 | 1 | if (!$user instanceof $this->userClass) { |
|
36 | //Check if Email was already present in database but not logged in via Google auth |
||
37 | 1 | $user = $this->em->getRepository($this->userClass) |
|
38 | 1 | ->findOneBy(['email' => $email]); |
|
39 | |||
40 | 1 | if (!$user instanceof $this->userClass) { |
|
41 | //Last chance try looking for email address in username field |
||
42 | 1 | $user = $this->em->getRepository($this->userClass) |
|
43 | 1 | ->findOneBy(['username' => $email]); |
|
44 | } |
||
45 | } |
||
46 | |||
47 | 1 | return $user; |
|
48 | } |
||
49 | } |
||
50 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..