1 | <?php |
||
14 | final class ImageUploadAction |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * IndexAction constructor. |
||
19 | * |
||
20 | * @param Upload $upload template engine |
||
21 | */ |
||
22 | public function __construct(Upload $upload) |
||
26 | |||
27 | /** |
||
28 | * Executed when action is called. |
||
29 | * |
||
30 | * @param RequestInterface $request request |
||
31 | * @param Response $response response |
||
32 | * @param callable|null $next next middleware |
||
33 | * |
||
34 | * @return JsonResponse |
||
35 | */ |
||
36 | public function __invoke(RequestInterface $request, Response $response, callable $next = null) |
||
44 | } |
||
45 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: