Skip to content
Permalink
Browse files

Allow more generic iterable when yielding

Fixes #2353
  • Loading branch information
muglug committed Nov 25, 2019
1 parent 0f94beb commit 736ccd84cd48ae7debf0924f066dc689ca26309e
Showing with 10 additions and 0 deletions.
  1. +1 −0 src/Psalm/Internal/Analyzer/TypeAnalyzer.php
  2. +9 −0 tests/Template/ClassTemplateExtendsTest.php
@@ -1962,6 +1962,7 @@ private static function isMatchingTypeContainedBy(
$all_types_contain = false;
}
} elseif (!$input_type_part instanceof TIterable
&& !$container_type_part instanceof TIterable
&& !$container_param->hasTemplate()
&& !$input_param->hasTemplate()
) {
@@ -2411,6 +2411,15 @@ function repository(): Maybe {
$anInt = $maybe->extract();
}'
],
'extendIterable' => [
'<?php
class MyTestCase {
/** @return iterable<int,array<int,int>> */
public function provide() {
yield [1];
}
}'
],
];
}

0 comments on commit 736ccd8

Please sign in to comment.
You can’t perform that action at this time.