1 | <?php |
||
25 | class UserController extends FOSRestController |
||
26 | { |
||
27 | /** |
||
28 | * @var ViewHandler |
||
29 | */ |
||
30 | protected $viewHandler; |
||
31 | |||
32 | /** |
||
33 | * @var ValidatorInterface |
||
34 | */ |
||
35 | protected $validator; |
||
36 | |||
37 | /** |
||
38 | * @var UserPasswordEncoderInterface |
||
39 | */ |
||
40 | protected $passwordEncoder; |
||
41 | |||
42 | /** |
||
43 | * @var EntityManagerInterface |
||
44 | */ |
||
45 | protected $em; |
||
46 | |||
47 | /** |
||
48 | * @var RegisterService |
||
49 | */ |
||
50 | protected $registerService; |
||
51 | |||
52 | public function __construct( |
||
65 | |||
66 | /** |
||
67 | * Registration |
||
68 | * |
||
69 | * @Route("/api/users", methods={"POST"}) |
||
70 | * @SWG\Parameter(name="username", in="formData", type="string") |
||
71 | * @SWG\Parameter(name="password", in="formData", type="string") |
||
72 | * @SWG\Parameter(name="email", in="formData", type="string") |
||
73 | * @SWG\Response( |
||
74 | * description="Registration.", |
||
75 | * response=202, |
||
76 | * @Model(type=User::class) |
||
77 | * ) |
||
78 | */ |
||
79 | public function postUsers(RegisterUserRequest $request) |
||
85 | |||
86 | /** |
||
87 | * Authentication |
||
88 | * |
||
89 | * @Route("/oauth/v2/token", methods={"POST"}) |
||
90 | * @SWG\Parameter(name="username", in="formData", type="string") |
||
91 | * @SWG\Parameter(name="password", in="formData", type="string") |
||
92 | * @SWG\Response( |
||
93 | * description="Authentication.", |
||
94 | * response=202 |
||
95 | * ) |
||
96 | */ |
||
97 | public function login() |
||
101 | |||
102 | /** |
||
103 | * Get single user |
||
104 | * |
||
105 | * @Route("/api/users/{id}", methods={"GET"}) |
||
106 | * @SWG\Response( |
||
107 | * description="REST action which returns user by id.", |
||
108 | * response=200, |
||
109 | * @Model(type=User::class) |
||
110 | * ) |
||
111 | * |
||
112 | * @param int $id |
||
113 | * @return User |
||
114 | */ |
||
115 | public function getUsers($id) |
||
131 | |||
132 | /** |
||
133 | * Get all users |
||
134 | * |
||
135 | * @Route("/api/users", methods={"GET"}) |
||
136 | * @SWG\Response( |
||
137 | * description="REST action which returns user by id.", |
||
138 | * response=201, |
||
139 | * @SWG\Schema( |
||
140 | * type="array", |
||
141 | * @SWG\Items(ref=@Model(type=User::class, groups={"full"})) |
||
142 | * ) |
||
143 | * ) |
||
144 | * |
||
145 | * @return User[] |
||
146 | */ |
||
147 | public function getAll() |
||
159 | } |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.