| 1 | <?php | ||
| 13 | trait OptionsTrait | ||
| 14 | { | ||
| 15 | /** | ||
| 16 | * @var array | ||
| 17 | */ | ||
| 18 | protected $options = []; | ||
| 19 | |||
| 20 | /** | ||
| 21 | * @param string $name | ||
| 22 | * | ||
| 23 | * @return bool | ||
| 24 | */ | ||
| 25 | protected function hasOption(string $name): bool | ||
| 41 | |||
| 42 | /** | ||
| 43 | * @param string $name | ||
| 44 | * @param mixed $default | ||
| 45 | * | ||
| 46 | * @return mixed | ||
| 47 | */ | ||
| 48 | protected function getOption(string $name, $default = null) | ||
| 68 | } | 
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: