1 | <?php |
||
8 | trait ManufacturerTrait |
||
9 | { |
||
10 | /** |
||
11 | * @var boolean |
||
12 | * |
||
13 | * @ORM\Column(type="boolean") |
||
14 | */ |
||
15 | protected $consignment = false; |
||
16 | |||
17 | /** |
||
18 | * @var string|null |
||
19 | * |
||
20 | * @ORM\Column(type="string", nullable=true, length=191) |
||
21 | */ |
||
22 | protected $consignmentClass; |
||
23 | |||
24 | /** |
||
25 | * This is the last stock movement used in reports |
||
26 | * This implies that stock movements can't be changed |
||
27 | * |
||
28 | * @var StockMovementInterface|null |
||
29 | * |
||
30 | * @ORM\ManyToOne(targetEntity="Loevgaard\DandomainStock\Entity\StockMovement") |
||
31 | */ |
||
32 | protected $consignmentLastStockMovement; |
||
33 | |||
34 | /** |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function isConsignment(): bool |
||
41 | |||
42 | /** |
||
43 | * @param bool $consignment |
||
44 | * @return ManufacturerTrait |
||
|
|||
45 | */ |
||
46 | public function setConsignment(bool $consignment) |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getConsignmentClass(): ?string |
||
59 | |||
60 | /** |
||
61 | * @param string|null $consignmentClass |
||
62 | * @return ManufacturerTrait |
||
63 | */ |
||
64 | public function setConsignmentClass(?string $consignmentClass) |
||
69 | |||
70 | /** |
||
71 | * @return StockMovementInterface|null |
||
72 | */ |
||
73 | public function getConsignmentLastStockMovement(): ?StockMovementInterface |
||
77 | |||
78 | /** |
||
79 | * @param StockMovementInterface|null $consignmentLastStockMovement |
||
80 | * @return ManufacturerTrait |
||
81 | */ |
||
82 | public function setConsignmentLastStockMovement(?StockMovementInterface $consignmentLastStockMovement) |
||
87 | } |
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.