icingadb-web/library/Icingadb/Model/UnreachableParent/ResultSet.php
Bastian Lederer fb9c2b65fa Ensure forward compatibility with ipl-orm by adding return types (#1340)
Add explicit return types to `ipl-orm`-derived methods to prepare for strict
typing. These additions are safe, as they only annotate existing methods that
previously lacked return type declarations.

(cherry picked from commit f8d4f92566)
2026-04-01 10:40:13 +02:00

24 lines
527 B
PHP

<?php
namespace Icinga\Module\Icingadb\Model\UnreachableParent;
use Generator;
use Icinga\Module\Icingadb\Redis\VolatileStateResults;
use Traversable;
class ResultSet extends VolatileStateResults
{
protected function yieldTraversable(Traversable $traversable): Generator
{
$knownIds = [];
foreach ($traversable as $value) {
if (isset($knownIds[$value->id])) {
continue;
}
$knownIds[$value->id] = true;
yield $value;
}
}
}