1 | <?php |
||
21 | class UserController extends BaseController |
||
22 | { |
||
23 | //<editor-fold desc="Public Methods"> |
||
24 | |||
25 | /** @var ObjectCreatorServiceInterface $objectCreatorService */ |
||
26 | private $objectCreatorService; |
||
27 | |||
28 | /** |
||
29 | * @inheritDoc |
||
30 | */ |
||
31 | public function __construct(EntityManagerInterface $entityManager, |
||
37 | |||
38 | |||
39 | /** |
||
40 | * login action, checks credentials and returns token |
||
41 | * @param Request $request the http request |
||
42 | * @param Application $app |
||
43 | * @return JsonResponse |
||
44 | * @throws AuthenticationException wrong credentials or errors during creating a token |
||
45 | */ |
||
46 | public function login(Request $request, Application $app): JsonResponse |
||
71 | |||
72 | /** |
||
73 | * register action, registers a new user with email and password |
||
74 | * |
||
75 | * @param Request $request the http request |
||
76 | * @param Application $app |
||
77 | * @return JsonResponse |
||
78 | */ |
||
79 | public function register(Request $request, Application $app): JsonResponse |
||
103 | |||
104 | /** |
||
105 | * Creates a new user |
||
106 | * @return UserInterface |
||
107 | */ |
||
108 | protected function newUser(): UserInterface |
||
112 | |||
113 | /** |
||
114 | * Gets the response for a successful register action |
||
115 | * @param Request $request the request |
||
116 | * @param Application $app the application |
||
117 | * @param UserInterface $user the newly registered user |
||
118 | * @return JsonResponse the json response |
||
119 | */ |
||
120 | protected function getRegisterResponse(/** @noinspection PhpUnusedParameterInspection */ |
||
126 | |||
127 | /** |
||
128 | * @return JsonResponse |
||
129 | */ |
||
130 | public function userId(): JsonResponse |
||
135 | //</editor-fold desc="Public Methods"> |
||
136 | |||
137 | //<editor-fold desc="Protected Methods"> |
||
138 | /** |
||
139 | * Gets additional input specifications for the login action |
||
140 | * @param array $specification the specification to add to / modify |
||
141 | */ |
||
142 | protected function addAdditionalLoginSpecifications(array &$specification) |
||
146 | |||
147 | /** |
||
148 | * adds additional register specifications |
||
149 | * @param array $specification the specification to add to / modify |
||
150 | */ |
||
151 | protected function addAdditionalRegisterSpecifications(array &$specification) |
||
155 | |||
156 | /** |
||
157 | * creates additional entities after registration using the specification and the given input |
||
158 | * @param UserInterface $user the newly registered user |
||
159 | * @param array $specification the specification |
||
160 | * @param array $input the given request input |
||
161 | */ |
||
162 | protected function createAdditionalRegisterEntities(UserInterface $user, array $specification, array $input) |
||
166 | |||
167 | /** |
||
168 | * Gets the response for a successful login action |
||
169 | * @param Request $request the request |
||
170 | * @param string $token the login token |
||
171 | * @return JsonResponse the response |
||
172 | */ |
||
173 | protected function getLoginResponse(Request $request, string $token): JsonResponse |
||
178 | //</editor-fold desc="Protected Methods"> |
||
179 | |||
180 | //<editor-fold desc="Private Methods"> |
||
181 | /** |
||
182 | * Gets the specification for the login credentials |
||
183 | * @param Application $app |
||
184 | * @return array |
||
185 | */ |
||
186 | private function getCredentialSpecification(Application $app) |
||
197 | //</editor-fold desc="Private Methods"> |
||
198 | } |
||
199 |
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: