• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dg / dibi / 22282875037

22 Feb 2026 06:32PM UTC coverage: 76.552% (-0.5%) from 77.004%
22282875037

push

github

dg
phpstan

55 of 96 new or added lines in 23 files covered. (57.29%)

1 existing line in 1 file now uncovered.

1763 of 2303 relevant lines covered (76.55%)

0.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/Dibi/ResultIterator.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Dibi, smart database abstraction layer (https://dibi.nette.org)
5
 * Copyright (c) 2005 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Dibi;
9

10

11
/**
12
 * External result set iterator.
13
 * @implements \Iterator<int, Row|mixed[]>
14
 */
15
class ResultIterator implements \Iterator, \Countable
16
{
17
        private mixed $row;
18
        private int $pointer = 0;
19

20

21
        public function __construct(
1✔
22
                private readonly Result $result,
23
        ) {
24
        }
1✔
25

26

27
        /**
28
         * Rewinds the iterator to the first element.
29
         */
30
        public function rewind(): void
31
        {
32
                $this->pointer = 0;
1✔
33
                $this->result->seek(0);
1✔
34
                $this->row = $this->result->fetch();
1✔
35
        }
1✔
36

37

38
        /**
39
         * Returns the key of the current element.
40
         */
41
        #[\ReturnTypeWillChange]
42
        public function key(): mixed
43
        {
44
                return $this->pointer;
1✔
45
        }
46

47

48
        /**
49
         * Returns the current element.
50
         */
51
        #[\ReturnTypeWillChange]
52
        public function current(): mixed
53
        {
54
                return $this->row;
1✔
55
        }
56

57

58
        /**
59
         * Moves forward to next element.
60
         */
61
        public function next(): void
62
        {
63
                $this->row = $this->result->fetch();
1✔
64
                $this->pointer++;
1✔
65
        }
1✔
66

67

68
        /**
69
         * Checks if there is a current element after calls to rewind() or next().
70
         */
71
        public function valid(): bool
72
        {
73
                return !empty($this->row);
1✔
74
        }
75

76

77
        /**
78
         * Required by the Countable interface.
79
         * @return int<0, max>
80
         */
81
        public function count(): int
82
        {
NEW
83
                return max(0, $this->result->getRowCount());
×
84
        }
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc