@@ -161,6 +161,31 @@ public function doBar(): void
161
161
{
162
162
$ this ->foo = 'foo ' ;
163
163
assertType ('*NEVER* ' , $ this ->foo );
164
+ $ this ->foo = '123 ' ;
165
+ assertType ('123 ' , $ this ->foo );
166
+ }
167
+
168
+ /**
169
+ * @param non-empty-string $nonEmpty
170
+ * @param non-falsy-string $nonFalsy
171
+ * @param numeric-string $numeric
172
+ * @param literal-string $literal
173
+ * @param lowercase-string $lower
174
+ * @param uppercase-string $upper
175
+ */
176
+ function doStrings ($ nonEmpty , $ nonFalsy , $ numeric , $ literal , $ lower , $ upper ) {
177
+ $ this ->foo = $ nonEmpty ;
178
+ assertType ('int ' , $ this ->foo );
179
+ $ this ->foo = $ nonFalsy ;
180
+ assertType ('int<min, -1>|int<1, max> ' , $ this ->foo );
181
+ $ this ->foo = $ numeric ;
182
+ assertType ('int ' , $ this ->foo );
183
+ $ this ->foo = $ literal ;
184
+ assertType ('int ' , $ this ->foo );
185
+ $ this ->foo = $ lower ;
186
+ assertType ('int ' , $ this ->foo );
187
+ $ this ->foo = $ upper ;
188
+ assertType ('int ' , $ this ->foo );
164
189
}
165
190
}
166
191
@@ -179,6 +204,8 @@ public function doBar(): void
179
204
{
180
205
$ this ->foo = true ;
181
206
assertType ('1 ' , $ this ->foo );
207
+ $ this ->foo = false ;
208
+ assertType ('0 ' , $ this ->foo );
182
209
}
183
210
}
184
211
@@ -215,8 +242,12 @@ public function doFoo(int $b): void
215
242
216
243
public function doBar (): void
217
244
{
245
+ $ this ->foo = -1 ;
246
+ assertType ("'-1' " , $ this ->foo );
218
247
$ this ->foo = 1 ;
219
248
assertType ("'1' " , $ this ->foo );
249
+ $ this ->foo = 0 ;
250
+ assertType ("'0' " , $ this ->foo );
220
251
}
221
252
}
222
253
@@ -309,22 +340,6 @@ public function doFoo(float|int $b): void
309
340
310
341
}
311
342
312
- class FooIntersectionToInt
313
- {
314
-
315
- public int $ foo ;
316
-
317
- /**
318
- * @param numeric-string $b
319
- */
320
- public function doFoo (string $ b ): void
321
- {
322
- $ this ->foo = $ b ;
323
- assertType ('int ' , $ this ->foo );
324
- }
325
-
326
- }
327
-
328
343
class FooMixedToInt
329
344
{
330
345
@@ -341,7 +356,6 @@ public function doFoo(mixed $b): void
341
356
342
357
class FooArrayToInt
343
358
{
344
-
345
359
public int $ foo ;
346
360
347
361
public function doFoo (array $ arr ): void
@@ -351,4 +365,3 @@ public function doFoo(array $arr): void
351
365
}
352
366
353
367
}
354
-
0 commit comments