1 | <?php |
||
29 | final class AssetImage extends AssetsAbstract implements AssetImageInterface |
||
30 | { |
||
31 | |||
32 | /** |
||
33 | * Asset constructor set asset ID |
||
34 | * |
||
35 | * @param string $id |
||
36 | */ |
||
37 | 4 | public function __construct(string $id) |
|
42 | |||
43 | /** |
||
44 | * Set crossorigin attribute of the image |
||
45 | * |
||
46 | * @param string $crossorigin |
||
47 | * @return AssetImageInterface |
||
48 | */ |
||
49 | 1 | public function crossorigin(string $crossorigin = 'anonymous'): AssetImageInterface |
|
54 | } |
||
55 |
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: