1 | <?php |
||
14 | class UserController extends ApiGuardController |
||
15 | { |
||
16 | /** |
||
17 | * @var UserTransformer |
||
18 | */ |
||
19 | protected $userTransformer; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $apiMethods = [ |
||
25 | 'getAllUsers' => [ |
||
26 | 'keyAuthentication' => false, |
||
27 | ], |
||
28 | 'show' => [ |
||
29 | 'keyAuthentication' => false, |
||
30 | ], |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * UserController constructor. |
||
35 | * |
||
36 | * @param User $user |
||
37 | * @param UserTransformer $userTransformer |
||
38 | */ |
||
39 | 5 | public function __construct(User $user, UserTransformer $userTransformer) |
|
40 | { |
||
41 | 5 | parent::__construct(); |
|
42 | |||
43 | 5 | $this->userTransformer = $userTransformer; |
|
44 | 5 | $this->user = $user; |
|
45 | 5 | } |
|
46 | |||
47 | /** |
||
48 | * Get all users. |
||
49 | * |
||
50 | * @return mixed |
||
51 | */ |
||
52 | 4 | public function getAllUsers() |
|
58 | |||
59 | /** |
||
60 | * Get user find id. |
||
61 | * |
||
62 | * @param $id |
||
63 | * |
||
64 | * @return mixed |
||
65 | */ |
||
66 | 1 | public function show($id) |
|
67 | { |
||
68 | 1 | $user = $this->user->findOrFail($id); |
|
69 | |||
70 | 1 | return $this->response->withItem($user, $this->userTransformer); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * Update user. |
||
75 | * |
||
76 | * @param UserUpdateRequest $request |
||
77 | * @param $id |
||
78 | * |
||
79 | * @return mixed |
||
80 | */ |
||
81 | 2 | public function update(UserUpdateRequest $request, $id) |
|
102 | |||
103 | /** |
||
104 | * Delete user. |
||
105 | * |
||
106 | * @param $id |
||
107 | */ |
||
108 | 1 | public function delete($id) |
|
112 | |||
113 | /** |
||
114 | * Store image avatar. |
||
115 | * |
||
116 | * @param $image |
||
117 | * @param $user |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 1 | private function storeImage($image, $user) |
|
132 | } |
||
133 |
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: