@@ -161,6 +161,31 @@ public function doBar(): void
161161 {
162162 $ this ->foo = 'foo ' ;
163163 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 );
164189 }
165190}
166191
@@ -179,6 +204,8 @@ public function doBar(): void
179204 {
180205 $ this ->foo = true ;
181206 assertType ('1 ' , $ this ->foo );
207+ $ this ->foo = false ;
208+ assertType ('0 ' , $ this ->foo );
182209 }
183210}
184211
@@ -215,8 +242,12 @@ public function doFoo(int $b): void
215242
216243 public function doBar (): void
217244 {
245+ $ this ->foo = -1 ;
246+ assertType ("'-1' " , $ this ->foo );
218247 $ this ->foo = 1 ;
219248 assertType ("'1' " , $ this ->foo );
249+ $ this ->foo = 0 ;
250+ assertType ("'0' " , $ this ->foo );
220251 }
221252}
222253
@@ -309,22 +340,6 @@ public function doFoo(float|int $b): void
309340
310341}
311342
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-
328343class FooMixedToInt
329344{
330345
@@ -341,7 +356,6 @@ public function doFoo(mixed $b): void
341356
342357class FooArrayToInt
343358{
344-
345359 public int $ foo ;
346360
347361 public function doFoo (array $ arr ): void
@@ -351,4 +365,3 @@ public function doFoo(array $arr): void
351365 }
352366
353367}
354-
0 commit comments