20
20
*/
21
21
trait TypeConstructorsTrait
22
22
{
23
- /**
24
- * @param int $value
25
- * @param bool $owned
26
- * @return CData
27
- */
28
- public static function int8 (int $ value = 0 , bool $ owned = true ): CData
29
- {
30
- return self ::create ('int8_t ' , $ value , $ owned );
31
- }
32
-
33
23
/**
34
24
* @param string|CType $type
35
25
* @param mixed $value
@@ -44,16 +34,6 @@ public static function create(string|CType $type, mixed $value, bool $owned = tr
44
34
return $ instance ;
45
35
}
46
36
47
- /**
48
- * @param int[] $value
49
- * @param bool $owned
50
- * @return CData
51
- */
52
- public static function int8Array (iterable $ value = [], bool $ owned = true ): CData
53
- {
54
- return self ::array ('int8_t ' , $ value , $ owned );
55
- }
56
-
57
37
/**
58
38
* @param string|CType $type
59
39
* @param iterable $initializer
@@ -99,13 +79,153 @@ private static function iterableValues(iterable $initializer): array
99
79
* @param bool $owned
100
80
* @return CData
101
81
*/
82
+ public static function short (int $ value = 0 , bool $ owned = true ): CData
83
+ {
84
+ return self ::create ('short ' , $ value , $ owned );
85
+ }
86
+
87
+ /**
88
+ * @param array<int> $value
89
+ * @param bool $owned
90
+ * @return CData
91
+ */
92
+ public static function shortArray (iterable $ value = [], bool $ owned = true ): CData
93
+ {
94
+ return self ::array ('short ' , $ value , $ owned );
95
+ }
96
+
97
+ /**
98
+ * @param positive-int|0 $value
99
+ * @param bool $owned
100
+ * @return CData
101
+ */
102
+ public static function ushort (int $ value = 0 , bool $ owned = true ): CData
103
+ {
104
+ return self ::create ('unsigned short ' , $ value , $ owned );
105
+ }
106
+
107
+ /**
108
+ * @param array<positive-int|0> $value
109
+ * @param bool $owned
110
+ * @return CData
111
+ */
112
+ public static function ushortArray (iterable $ value = [], bool $ owned = true ): CData
113
+ {
114
+ return self ::array ('unsigned short ' , $ value , $ owned );
115
+ }
116
+
117
+ /**
118
+ * @param int $value
119
+ * @param bool $owned
120
+ * @return CData
121
+ */
122
+ public static function int (int $ value = 0 , bool $ owned = true ): CData
123
+ {
124
+ return self ::create ('int ' , $ value , $ owned );
125
+ }
126
+
127
+ /**
128
+ * @param array<int> $value
129
+ * @param bool $owned
130
+ * @return CData
131
+ */
132
+ public static function intArray (iterable $ value = [], bool $ owned = true ): CData
133
+ {
134
+ return self ::array ('int ' , $ value , $ owned );
135
+ }
136
+
137
+ /**
138
+ * @param positive-int|0 $value
139
+ * @param bool $owned
140
+ * @return CData
141
+ */
142
+ public static function uint (int $ value = 0 , bool $ owned = true ): CData
143
+ {
144
+ return self ::create ('unsigned int ' , $ value , $ owned );
145
+ }
146
+
147
+ /**
148
+ * @param array<positive-int|0> $value
149
+ * @param bool $owned
150
+ * @return CData
151
+ */
152
+ public static function uintArray (iterable $ value = [], bool $ owned = true ): CData
153
+ {
154
+ return self ::array ('unsigned int ' , $ value , $ owned );
155
+ }
156
+
157
+ /**
158
+ * @param int $value
159
+ * @param bool $owned
160
+ * @return CData
161
+ */
162
+ public static function long (int $ value = 0 , bool $ owned = true ): CData
163
+ {
164
+ return self ::create ('long ' , $ value , $ owned );
165
+ }
166
+
167
+ /**
168
+ * @param array<int> $value
169
+ * @param bool $owned
170
+ * @return CData
171
+ */
172
+ public static function longArray (iterable $ value = [], bool $ owned = true ): CData
173
+ {
174
+ return self ::array ('long ' , $ value , $ owned );
175
+ }
176
+
177
+ /**
178
+ * @param positive-int|0 $value
179
+ * @param bool $owned
180
+ * @return CData
181
+ */
182
+ public static function ulong (int $ value = 0 , bool $ owned = true ): CData
183
+ {
184
+ return self ::create ('unsigned long ' , $ value , $ owned );
185
+ }
186
+
187
+ /**
188
+ * @param array<positive-int|0> $value
189
+ * @param bool $owned
190
+ * @return CData
191
+ */
192
+ public static function ulongArray (iterable $ value = [], bool $ owned = true ): CData
193
+ {
194
+ return self ::array ('unsigned long ' , $ value , $ owned );
195
+ }
196
+
197
+ /**
198
+ * @param int $value
199
+ * @param bool $owned
200
+ * @return CData
201
+ */
202
+ public static function int8 (int $ value = 0 , bool $ owned = true ): CData
203
+ {
204
+ return self ::create ('int8_t ' , $ value , $ owned );
205
+ }
206
+
207
+ /**
208
+ * @param array<int> $value
209
+ * @param bool $owned
210
+ * @return CData
211
+ */
212
+ public static function int8Array (iterable $ value = [], bool $ owned = true ): CData
213
+ {
214
+ return self ::array ('int8_t ' , $ value , $ owned );
215
+ }
216
+
217
+ /**
218
+ * @param positive-int|0 $value
219
+ * @param bool $owned
220
+ * @return CData
221
+ */
102
222
public static function uint8 (int $ value = 0 , bool $ owned = true ): CData
103
223
{
104
224
return self ::create ('uint8_t ' , $ value , $ owned );
105
225
}
106
226
107
227
/**
108
- * @param int[] $value
228
+ * @param array<positive- int|0> $value
109
229
* @param bool $owned
110
230
* @return CData
111
231
*/
@@ -125,7 +245,7 @@ public static function int16(int $value = 0, bool $owned = true): CData
125
245
}
126
246
127
247
/**
128
- * @param int[] $value
248
+ * @param array< int> $value
129
249
* @param bool $owned
130
250
* @return CData
131
251
*/
@@ -135,7 +255,7 @@ public static function int16Array(iterable $value = [], bool $owned = true): CDa
135
255
}
136
256
137
257
/**
138
- * @param int $value
258
+ * @param positive- int|0 $value
139
259
* @param bool $owned
140
260
* @return CData
141
261
*/
@@ -145,7 +265,7 @@ public static function uint16(int $value = 0, bool $owned = true): CData
145
265
}
146
266
147
267
/**
148
- * @param int[] $value
268
+ * @param array<positive- int|0> $value
149
269
* @param bool $owned
150
270
* @return CData
151
271
*/
@@ -165,7 +285,7 @@ public static function int32(int $value = 0, bool $owned = true): CData
165
285
}
166
286
167
287
/**
168
- * @param int[] $value
288
+ * @param array< int> $value
169
289
* @param bool $owned
170
290
* @return CData
171
291
*/
@@ -175,7 +295,7 @@ public static function int32Array(iterable $value = [], bool $owned = true): CDa
175
295
}
176
296
177
297
/**
178
- * @param int $value
298
+ * @param positive- int|0 $value
179
299
* @param bool $owned
180
300
* @return CData
181
301
*/
@@ -185,7 +305,7 @@ public static function uint32(int $value = 0, bool $owned = true): CData
185
305
}
186
306
187
307
/**
188
- * @param int[] $value
308
+ * @param array<positive- int|0> $value
189
309
* @param bool $owned
190
310
* @return CData
191
311
*/
@@ -205,7 +325,7 @@ public static function int64(int $value = 0, bool $owned = true): CData
205
325
}
206
326
207
327
/**
208
- * @param int[] $value
328
+ * @param array< int> $value
209
329
* @param bool $owned
210
330
* @return CData
211
331
*/
@@ -215,7 +335,7 @@ public static function int64Array(iterable $value = [], bool $owned = true): CDa
215
335
}
216
336
217
337
/**
218
- * @param int $value
338
+ * @param positive- int|0 $value
219
339
* @param bool $owned
220
340
* @return CData
221
341
*/
@@ -225,7 +345,7 @@ public static function uint64(int $value = 0, bool $owned = true): CData
225
345
}
226
346
227
347
/**
228
- * @param int[] $value
348
+ * @param array<positive- int|0> $value
229
349
* @param bool $owned
230
350
* @return CData
231
351
*/
0 commit comments