File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 11QueryPath Changelog
22===========================
33
4+ # 3.2.1
5+ - Fix QueryPath\QueryPathIterator::current() deprecation notice in PHP8.1
6+
47# 3.2.0
58
69- Fixes a number of type-related errors on PHP 8.1
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class QueryPathIterator extends IteratorIterator
2626 public $ options = [];
2727 private $ qp ;
2828
29+ #[\ReturnTypeWillChange]
2930 public function current ()
3031 {
3132 if (! isset ($ this ->qp )) {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace QueryPathTests ;
4+
5+ class QueryPathIteratorTest extends TestCase
6+ {
7+ public function testCurrent ()
8+ {
9+ $ qp = qp ('<ul><li>Item1</li><li>Item2</li></ul> ' , 'li ' );
10+
11+ $ iterator = $ qp ->getIterator ();
12+ $ iterator ->rewind ();
13+
14+ $ this ->assertSame ('Item1 ' , $ iterator ->current ()->text ());
15+ $ iterator ->next ();
16+ $ this ->assertSame ('Item2 ' , $ iterator ->current ()->text ());
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments