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

Improve handling of interface-implementing edge-case

This commit is contained in:
Brown 2020-01-02 15:23:57 -05:00
parent 88c496121e
commit 5f5a942a32
2 changed files with 28 additions and 1 deletions

View File

@ -650,7 +650,7 @@ class Methods
$storage = $this->getStorage($declaring_method_id);
if ($storage->return_type) {
$self_class = $appearing_fq_class_name;
$self_class = $appearing_fq_class_storage->name;
return clone $storage->return_type;
}

View File

@ -659,6 +659,33 @@ class InterfaceTest extends TestCase
}
}',
],
'correctClassCasing' => [
'<?php
interface F {
/** @return static */
public function m(): self;
}
abstract class G implements F {}
class H extends G {
public function m(): F {
return $this;
}
}
function f1(F $f) : void {
$f->m()->m();
}
function f2(G $f) : void {
$f->m()->m();
}
function f3(H $f) : void {
$f->m()->m();
}'
],
];
}