1 | <?php |
||
18 | trait ReturningTrait |
||
19 | { |
||
20 | /** |
||
21 | * |
||
22 | * The columns to be returned. |
||
23 | * |
||
24 | * @var array |
||
25 | * |
||
26 | */ |
||
27 | protected $returning = []; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * Adds returning columns to the query. |
||
32 | * |
||
33 | * Multiple calls to returning() will append to the list of columns, not |
||
34 | * overwrite the previous columns. |
||
35 | * |
||
36 | * @param array $cols The column(s) to add to the query. |
||
37 | * |
||
38 | * @return $this |
||
39 | * |
||
40 | */ |
||
41 | 3 | public function returning(array $cols) |
|
48 | } |
||
49 |
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: