| 1 | <?php declare(strict_types = 1); |
||
| 10 | trait StringContainer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Stringify if value is a scalar, throw an expection otherwise. |
||
| 14 | */ |
||
| 15 | protected static function checkMember($value) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Check whether an equal member alredy exists in this Listing. |
||
| 28 | */ |
||
| 29 | public function contains($member): bool |
||
| 33 | } |
||
| 34 |
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: