11<?php
2+
23namespace Kir \MySQL \Builder ;
34
4- use DateTimeInterface ;
5+ use Kir \ MySQL \ Builder \ Internal \ Types ;
56use Kir \MySQL \Tools \AliasReplacer ;
67use RuntimeException ;
78use Traversable ;
89use UnexpectedValueException ;
910
11+ /**
12+ * @phpstan-import-type DBParameterValueType from Types
13+ */
1014abstract 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 ;
2323
2424 /**
2525 * @param string $table
@@ -54,7 +54,7 @@ public function setKey(string $field) {
5454
5555 /**
5656 * @param string $field
57- * @param null|bool|int|float|string|DateTimeInterface $value
57+ * @param DBParameterValueType $value
5858 * @return $this
5959 */
6060 public function add (string $ field , $ value ) {
@@ -64,7 +64,7 @@ public function add(string $field, $value) {
6464
6565 /**
6666 * @param string $field
67- * @param null|bool|int|float|string|DateTimeInterface $value
67+ * @param DBParameterValueType $value
6868 * @return $this
6969 */
7070 public function update (string $ field , $ value ) {
@@ -74,7 +74,7 @@ public function update(string $field, $value) {
7474
7575 /**
7676 * @param string $field
77- * @param null|bool|int|float|string|DateTimeInterface $value
77+ * @param DBParameterValueType $value
7878 * @return $this
7979 */
8080 public function addOrUpdate (string $ field , $ value ) {
@@ -85,7 +85,7 @@ public function addOrUpdate(string $field, $value) {
8585
8686 /**
8787 * @param string $str
88- * @param mixed ...$args
88+ * @param DBParameterValueType ...$args
8989 * @return $this
9090 */
9191 public function addExpr (string $ str , ...$ args ) {
@@ -99,7 +99,7 @@ public function addExpr(string $str, ...$args) {
9999
100100 /**
101101 * @param string $str
102- * @param mixed ...$args
102+ * @param DBParameterValueType ...$args
103103 * @return $this
104104 */
105105 public function updateExpr (string $ str , ...$ args ) {
@@ -113,7 +113,7 @@ public function updateExpr(string $str, ...$args) {
113113
114114 /**
115115 * @param string $expr
116- * @param mixed ...$args
116+ * @param DBParameterValueType ...$args
117117 * @return $this
118118 */
119119 public function addOrUpdateExpr (string $ expr , ...$ args ) {
@@ -128,7 +128,7 @@ public function addOrUpdateExpr(string $expr, ...$args) {
128128 }
129129
130130 /**
131- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
131+ * @param array<string, DBParameterValueType > $data
132132 * @param null|string[] $mask
133133 * @param null|string[] $excludeFields
134134 * @return $this
@@ -141,7 +141,7 @@ public function addAll(array $data, ?array $mask = null, ?array $excludeFields =
141141 }
142142
143143 /**
144- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
144+ * @param array<string, DBParameterValueType > $data
145145 * @param null|string[] $mask
146146 * @param null|string[] $excludeFields
147147 * @return $this
@@ -156,7 +156,7 @@ public function updateAll(array $data, ?array $mask = null, ?array $excludeField
156156 }
157157
158158 /**
159- * @param array<string, null|bool|int|float|string|DateTimeInterface > $data
159+ * @param array<string, DBParameterValueType > $data
160160 * @param null|string[] $mask
161161 * @param array<int, string>|null $excludeFields
162162 * @return $this
@@ -226,7 +226,7 @@ public function __toString(): string {
226226 /**
227227 * @param array<string|int, mixed> $fields
228228 * @param string $field
229- * @param null|bool|int|float|string|DateTimeInterface $value
229+ * @param DBParameterValueType $value
230230 * @return array<string|int, mixed>
231231 */
232232 private function addTo (array $ fields , string $ field , $ value ): array {
@@ -241,8 +241,8 @@ private function addTo(array $fields, string $field, $value): array {
241241
242242 /**
243243 * @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
246246 * @param callable(string, mixed): void $fn
247247 */
248248 private function addAllTo (array $ data , ?array $ mask , ?array $ excludeFields , $ fn ): void {
0 commit comments