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 EntityManagerInterface $em |
||
19 | * @param $userClass |
||
20 | */ |
||
21 | 1 | public function __construct(EntityManagerInterface $em, $userClass) |
|
22 | { |
||
23 | 1 | $this->em = $em; |
|
0 ignored issues
–
show
|
|||
24 | 1 | $this->userClass = $userClass; |
|
25 | 1 | } |
|
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | 1 | public function findUserByGoogleSignInData($email, $googleId) |
|
31 | { |
||
32 | //Check if already logged in before via Google auth |
||
33 | 1 | $user = $this->em->getRepository($this->userClass) |
|
34 | 1 | ->findOneBy(array('googleId' => $googleId)); |
|
35 | |||
36 | 1 | if (!$user instanceof $this->userClass) { |
|
37 | //Check if Email was already present in database but not logged in via Google auth |
||
38 | 1 | $user = $this->em->getRepository($this->userClass) |
|
39 | 1 | ->findOneBy(array('email' => $email)); |
|
40 | |||
41 | 1 | if (!$user instanceof $this->userClass) { |
|
42 | //Last chance try looking for email address in username field |
||
43 | 1 | $user = $this->em->getRepository($this->userClass) |
|
44 | 1 | ->findOneBy(array('username' => $email)); |
|
45 | } |
||
46 | } |
||
47 | |||
48 | 1 | return $user; |
|
49 | } |
||
50 | } |
||
51 |
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..