1
1
<?php
2
+
2
3
namespace Kir \MySQL \Builder ;
3
4
4
- use DateTimeInterface ;
5
+ use Kir \ MySQL \ Builder \ Internal \ Types ;
5
6
use Kir \MySQL \Tools \AliasReplacer ;
6
7
use RuntimeException ;
7
8
use Traversable ;
8
9
use UnexpectedValueException ;
9
10
11
+ /**
12
+ * @phpstan-import-type DBParameterValueType from Types
13
+ */
10
14
abstract class Insert extends InsertUpdateStatement {
11
- /** @var array<string|int, mixed> */
12
- private $ fields = [];
13
- /** @var array<string|int, mixed> */
14
- private $ update = [];
15
- /** @var string */
16
- private $ table ;
17
- /** @var string */
18
- private $ keyField ;
19
- /** @var bool */
20
- private $ ignore = false ;
21
- /** @var Select */
22
- private $ from ;
15
+ /** @var array<string|int, DBParameterValueType> */
16
+ private array $ fields = [];
17
+ /** @var array<string|int, DBParameterValueType> */
18
+ private array $ update = [];
19
+ private ?string $ table = null ;
20
+ private ?string $ keyField = null ;
21
+ private bool $ ignore = false ;
22
+ private ?Select $ from = null ;
23
23
24
24
/**
25
25
* @param string $table
@@ -54,7 +54,7 @@ public function setKey(string $field) {
54
54
55
55
/**
56
56
* @param string $field
57
- * @param null|bool|int|float|string|DateTimeInterface $value
57
+ * @param DBParameterValueType $value
58
58
* @return $this
59
59
*/
60
60
public function add (string $ field , $ value ) {
@@ -64,7 +64,7 @@ public function add(string $field, $value) {
64
64
65
65
/**
66
66
* @param string $field
67
- * @param null|bool|int|float|string|DateTimeInterface $value
67
+ * @param DBParameterValueType $value
68
68
* @return $this
69
69
*/
70
70
public function update (string $ field , $ value ) {
@@ -74,7 +74,7 @@ public function update(string $field, $value) {
74
74
75
75
/**
76
76
* @param string $field
77
- * @param null|bool|int|float|string|DateTimeInterface $value
77
+ * @param DBParameterValueType $value
78
78
* @return $this
79
79
*/
80
80
public function addOrUpdate (string $ field , $ value ) {
@@ -85,7 +85,7 @@ public function addOrUpdate(string $field, $value) {
85
85
86
86
/**
87
87
* @param string $str
88
- * @param mixed ...$args
88
+ * @param DBParameterValueType ...$args
89
89
* @return $this
90
90
*/
91
91
public function addExpr (string $ str , ...$ args ) {
@@ -99,7 +99,7 @@ public function addExpr(string $str, ...$args) {
99
99
100
100
/**
101
101
* @param string $str
102
- * @param mixed ...$args
102
+ * @param DBParameterValueType ...$args
103
103
* @return $this
104
104
*/
105
105
public function updateExpr (string $ str , ...$ args ) {
@@ -113,7 +113,7 @@ public function updateExpr(string $str, ...$args) {
113
113
114
114
/**
115
115
* @param string $expr
116
- * @param mixed ...$args
116
+ * @param DBParameterValueType ...$args
117
117
* @return $this
118
118
*/
119
119
public function addOrUpdateExpr (string $ expr , ...$ args ) {
@@ -128,7 +128,7 @@ public function addOrUpdateExpr(string $expr, ...$args) {
128
128
}
129
129
130
130
/**
131
- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
131
+ * @param array<string, DBParameterValueType > $data
132
132
* @param null|string[] $mask
133
133
* @param null|string[] $excludeFields
134
134
* @return $this
@@ -141,7 +141,7 @@ public function addAll(array $data, ?array $mask = null, ?array $excludeFields =
141
141
}
142
142
143
143
/**
144
- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
144
+ * @param array<string, DBParameterValueType > $data
145
145
* @param null|string[] $mask
146
146
* @param null|string[] $excludeFields
147
147
* @return $this
@@ -156,7 +156,7 @@ public function updateAll(array $data, ?array $mask = null, ?array $excludeField
156
156
}
157
157
158
158
/**
159
- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
159
+ * @param array<string, DBParameterValueType > $data
160
160
* @param null|string[] $mask
161
161
* @param array<int, string>|null $excludeFields
162
162
* @return $this
@@ -226,7 +226,7 @@ public function __toString(): string {
226
226
/**
227
227
* @param array<string|int, mixed> $fields
228
228
* @param string $field
229
- * @param null|bool|int|float|string|DateTimeInterface $value
229
+ * @param DBParameterValueType $value
230
230
* @return array<string|int, mixed>
231
231
*/
232
232
private function addTo (array $ fields , string $ field , $ value ): array {
@@ -241,8 +241,8 @@ private function addTo(array $fields, string $field, $value): array {
241
241
242
242
/**
243
243
* @param array<string, mixed> $data
244
- * @param array<int, string> |null $mask
245
- * @param array<int, string> |null $excludeFields
244
+ * @param string[] |null $mask
245
+ * @param string[] |null $excludeFields
246
246
* @param callable(string, mixed): void $fn
247
247
*/
248
248
private function addAllTo (array $ data , ?array $ mask , ?array $ excludeFields , $ fn ): void {
0 commit comments