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

Fix issue with implemented class interface in subclass

This commit is contained in:
Brown 2019-01-16 15:08:11 -05:00
parent 1ac51fcea6
commit d068f1535d
4 changed files with 23 additions and 2 deletions

View File

@ -346,6 +346,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$interface_storage,
$implementer_method_storage,
$interface_method_storage,
$this->fq_class_name,
$implementer_visibility,
$code_location,
$implementer_method_storage->suppressed_issues,
@ -577,6 +578,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$parent_storage,
$pseudo_method_storage,
$parent_method_storage,
$this->fq_class_name,
$pseudo_method_storage->visibility ?: 0,
$pseudo_method_storage->location,
$storage->suppressed_issues,
@ -1078,6 +1080,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$appearing_storage,
$implementer_method_storage,
$declaring_method_storage,
$this->fq_class_name,
$implementer_method_storage->visibility,
new CodeLocation($source, $stmt),
$implementer_method_storage->suppressed_issues,

View File

@ -224,6 +224,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
$parent_storage,
$storage,
$parent_method_storage,
$fq_class_name,
$implementer_visibility,
$codeLocation,
$storage->suppressed_issues

View File

@ -436,6 +436,7 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
ClassLikeStorage $guide_classlike_storage,
MethodStorage $implementer_method_storage,
MethodStorage $guide_method_storage,
string $implementer_called_class_name,
int $implementer_visibility,
CodeLocation $code_location,
array $suppressed_issues,
@ -539,7 +540,7 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
$codebase,
$implementer_method_storage->return_type,
$implementer_classlike_storage->name,
$implementer_classlike_storage->name
$implementer_called_class_name
);
$guide_method_storage_return_type = ExpressionAnalyzer::fleshOutType(
@ -669,7 +670,7 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
$codebase,
$implementer_param->type,
$implementer_classlike_storage->name,
$implementer_classlike_storage->name
$implementer_called_class_name
);
$guide_method_storage_param_type = ExpressionAnalyzer::fleshOutType(

View File

@ -350,6 +350,22 @@ class MethodSignatureTest extends TestCase
}
}'
],
'allowInterfaceImplementation' => [
'<?php
abstract class A {
/** @return static */
public function foo() {
return $this;
}
}
interface I {
/** @return I */
public function foo();
}
class C extends A implements I {}',
],
];
}