| 1 | <?php |
||
| 19 | trait ResultEntity |
||
| 20 | { |
||
| 21 | //<editor-fold desc="Fields"> |
||
| 22 | /** |
||
| 23 | * @ORM\Column(type="integer") |
||
| 24 | * @var int |
||
| 25 | */ |
||
| 26 | private $resultA; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @ORM\Column(type="integer") |
||
| 30 | * @var int |
||
| 31 | */ |
||
| 32 | private $resultB; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @ORM\Column(type="integer") |
||
| 36 | * @var int |
||
| 37 | */ |
||
| 38 | private $result; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @ORM\Column(type="boolean") |
||
| 42 | * @var bool |
||
| 43 | */ |
||
| 44 | private $played; |
||
| 45 | //</editor-fold desc="Fields"> |
||
| 46 | |||
| 47 | //<editor-fold desc="Public Methods"> |
||
| 48 | /** |
||
| 49 | * @return int |
||
| 50 | */ |
||
| 51 | public function getResult(): int |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return int |
||
| 58 | */ |
||
| 59 | public function getResultA(): int |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return int |
||
| 66 | */ |
||
| 67 | public function getResultB(): int |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return bool |
||
| 74 | */ |
||
| 75 | public function isPlayed(): bool |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @param bool $played |
||
| 82 | * @return $this|ResultEntity |
||
|
|
|||
| 83 | */ |
||
| 84 | public function setPlayed(bool $played) |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @param int $result |
||
| 92 | * @return $this|ResultEntity |
||
| 93 | * @throws ValueNotValid |
||
| 94 | */ |
||
| 95 | public function setResult(int $result) |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @param int $resultA |
||
| 104 | * @return $this|ResultEntity |
||
| 105 | */ |
||
| 106 | public function setResultA(int $resultA) |
||
| 111 | |||
| 112 | /** |
||
| 113 | * @param int $resultB |
||
| 114 | * @return $this|ResultEntity |
||
| 115 | */ |
||
| 116 | public function setResultB(int $resultB) |
||
| 121 | //</editor-fold desc="Public Methods"> |
||
| 122 | } |
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.