|
4 | 4 | namespace PluginMaster\Contracts\DB; |
5 | 5 |
|
6 | 6 |
|
| 7 | +use Closure; |
| 8 | + |
7 | 9 | interface DBInterface |
8 | 10 | { |
9 | 11 | /** |
10 | | - * @param $name |
11 | | - * @return mixed |
| 12 | + * @param string $name |
| 13 | + * @return self |
12 | 14 | */ |
13 | | - static public function table($name); |
| 15 | + static public function table(string $name): self; |
14 | 16 |
|
15 | 17 |
|
16 | 18 | /** |
17 | | - * @param $closer |
18 | | - * @return mixed |
| 19 | + * @param Closure $closer |
| 20 | + * @return ?self |
19 | 21 | */ |
20 | | - static public function transaction($closer); |
| 22 | + static public function transaction(Closure $closer): ?self; |
21 | 23 |
|
22 | 24 | /** |
23 | | - * @param $column |
24 | | - * @param null $operator |
| 25 | + * @param string|Closure $column |
| 26 | + * @param string|null $operator |
25 | 27 | * @param null $value |
26 | | - * @return mixed |
| 28 | + * @return self |
27 | 29 | */ |
28 | | - public function where($column, $operator = null, $value = null); |
| 30 | + public function where(string|Closure $column, ?string $operator = null, mixed $value = null): self; |
29 | 31 |
|
30 | 32 | /** |
31 | | - * @param $table |
32 | | - * @param $first |
33 | | - * @param null $operator |
34 | | - * @param null $second |
| 33 | + * @param string $table |
| 34 | + * @param string|Closure $first |
| 35 | + * @param string|null $operator |
| 36 | + * @param string|null $second |
35 | 37 | * @return mixed |
36 | 38 | */ |
37 | | - public function join($table, $first, $operator = null, $second = null); |
| 39 | + public function join(string $table, string|Closure $first, ?string $operator = null, ?string $second = null): self; |
38 | 40 |
|
39 | 41 | /** |
40 | | - * @param $table |
41 | | - * @param $first |
42 | | - * @param null $operator |
43 | | - * @param null $second |
44 | | - * @return mixed |
| 42 | + * @param string $table |
| 43 | + * @param string|Closure $first |
| 44 | + * @param string|null $operator |
| 45 | + * @param string|null $second |
| 46 | + * @return self |
45 | 47 | */ |
46 | | - public function leftJoin($table, $first, $operator = null, $second = null); |
| 48 | + public function leftJoin( |
| 49 | + string $table, |
| 50 | + string|Closure $first, |
| 51 | + ?string $operator = null, |
| 52 | + ?string $second = null |
| 53 | + ): self; |
47 | 54 |
|
48 | 55 | /** |
49 | | - * @param $first |
50 | | - * @param $operator |
51 | | - * @param $second |
52 | | - * @return mixed |
| 56 | + * @param string $first |
| 57 | + * @param string $operator |
| 58 | + * @param string $second |
| 59 | + * @return self |
53 | 60 | */ |
54 | | - public function on($first, $operator, $second); |
| 61 | + public function on(string $first, string $operator, string $second): self; |
55 | 62 |
|
56 | 63 | /** |
57 | | - * @param $first |
58 | | - * @param $operator |
59 | | - * @param $second |
60 | | - * @return mixed |
| 64 | + * @param string $first |
| 65 | + * @param string $operator |
| 66 | + * @param string $second |
| 67 | + * @return self |
61 | 68 | */ |
62 | | - public function orOn($first, $operator, $second); |
| 69 | + public function orOn(string $first, string $operator, string $second): self; |
63 | 70 |
|
64 | 71 | /** |
65 | | - * @param $column |
66 | | - * @param null $operator |
| 72 | + * @param string $column |
| 73 | + * @param string|null $operator |
67 | 74 | * @param null $value |
68 | | - * @return mixed |
| 75 | + * @return self |
69 | 76 | */ |
70 | | - public function onWhere($column, $operator = null, $value = null); |
| 77 | + public function onWhere(string $column, ?string $operator = null, mixed $value = null): self; |
71 | 78 |
|
72 | 79 | /** |
73 | | - * @param $column |
74 | | - * @param null $operator |
| 80 | + * @param string|Closure $column |
| 81 | + * @param string|null $operator |
75 | 82 | * @param null $value |
76 | | - * @return mixed |
| 83 | + * @return self |
77 | 84 | */ |
78 | | - public function orWhere($column, $operator = null, $value = null); |
| 85 | + public function orWhere(string|Closure $column, ?string $operator = null, mixed $value = null): self; |
79 | 86 |
|
80 | 87 | /** |
81 | | - * @param $columns |
82 | | - * @param $direction |
83 | | - * @return mixed |
| 88 | + * @param string $columns |
| 89 | + * @param string $direction |
| 90 | + * @return self |
84 | 91 | */ |
85 | | - public function orderBy($columns, $direction); |
| 92 | + public function orderBy(string $columns, string $direction): self; |
86 | 93 |
|
87 | 94 |
|
88 | 95 | /** |
89 | | - * @param $number |
90 | | - * @return mixed |
| 96 | + * @param string|int $number |
| 97 | + * @return self |
91 | 98 | */ |
92 | | - public function limit($number); |
| 99 | + public function limit(string|int $number): self; |
93 | 100 |
|
94 | 101 |
|
95 | 102 | /** |
96 | | - * @param $number |
97 | | - * @return mixed |
| 103 | + * @param string|int $number |
| 104 | + * @return self |
98 | 105 | */ |
99 | | - public function offset($number); |
| 106 | + public function offset(string|int $number): self; |
100 | 107 |
|
101 | 108 |
|
102 | 109 | /** |
103 | | - * @param $number |
104 | | - * @return mixed |
| 110 | + * @param string|int $column |
| 111 | + * @return self |
105 | 112 | */ |
106 | | - public function groupBy($number); |
| 113 | + public function groupBy(string|int $column): self; |
107 | 114 |
|
108 | 115 | /** |
109 | | - * @param $fields |
110 | | - * @return mixed |
| 116 | + * @param string $fields |
| 117 | + * @return self |
111 | 118 | */ |
112 | | - public function select($fields); |
| 119 | + public function select(string $fields): self; |
113 | 120 |
|
114 | 121 | /** |
115 | | - * @param $data |
116 | | - * @return mixed |
| 122 | + * @param array $data |
| 123 | + * @return int|null |
117 | 124 | */ |
118 | | - public function insert($data); |
| 125 | + public function insert(array $data): ?int; |
119 | 126 |
|
120 | 127 | /** |
121 | | - * @param $data |
122 | | - * @return mixed |
| 128 | + * @param array $data |
| 129 | + * @return bool|int|null |
123 | 130 | */ |
124 | | - public function update($data); |
| 131 | + public function update(array $data): bool|int|null; |
125 | 132 |
|
126 | 133 |
|
127 | 134 | /** |
128 | | - * @return mixed |
| 135 | + * @return bool|int|null |
129 | 136 | */ |
130 | | - public function delete(); |
| 137 | + public function delete(): bool|int|null; |
131 | 138 |
|
132 | 139 | /** |
133 | | - * @return mixed |
| 140 | + * @return object|null |
134 | 141 | */ |
135 | | - public function first(); |
| 142 | + public function first(): object|null; |
136 | 143 |
|
137 | 144 | /** |
138 | | - * @return mixed |
| 145 | + * @return array|object|null |
139 | 146 | */ |
140 | | - public function get(); |
| 147 | + public function get(): array|object|null; |
141 | 148 |
|
142 | 149 | /** |
143 | | - * @return mixed |
| 150 | + * @return string |
144 | 151 | */ |
145 | | - public function toSql(); |
| 152 | + public function toSql(): string; |
146 | 153 |
|
147 | 154 | } |
148 | 155 |
|
0 commit comments