@@ -189,6 +189,94 @@ function doStrings($nonEmpty, $nonFalsy, $numeric, $literal, $lower, $upper) {
189189 }
190190}
191191
192+ class FooStringFloat
193+ {
194+
195+ public float $ foo ;
196+
197+ public function doFoo (string $ s ): void
198+ {
199+ $ this ->foo = $ s ;
200+ assertType ('float ' , $ this ->foo );
201+ }
202+
203+ public function doBar (): void
204+ {
205+ $ this ->foo = 'foo ' ;
206+ assertType ('*NEVER* ' , $ this ->foo );
207+ $ this ->foo = '123 ' ;
208+ assertType ('123.0 ' , $ this ->foo );
209+ }
210+
211+ /**
212+ * @param non-empty-string $nonEmpty
213+ * @param non-falsy-string $nonFalsy
214+ * @param numeric-string $numeric
215+ * @param literal-string $literal
216+ * @param lowercase-string $lower
217+ * @param uppercase-string $upper
218+ */
219+ function doStrings ($ nonEmpty , $ nonFalsy , $ numeric , $ literal , $ lower , $ upper ) {
220+ $ this ->foo = $ nonEmpty ;
221+ assertType ('float ' , $ this ->foo );
222+ $ this ->foo = $ nonFalsy ;
223+ assertType ('float ' , $ this ->foo );
224+ $ this ->foo = $ numeric ;
225+ assertType ('float ' , $ this ->foo );
226+ $ this ->foo = $ literal ;
227+ assertType ('float ' , $ this ->foo );
228+ $ this ->foo = $ lower ;
229+ assertType ('float ' , $ this ->foo );
230+ $ this ->foo = $ upper ;
231+ assertType ('float ' , $ this ->foo );
232+ }
233+ }
234+
235+ class FooStringBool
236+ {
237+
238+ public bool $ foo ;
239+
240+ public function doFoo (string $ s ): void
241+ {
242+ $ this ->foo = $ s ;
243+ assertType ('bool ' , $ this ->foo );
244+ }
245+
246+ public function doBar (): void
247+ {
248+ $ this ->foo = '0 ' ;
249+ assertType ('false ' , $ this ->foo );
250+ $ this ->foo = 'foo ' ;
251+ assertType ('true ' , $ this ->foo );
252+ $ this ->foo = '123 ' ;
253+ assertType ('true ' , $ this ->foo );
254+ }
255+
256+ /**
257+ * @param non-empty-string $nonEmpty
258+ * @param non-falsy-string $nonFalsy
259+ * @param numeric-string $numeric
260+ * @param literal-string $literal
261+ * @param lowercase-string $lower
262+ * @param uppercase-string $upper
263+ */
264+ function doStrings ($ nonEmpty , $ nonFalsy , $ numeric , $ literal , $ lower , $ upper ) {
265+ $ this ->foo = $ nonEmpty ;
266+ assertType ('bool ' , $ this ->foo );
267+ $ this ->foo = $ nonFalsy ;
268+ assertType ('true ' , $ this ->foo );
269+ $ this ->foo = $ numeric ;
270+ assertType ('bool ' , $ this ->foo );
271+ $ this ->foo = $ literal ;
272+ assertType ('bool ' , $ this ->foo );
273+ $ this ->foo = $ lower ;
274+ assertType ('bool ' , $ this ->foo );
275+ $ this ->foo = $ upper ;
276+ assertType ('bool ' , $ this ->foo );
277+ }
278+ }
279+
192280class FooBool
193281{
194282
0 commit comments