1 | <?php |
||
9 | class Tag |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | public $name; |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | public $score; |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $data; |
||
23 | |||
24 | /** |
||
25 | * @param array $tag |
||
26 | * @param MusicBrainz $brainz |
||
27 | */ |
||
28 | public function __construct(array $tag, MusicBrainz $brainz) |
||
36 | } |
||
37 |
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: