| 1 | <?php  | 
            ||
| 5 | abstract class BaseOptimizer implements Optimizer  | 
            ||
| 6 | { | 
            ||
| 7 | /** @var array */  | 
            ||
| 8 | public $options = [];  | 
            ||
| 9 | |||
| 10 | /** @var string */  | 
            ||
| 11 | public $imagePath = '';  | 
            ||
| 12 | |||
| 13 | public function __construct($options = [])  | 
            ||
| 17 | |||
| 18 | public function setImagePath(string $imagePath)  | 
            ||
| 22 | |||
| 23 | public function binaryName(): string  | 
            ||
| 27 | |||
| 28 | public function setOptions(array $options = [])  | 
            ||
| 32 | |||
| 33 | public function getCommand()  | 
            ||
| 39 | }  | 
            ||
| 40 | 
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: