| 1 | <?php |
||
| 19 | trait ScoreMode |
||
| 20 | { |
||
| 21 | //<editor-fold desc="Fields"> |
||
| 22 | /** |
||
| 23 | * @ORM\Column(type="smallint", nullable=true) |
||
| 24 | * @var int|null |
||
| 25 | */ |
||
| 26 | private $scoreMode; |
||
| 27 | //</editor-fold desc="Fields"> |
||
| 28 | |||
| 29 | //<editor-fold desc="Public Methods"> |
||
| 30 | /** |
||
| 31 | * @return int|null |
||
| 32 | */ |
||
| 33 | public function getScoreMode(): ?int |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param int|null $scoreMode |
||
| 40 | * @return $this|ScoreMode |
||
|
|
|||
| 41 | * @throws ValueNotValid |
||
| 42 | */ |
||
| 43 | public function setScoreMode(?int $scoreMode) |
||
| 51 | //</editor-fold desc="Public Methods"> |
||
| 52 | } |
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.