1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Prevent LessSpecificImplementedReturnType with extended template

This commit is contained in:
Matthew Brown 2019-06-07 18:42:26 -04:00
parent 811cc08948
commit 2fa0f27872
2 changed files with 23 additions and 0 deletions

View File

@ -645,6 +645,11 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
}
}
$implementer_method_storage_return_type->replaceTemplateTypesWithArgTypes(
$template_types,
$codebase
);
$guide_method_storage_return_type->replaceTemplateTypesWithArgTypes(
$template_types,
$codebase

View File

@ -1886,6 +1886,24 @@ class TemplateExtendsTest extends TestCase
*/
class Bar extends Foo {}'
],
'implementsArrayReturnTypeWithTemplate' => [
'<?php
/** @template T as mixed */
interface I {
/**
* @param T $v
* @return array<string,T>
*/
public function indexById($v): array;
}
/** @template-implements I<int> */
class C implements I {
public function indexById($v): array {
return [(string)$v => $v];
}
}',
]
];
}