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

Allow more generic iterable when yielding

Fixes #2353
This commit is contained in:
Brown 2019-11-25 16:12:44 -05:00
parent 0f94bebe4c
commit 736ccd84cd
2 changed files with 10 additions and 0 deletions

View File

@ -1962,6 +1962,7 @@ class TypeAnalyzer
$all_types_contain = false;
}
} elseif (!$input_type_part instanceof TIterable
&& !$container_type_part instanceof TIterable
&& !$container_param->hasTemplate()
&& !$input_param->hasTemplate()
) {

View File

@ -2411,6 +2411,15 @@ class ClassTemplateExtendsTest extends TestCase
$anInt = $maybe->extract();
}'
],
'extendIterable' => [
'<?php
class MyTestCase {
/** @return iterable<int,array<int,int>> */
public function provide() {
yield [1];
}
}'
],
];
}