Skip to content

Commit 458a04b

Browse files
committed
Psalm level 1
1 parent dea5f69 commit 458a04b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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"

src/Remap.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Xepozz\Remap;
66

7+
use Generator;
8+
use Iterator;
79
use Throwable;
810
use Yiisoft\Db\Connection\ConnectionInterface;
911
use 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);

0 commit comments

Comments
 (0)