1 | <?php namespace Nimo\Traits; |
||
5 | trait AttachToRequestTrait |
||
6 | { |
||
7 | /** |
||
8 | * @param ServerRequestInterface $request |
||
9 | * @return static |
||
10 | */ |
||
11 | public static function fromRequest(ServerRequestInterface $request): self |
||
24 | |||
25 | /** |
||
26 | * @param ServerRequestInterface $request |
||
27 | * @return ServerRequestInterface |
||
28 | */ |
||
29 | protected function attachToRequest(ServerRequestInterface $request = null): ServerRequestInterface |
||
45 | } |
||
46 |
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: