1 | <?php |
||
9 | trait AttachToRequestTrait |
||
10 | { |
||
11 | /** |
||
12 | * @param ServerRequestInterface $request |
||
13 | * @return static |
||
14 | */ |
||
15 | public static function fromRequest(ServerRequestInterface $request) |
||
28 | |||
29 | /** |
||
30 | * @param ServerRequestInterface $request |
||
31 | * @return ServerRequestInterface |
||
32 | */ |
||
33 | protected function attachToRequest(ServerRequestInterface $request = null): ServerRequestInterface |
||
49 | } |
||
50 |
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: