1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #3353 - allow extending nested when nested as type is mixed

This commit is contained in:
Matthew Brown 2020-05-12 15:07:10 -04:00
parent 3e58163180
commit 8c236f411a
2 changed files with 18 additions and 1 deletions

View File

@ -2038,7 +2038,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new InvalidTemplateParam(
'Extended template param ' . $template_name
. ' expects type ' . $template_type[0]->getId()
. ' expects type ' . $template_type_copy->getId()
. ', type ' . $extended_type->getId() . ' given',
$code_location
),
@ -2051,6 +2051,10 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$declaring_class => [$extended_type]
];
}
} else {
$previous_extended[$template_name] = [
$declaring_class => [$extended_type]
];
}
}
}

View File

@ -4079,6 +4079,19 @@ class ClassTemplateExtendsTest extends TestCase
}
}'
],
'extendIteratorIterator' => [
'<?php
/**
* @template-covariant TKey
* @template-covariant TValue
*
* @template-extends IteratorIterator<TKey, TValue, Traversable<TKey, TValue>>
*/
abstract class MyFilterIterator extends IteratorIterator {
/** @return bool */
public abstract function accept () {}
}'
],
];
}