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

Fix psl inheritance stuff cc @azjezz

This commit is contained in:
Matt Brown 2020-12-13 16:57:51 -05:00 committed by Daniil Gentili
parent 1c2650fe65
commit 1f295e4597
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 57 additions and 2 deletions

View File

@ -673,8 +673,6 @@ class Populator
);
}
$parent_interface_storage->dependent_classlikes[strtolower($storage->name)] = true;
$parent_interfaces = array_merge($parent_interfaces, $parent_interface_storage->parent_interfaces);
$this->inheritMethodsFromParent($storage, $parent_interface_storage);
@ -683,6 +681,21 @@ class Populator
}
$storage->parent_interfaces = array_merge($parent_interfaces, $storage->parent_interfaces);
foreach ($storage->parent_interfaces as $parent_interface_lc => $_) {
try {
$parent_interface_lc = strtolower(
$this->classlikes->getUnAliasedName(
$parent_interface_lc
)
);
$parent_interface_storage = $storage_provider->get($parent_interface_lc);
} catch (\InvalidArgumentException $e) {
continue;
}
$parent_interface_storage->dependent_classlikes[strtolower($storage->name)] = true;
}
}
private function populateDataFromImplementedInterfaces(

View File

@ -4240,6 +4240,48 @@ class ClassTemplateExtendsTest extends TestCase
[],
'7.4'
],
'inheritInterfacesManyTimes' => [
'<?php
/**
* @template Tv
*
* @extends IteratorAggregate<int, Tv>
*/
interface C1 extends \IteratorAggregate
{
}
/**
* @template Tv
*
* @extends C1<Tv>
*/
interface C2 extends C1
{
}
/**
* @template Tv
*
* @extends C2<Tv>
*/
interface C3 extends C2
{
}
/**
* @template Tv
*
* @extends C3<Tv>
*/
interface C4 extends C3
{
/**
* @psalm-return Traversable<int, Tv>
*/
function getIterator(): Traversable;
}'
],
];
}