1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Remove static from return type when final

Fixes #5244
This commit is contained in:
Matt Brown 2021-02-23 19:06:45 -05:00
parent 78577fd624
commit def7326ae1
2 changed files with 11 additions and 0 deletions

View File

@ -606,6 +606,7 @@ class TypeExpander
}
} elseif ($return_type->was_static && is_string($static_class_type) && $final) {
$return_type->value = $static_class_type;
$return_type->was_static = false;
} elseif ($self_class && $return_type_lc === 'self') {
$return_type->value = $self_class;
} elseif ($parent_class && $return_type_lc === 'parent') {

View File

@ -903,6 +903,16 @@ class MethodSignatureTest extends TestCase
[],
'8.0'
],
'notExtendedStaticReturntypeInFinal' => [
'<?php
final class X
{
public static function create(): static
{
return new self();
}
}'
],
];
}