| 1 | <?php |
||
| 5 | class Address |
||
| 6 | { |
||
| 7 | /** @var \stdClass */ |
||
| 8 | private $result; |
||
| 9 | |||
| 10 | /** @var null|string */ |
||
| 11 | private $label; |
||
| 12 | |||
| 13 | private function __construct( |
||
| 20 | |||
| 21 | public static function createFromGoogleResult(\stdClass $result): Address |
||
| 28 | |||
| 29 | public function getResult(): \stdClass |
||
| 33 | |||
| 34 | public function getLabel(): ?string |
||
| 38 | } |
||
| 39 |
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: