1 | <?php |
||
5 | trait HandleUserTrait |
||
6 | { |
||
7 | /** |
||
8 | * Check if the information in $user is enough |
||
9 | * and valid to create a new User in database. |
||
10 | * |
||
11 | * @param User $user user to validate |
||
12 | * @param string $group validation group to apply |
||
13 | * |
||
14 | * @return array contains the error(s) list, |
||
15 | * empty if no error |
||
16 | */ |
||
17 | 10 | private function validates($user, $group) |
|
37 | } |
||
38 |
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: