mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 12:24:49 +01:00
Fix #4767 - rescan directly-affected class-interface relationships
This commit is contained in:
parent
48f55f3c3b
commit
73fc7d9491
@ -603,7 +603,7 @@ class Populator
|
||||
): void {
|
||||
$parent_interfaces = [];
|
||||
|
||||
foreach ($storage->parent_interfaces as $parent_interface_lc => $_) {
|
||||
foreach ($storage->direct_interface_parents as $parent_interface_lc => $_) {
|
||||
try {
|
||||
$parent_interface_lc = strtolower(
|
||||
$this->classlikes->getUnAliasedName(
|
||||
@ -696,7 +696,7 @@ class Populator
|
||||
): void {
|
||||
$extra_interfaces = [];
|
||||
|
||||
foreach ($storage->class_implements as $implemented_interface_lc => $_) {
|
||||
foreach ($storage->direct_class_interfaces as $implemented_interface_lc => $_) {
|
||||
try {
|
||||
$implemented_interface_lc = strtolower(
|
||||
$this->classlikes->getUnAliasedName(
|
||||
|
@ -102,7 +102,7 @@ class ClassLikeStorage
|
||||
/**
|
||||
* Interfaces this class implements directly
|
||||
*
|
||||
* @var array<string, string>
|
||||
* @var array<lowercase-string, string>
|
||||
*/
|
||||
public $direct_class_interfaces = [];
|
||||
|
||||
|
@ -1556,8 +1556,14 @@ class ClassTemplateExtendsTest extends TestCase
|
||||
$this->elements = $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-suppress InvalidReturnType
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
/**
|
||||
* @psalm-suppress InvalidReturnStatement
|
||||
*/
|
||||
return new ArrayIterator($this->elements);
|
||||
}
|
||||
|
||||
@ -4173,6 +4179,49 @@ class ClassTemplateExtendsTest extends TestCase
|
||||
return $foo->map($function);
|
||||
}'
|
||||
],
|
||||
'extendStubbedInterfaceTwice' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
*/
|
||||
interface AA {}
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
* @extends ArrayAccess<Tk, Tv>
|
||||
*/
|
||||
interface A extends ArrayAccess {
|
||||
/**
|
||||
* @psalm-param Tk $k
|
||||
* @psalm-return Tv
|
||||
*/
|
||||
public function at($k);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
*
|
||||
* @extends A<Tk, Tv>
|
||||
*/
|
||||
interface B extends A {}
|
||||
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
*
|
||||
* @implements B<Tk, Tv>
|
||||
*/
|
||||
abstract class C implements B
|
||||
{
|
||||
/**
|
||||
* @psalm-param Tk $k
|
||||
* @psalm-return Tv
|
||||
*/
|
||||
public function at($k) { /** @var Tv */ return 1; }
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user