1 | <?php |
||
18 | trait TeamMode |
||
19 | { |
||
20 | //<editor-fold desc="Fields"> |
||
21 | /** |
||
22 | * @ORM\Column(type="smallint", nullable=true) |
||
23 | * @var int|null |
||
24 | */ |
||
25 | private $teamMode; |
||
26 | //</editor-fold desc="Fields"> |
||
27 | |||
28 | //<editor-fold desc="Public Methods"> |
||
29 | /** |
||
30 | * @return int|null |
||
31 | */ |
||
32 | public function getTeamMode(): ?int |
||
36 | |||
37 | /** |
||
38 | * @param int|null $teamMode |
||
39 | * @return $this|TeamMode |
||
|
|||
40 | * @throws ValueNotValid |
||
41 | */ |
||
42 | public function setTeamMode(?int $teamMode) |
||
50 | //</editor-fold desc="Public Methods"> |
||
51 | } |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.