File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,10 @@ class ReturnMe {
73
73
return $ this ;
74
74
}
75
75
}
76
+
77
+ /* testPHP8MixedTypeHint */
78
+ function mixedTypeHint () :mixed {}
79
+
80
+ /* testPHP8MixedTypeHintNullable */
81
+ // Intentional fatal error - nullability is not allowed with mixed, but that's not the concern of the method.
82
+ function mixedTypeHintNullable (): ?mixed {}
Original file line number Diff line number Diff line change @@ -406,6 +406,52 @@ public function testReturnTypeStatic()
406
406
}//end testReturnTypeStatic()
407
407
408
408
409
+ /**
410
+ * Test a function with return type "mixed".
411
+ *
412
+ * @return void
413
+ */
414
+ public function testPHP8MixedTypeHint ()
415
+ {
416
+ $ expected = [
417
+ 'scope ' => 'public ' ,
418
+ 'scope_specified ' => false ,
419
+ 'return_type ' => 'mixed ' ,
420
+ 'nullable_return_type ' => false ,
421
+ 'is_abstract ' => false ,
422
+ 'is_final ' => false ,
423
+ 'is_static ' => false ,
424
+ 'has_body ' => true ,
425
+ ];
426
+
427
+ $ this ->getMethodPropertiesTestHelper ('/* ' .__FUNCTION__ .' */ ' , $ expected );
428
+
429
+ }//end testPHP8MixedTypeHint()
430
+
431
+
432
+ /**
433
+ * Test a function with return type "mixed" and nullability.
434
+ *
435
+ * @return void
436
+ */
437
+ public function testPHP8MixedTypeHintNullable ()
438
+ {
439
+ $ expected = [
440
+ 'scope ' => 'public ' ,
441
+ 'scope_specified ' => false ,
442
+ 'return_type ' => '?mixed ' ,
443
+ 'nullable_return_type ' => true ,
444
+ 'is_abstract ' => false ,
445
+ 'is_final ' => false ,
446
+ 'is_static ' => false ,
447
+ 'has_body ' => true ,
448
+ ];
449
+
450
+ $ this ->getMethodPropertiesTestHelper ('/* ' .__FUNCTION__ .' */ ' , $ expected );
451
+
452
+ }//end testPHP8MixedTypeHintNullable()
453
+
454
+
409
455
/**
410
456
* Test helper.
411
457
*
You can’t perform that action at this time.
0 commit comments