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:
parent
44d7f51857
commit
5da29955ee
@ -1912,7 +1912,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
$codebase,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
$original_fq_classlike_name
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user