| 1 | <?php |
||
| 23 | class PublishedPost extends AggregateRoot implements ReadModelInterface |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Post constructor. |
||
| 27 | * |
||
| 28 | * @param PostId $id |
||
| 29 | * @param string $title |
||
| 30 | */ |
||
| 31 | public function __construct(PostId $id, $title) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function title() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param string $title |
||
| 48 | */ |
||
| 49 | public function setTitle($title) |
||
| 53 | } |
||
| 54 |
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: