1 | <?php |
||
12 | trait CanRedeemVouchers |
||
13 | { |
||
14 | /** |
||
15 | * @param string $code |
||
16 | * @throws VoucherExpired |
||
17 | * @throws VoucherIsInvalid |
||
18 | * @throws VoucherAlreadyRedeemed |
||
19 | * @return mixed |
||
20 | */ |
||
21 | public function redeemCode(string $code) |
||
40 | |||
41 | /** |
||
42 | * @param Voucher $voucher |
||
43 | * @throws VoucherExpired |
||
44 | * @throws VoucherIsInvalid |
||
45 | * @throws VoucherAlreadyRedeemed |
||
46 | * @return mixed |
||
47 | */ |
||
48 | public function redeemVoucher(Voucher $voucher) |
||
52 | |||
53 | /** |
||
54 | * @return mixed |
||
55 | */ |
||
56 | public function vouchers() |
||
60 | } |
||
61 |
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: