1 | <?php |
||
19 | trait AliasProvider |
||
20 | { |
||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected static $lastQueryId = 0; |
||
25 | |||
26 | /** |
||
27 | * @var string|null |
||
28 | */ |
||
29 | protected $alias; |
||
30 | |||
31 | /** |
||
32 | * @return string |
||
33 | */ |
||
34 | 33 | public function getAlias(): string |
|
44 | |||
45 | /** |
||
46 | * @param string ...$patterns |
||
47 | * @return string |
||
48 | */ |
||
49 | 33 | public function createAlias(string ...$patterns): string |
|
65 | |||
66 | /** |
||
67 | * @param string|null $pattern |
||
68 | * @return string |
||
69 | */ |
||
70 | 8 | public function createPlaceholder(string $pattern = null): string |
|
74 | |||
75 | /** |
||
76 | * @param string $alias |
||
77 | * @return Query|$this|self |
||
78 | */ |
||
79 | 5 | public function withAlias(string $alias): Query |
|
89 | } |
||
90 |
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: