| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function listAction() |
||
| 21 | { |
||
| 22 | $users = $this->getDoctrine() |
||
| 23 | ->getRepository('AppBundle:User') |
||
| 24 | ->findAll(); |
||
| 25 | if (!$users) { |
||
|
|
|||
| 26 | throw new NotFoundHttpException(); |
||
| 27 | } |
||
| 28 | return $this->json(['users' => $users], 200, [], [AbstractNormalizer::GROUPS => ['Short']]); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.