Skip to content

Commit cab1195

Browse files
committed
Check for static return type syntax in PHP 8
1 parent 1066d7c commit cab1195

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/php/net/xp_framework/unittest/reflection/MethodReturnTypesTest.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ public function special_static_return_type_in_inherited_class() {
154154
$this->assertEquals($fixture, $fixture->getMethod('copy')->getReturnType());
155155
}
156156

157+
#[Test, Action(eval: 'new RuntimeVersion(">=8.0")')]
158+
public function special_statuc_return_type_via_syntax() {
159+
$fixture= $this->type('{ public function fixture(): static { } }');
160+
$this->assertEquals($fixture, $fixture->getMethod('fixture')->getReturnType());
161+
}
162+
157163
#[Test, Values([['/** @return static */', 'static'], ['/** @return self */', 'self'], ['/** @return parent */', 'parent'],])]
158164
public function special_typeName_determined_via_apidoc($apidoc, $type) {
159165
$this->assertEquals($type, $this->method($apidoc.' public function fixture() { }')->getReturnTypeName());

0 commit comments

Comments
 (0)