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 {
7979 private function myFunction (): static {
8080 return $ this ;
8181 }
82+
83+ /* testReturnTypeNullableStatic */
84+ function myNullableFunction (): ?static {
85+ return $ this ;
86+ }
8287}
8388
8489/* testPHP8MixedTypeHint */
Original file line number Diff line number Diff line change @@ -561,6 +561,32 @@ public function testReturnTypeStatic()
561561 }//end testReturnTypeStatic()
562562
563563
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+
564590 /**
565591 * Test a function with return type "mixed".
566592 *
You can’t perform that action at this time.
0 commit comments