2020 */
2121trait TypeConstructorsTrait
2222{
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-
3323 /**
3424 * @param string|CType $type
3525 * @param mixed $value
@@ -44,16 +34,6 @@ public static function create(string|CType $type, mixed $value, bool $owned = tr
4434 return $ instance ;
4535 }
4636
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-
5737 /**
5838 * @param string|CType $type
5939 * @param iterable $initializer
@@ -99,13 +79,153 @@ private static function iterableValues(iterable $initializer): array
9979 * @param bool $owned
10080 * @return CData
10181 */
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+ */
102222 public static function uint8 (int $ value = 0 , bool $ owned = true ): CData
103223 {
104224 return self ::create ('uint8_t ' , $ value , $ owned );
105225 }
106226
107227 /**
108- * @param int[] $value
228+ * @param array<positive- int|0> $value
109229 * @param bool $owned
110230 * @return CData
111231 */
@@ -125,7 +245,7 @@ public static function int16(int $value = 0, bool $owned = true): CData
125245 }
126246
127247 /**
128- * @param int[] $value
248+ * @param array< int> $value
129249 * @param bool $owned
130250 * @return CData
131251 */
@@ -135,7 +255,7 @@ public static function int16Array(iterable $value = [], bool $owned = true): CDa
135255 }
136256
137257 /**
138- * @param int $value
258+ * @param positive- int|0 $value
139259 * @param bool $owned
140260 * @return CData
141261 */
@@ -145,7 +265,7 @@ public static function uint16(int $value = 0, bool $owned = true): CData
145265 }
146266
147267 /**
148- * @param int[] $value
268+ * @param array<positive- int|0> $value
149269 * @param bool $owned
150270 * @return CData
151271 */
@@ -165,7 +285,7 @@ public static function int32(int $value = 0, bool $owned = true): CData
165285 }
166286
167287 /**
168- * @param int[] $value
288+ * @param array< int> $value
169289 * @param bool $owned
170290 * @return CData
171291 */
@@ -175,7 +295,7 @@ public static function int32Array(iterable $value = [], bool $owned = true): CDa
175295 }
176296
177297 /**
178- * @param int $value
298+ * @param positive- int|0 $value
179299 * @param bool $owned
180300 * @return CData
181301 */
@@ -185,7 +305,7 @@ public static function uint32(int $value = 0, bool $owned = true): CData
185305 }
186306
187307 /**
188- * @param int[] $value
308+ * @param array<positive- int|0> $value
189309 * @param bool $owned
190310 * @return CData
191311 */
@@ -205,7 +325,7 @@ public static function int64(int $value = 0, bool $owned = true): CData
205325 }
206326
207327 /**
208- * @param int[] $value
328+ * @param array< int> $value
209329 * @param bool $owned
210330 * @return CData
211331 */
@@ -215,7 +335,7 @@ public static function int64Array(iterable $value = [], bool $owned = true): CDa
215335 }
216336
217337 /**
218- * @param int $value
338+ * @param positive- int|0 $value
219339 * @param bool $owned
220340 * @return CData
221341 */
@@ -225,7 +345,7 @@ public static function uint64(int $value = 0, bool $owned = true): CData
225345 }
226346
227347 /**
228- * @param int[] $value
348+ * @param array<positive- int|0> $value
229349 * @param bool $owned
230350 * @return CData
231351 */
0 commit comments