1 | <?php |
||
28 | final class RaLocationController extends Controller |
||
29 | { |
||
30 | public function listAction(Request $request, Institution $institution) |
||
31 | { |
||
32 | $this->denyAccessUnlessGranted(['ROLE_RA', 'ROLE_SS']); |
||
33 | |||
34 | $query = new RaLocationQuery(); |
||
35 | $query->institution = $institution; |
||
36 | $query->orderBy = $request->get('orderBy', $query->orderBy); |
||
37 | $query->orderDirection = $request->get('orderDirection', $query->orderDirection); |
||
38 | |||
39 | $raLocations = $this->getRaLocationService()->findByInstitution($query); |
||
40 | $count = count($raLocations); |
||
41 | |||
42 | return new JsonCollectionResponse($count, 1, $count, $raLocations); |
||
|
|||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return RaLocationService |
||
47 | */ |
||
48 | private function getRaLocationService() |
||
52 | } |
||
53 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.