File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" ?>
22<psalm
3- errorLevel =" 2 "
3+ errorLevel =" 1 "
44 resolveFromConfigFile =" true"
55 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
66 xmlns =" https://getpsalm.org/schema/config"
Original file line number Diff line number Diff line change 44
55namespace Xepozz \Remap ;
66
7+ use Generator ;
8+ use Iterator ;
79use Throwable ;
810use Yiisoft \Db \Connection \ConnectionInterface ;
911use Yiisoft \Db \Exception \Exception ;
@@ -20,18 +22,20 @@ public function __construct(
2022
2123 /**
2224 * @template T
23- * @param class-string<T> $class
24- * @return iterable<T>
25- * @throws Throwable
25+ * @psalm- param class-string<T> $class
26+ * @psalm-param string|array{0:string,1:array} $sql
27+ * @psalm-return Generator<T>
2628 * @throws Exception
2729 * @throws InvalidConfigException
30+ * @throws Throwable
2831 */
29- public function map (string $ class , string |array $ sql , array $ params = []): iterable
32+ public function map (string $ class , string |array $ sql , array $ params = []): Generator
3033 {
3134 if (is_array ($ sql )) {
3235 $ params = $ sql [1 ] ?? $ params ;
3336 $ sql = $ sql [0 ];
3437 }
38+ /** @psalm-var Iterator<array> $iterator */
3539 $ iterator = $ this ->connection ->createCommand ($ sql , $ params )->query ();
3640 foreach ($ iterator as $ row ) {
3741 yield $ this ->hydrator ->create ($ class , $ row );
You can’t perform that action at this time.
0 commit comments