1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Make sure to clear previously inferred types when rechecking trait statements

Fixes #399
This commit is contained in:
Matthew Brown 2017-12-17 01:06:12 -05:00
parent ad67256be0
commit c1ce543e81
2 changed files with 22 additions and 0 deletions

View File

@ -1237,6 +1237,8 @@ class CallChecker
$project_checker = $file_checker->project_checker;
$source = $statements_checker->getSource();
$stmt->inferredType = null;
if ($stmt->class instanceof PhpParser\Node\Name) {
$fq_class_name = null;

View File

@ -332,6 +332,26 @@ class TraitTest extends TestCase
use T;
}',
],
'differentMethodReturnTypes' => [
'<?php
trait T {
public static function getSelf() : self {
return new self();
}
public static function callGetSelf() : self {
return self::getSelf();
}
}
class A {
use T;
}
class B {
use T;
}',
],
];
}