File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 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 @@ -563,6 +563,32 @@ public function testReturnTypeStatic()
563
563
}//end testReturnTypeStatic()
564
564
565
565
566
+ /**
567
+ * Test a function with return type "?static".
568
+ *
569
+ * @return void
570
+ */
571
+ public function testReturnTypeNullableStatic ()
572
+ {
573
+ // Offsets are relative to the T_FUNCTION token.
574
+ $ expected = [
575
+ 'scope ' => 'public ' ,
576
+ 'scope_specified ' => false ,
577
+ 'return_type ' => '?static ' ,
578
+ 'return_type_token ' => 8 ,
579
+ 'return_type_end_token ' => 8 ,
580
+ 'nullable_return_type ' => true ,
581
+ 'is_abstract ' => false ,
582
+ 'is_final ' => false ,
583
+ 'is_static ' => false ,
584
+ 'has_body ' => true ,
585
+ ];
586
+
587
+ $ this ->getMethodPropertiesTestHelper ('/* ' .__FUNCTION__ .' */ ' , $ expected );
588
+
589
+ }//end testReturnTypeNullableStatic()
590
+
591
+
566
592
/**
567
593
* Test a function with return type "mixed".
568
594
*
You can’t perform that action at this time.
0 commit comments