| Conditions | 3 |
| Paths | 7 |
| Total Lines | 29 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 39 | public function getUser($accessToken) |
||
| 40 | { |
||
| 41 | try { |
||
| 42 | $client = new Client(); |
||
| 43 | $result = $client->get( |
||
| 44 | 'https://graph.facebook.com/v2.8/me', |
||
| 45 | ['query' => ['access_token' => $accessToken, |
||
| 46 | 'fields' => 'id, |
||
| 47 | email, first_name, |
||
| 48 | last_name', |
||
| 49 | ], |
||
| 50 | ] |
||
| 51 | ); |
||
| 52 | $userFacebook = $this->serializer->deserialize( |
||
| 53 | $result->getBody(), |
||
|
|
|||
| 54 | FacebookResponse::class, |
||
| 55 | 'json' |
||
| 56 | ); |
||
| 57 | $errors = $this->validator->validate($userFacebook); |
||
| 58 | |||
| 59 | if (count($errors) > 0) { |
||
| 60 | throw new HttpException(400, 'Social response validation error'); |
||
| 61 | } |
||
| 62 | |||
| 63 | return $userFacebook; |
||
| 64 | } catch (TransferException $e) { |
||
| 65 | throw new HttpException(400, 'Social login error'); |
||
| 66 | } |
||
| 67 | } |
||
| 68 | } |
||
| 69 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: