mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix bad template replacement
This commit is contained in:
parent
39d6800531
commit
abb3800d20
@ -1891,8 +1891,9 @@ class CallAnalyzer
|
||||
[$template_type->param_name]
|
||||
[$template_type->defining_class]
|
||||
)) {
|
||||
$template_result->generic_params[$template_type->param_name] = [
|
||||
($template_type->defining_class) => [clone $template_type->as, 0]
|
||||
$template_result->generic_params[$template_type->param_name][$template_type->defining_class] = [
|
||||
clone $template_type->as,
|
||||
0
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -3088,6 +3088,37 @@ class ClassTemplateExtendsTest extends TestCase
|
||||
private function doDeletePerson(Dog $animal): void {}
|
||||
}'
|
||||
],
|
||||
'sameNameTemplateFromParent' => [
|
||||
'<?php
|
||||
/**
|
||||
* @psalm-template T
|
||||
*/
|
||||
interface C {
|
||||
/**
|
||||
* @psalm-param T $p
|
||||
* @psalm-return C<T>
|
||||
*/
|
||||
public function filter($p) : self;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-template T
|
||||
* @template-implements C<T>
|
||||
*/
|
||||
abstract class AC implements C {
|
||||
/**
|
||||
* @psalm-var C<T>
|
||||
*/
|
||||
protected $c;
|
||||
|
||||
/**
|
||||
* @param T $p
|
||||
*/
|
||||
public function filter($p) : C {
|
||||
return $this->c->filter($p);
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user