File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ class ReturnMe {
79
79
private function myFunction (): static {
80
80
return $ this ;
81
81
}
82
+
83
+ /* testReturnTypeNullableStatic */
84
+ function myNullableFunction (): ?static {
85
+ return $ this ;
86
+ }
82
87
}
83
88
84
89
/* testPHP8MixedTypeHint */
Original file line number Diff line number Diff line change @@ -561,6 +561,32 @@ public function testReturnTypeStatic()
561
561
}//end testReturnTypeStatic()
562
562
563
563
564
+ /**
565
+ * Test a function with return type "?static".
566
+ *
567
+ * @return void
568
+ */
569
+ public function testReturnTypeNullableStatic ()
570
+ {
571
+ // Offsets are relative to the T_FUNCTION token.
572
+ $ expected = [
573
+ 'scope ' => 'public ' ,
574
+ 'scope_specified ' => false ,
575
+ 'return_type ' => '?static ' ,
576
+ 'return_type_token ' => 8 ,
577
+ 'return_type_end_token ' => 8 ,
578
+ 'nullable_return_type ' => true ,
579
+ 'is_abstract ' => false ,
580
+ 'is_final ' => false ,
581
+ 'is_static ' => false ,
582
+ 'has_body ' => true ,
583
+ ];
584
+
585
+ $ this ->getMethodPropertiesTestHelper ('/* ' .__FUNCTION__ .' */ ' , $ expected );
586
+
587
+ }//end testReturnTypeNullableStatic()
588
+
589
+
564
590
/**
565
591
* Test a function with return type "mixed".
566
592
*
You can’t perform that action at this time.
0 commit comments