mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Merge pull request #6390 from orklah/templateGenerator
fix Generator giving templates to Iterator
This commit is contained in:
commit
4b3d02f8cb
@ -12,6 +12,7 @@ use Psalm\Type\Union;
|
|||||||
use function array_merge;
|
use function array_merge;
|
||||||
use function array_values;
|
use function array_values;
|
||||||
use function count;
|
use function count;
|
||||||
|
use function is_a;
|
||||||
use function reset;
|
use function reset;
|
||||||
use function strpos;
|
use function strpos;
|
||||||
use function substr;
|
use function substr;
|
||||||
@ -483,6 +484,12 @@ class TemplateStandinTypeReplacer
|
|||||||
$atomic_input_type->as
|
$atomic_input_type->as
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_a($input_key, $key, true)) {
|
||||||
|
$matching_atomic_types[$atomic_input_type->getId()] = $atomic_input_type;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,6 +270,22 @@ class GeneratorTest extends TestCase
|
|||||||
[],
|
[],
|
||||||
['UndefinedClass']
|
['UndefinedClass']
|
||||||
],
|
],
|
||||||
|
'fillTemplatesForIteratorFromGenerator' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @return Generator<int, string>
|
||||||
|
*/
|
||||||
|
function generator(): Generator
|
||||||
|
{
|
||||||
|
yield "test";
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator = new NoRewindIterator(generator());
|
||||||
|
',
|
||||||
|
'assertions' => [
|
||||||
|
'$iterator' => 'NoRewindIterator<int, string>',
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user