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:
parent
ad67256be0
commit
c1ce543e81
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user