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

Use better replacement when analysing potentially-inherited templated type

This commit is contained in:
Brown 2020-07-03 12:25:33 -04:00
parent 44d7f51857
commit 5da29955ee
2 changed files with 37 additions and 1 deletions

View File

@ -1912,7 +1912,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$codebase,
null,
null,
null
null,
$original_fq_classlike_name
);
}

View File

@ -1694,6 +1694,9 @@ class ClassTemplateExtendsTest extends TestCase
$this->elements = $elements;
}
/**
* @psalm-suppress InvalidReturnType
*/
public function getIterator()
{
/**
@ -4181,6 +4184,38 @@ class ClassTemplateExtendsTest extends TestCase
}
}'
],
'extendTemplateTypeInParamAsType' => [
'<?php
/**
* @template TKey as object
* @template-implements Operation<TKey>
*/
final class Apply implements Operation
{
/**
* @return \Closure(array<TKey>): void
*/
public function i(): Closure
{
return
/**
* @psalm-param array<TKey> $collection
*/
static function (array $collection): void{};
}
}
/**
* @template TKey as object
*/
interface Operation
{
/**
* @psalm-return \Closure(array<TKey>): void
*/
public function i(): Closure;
}'
],
];
}