1 | <?php |
||
20 | class RobotPlacer |
||
21 | { |
||
22 | private $spaceInterface; |
||
23 | |||
24 | private $robotRepository; |
||
25 | |||
26 | /** |
||
27 | * @param SpaceInterface $space |
||
28 | * @param RobotRepositoryInterface $robotRepository |
||
29 | */ |
||
30 | 2 | public function __construct( |
|
37 | |||
38 | /** |
||
39 | * @Subscribe |
||
40 | * @param PlaceRobot $command |
||
41 | */ |
||
42 | 1 | public function handlePlaceRobot(PlaceRobot $command): void |
|
50 | } |
||
51 |
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: