Skip to content

Commit 186ee71

Browse files
lSimulmibk
authored andcommitted
Make Query not implement Iterator
Implementing interface which is only throwing exceptions is confusing to static analysis. Plus it makes code compatible with PHP 8.1, which requires return types in the method annotation.
1 parent a30b668 commit 186ee71

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
10+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
1111

1212
fail-fast: false
1313

LeanMapperQuery/Query.php

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use LeanMapperQuery\Exception\InvalidStateException;
2121
use LeanMapperQuery\Exception\MemberAccessException;
2222
use LeanMapperQuery\Exception\NonExistingMethodException;
23-
use LeanMapperQuery\Exception\NotImplementedException;
2423

2524
/**
2625
* @author Michal Bohuslávek
@@ -32,7 +31,7 @@
3231
* @method $this limit(int $limit)
3332
* @method $this offset(int $offset)
3433
*/
35-
class Query implements IQuery, \Iterator
34+
class Query implements IQuery
3635
{
3736
/** @var string */
3837
private static $defaultPlaceholder = '?';
@@ -689,32 +688,4 @@ private function commandOffset($offset)
689688
{
690689
$this->fluent->offset($offset);
691690
}
692-
693-
//////////////////// Iterator //////////////////////
694-
695-
public function current()
696-
{
697-
throw new NotImplementedException("Query object is not iterable.");
698-
}
699-
700-
public function next()
701-
{
702-
throw new NotImplementedException("Query object is not iterable.");
703-
}
704-
705-
public function rewind()
706-
{
707-
throw new NotImplementedException("Query object is not iterable.");
708-
}
709-
710-
public function key()
711-
{
712-
throw new NotImplementedException("Query object is not iterable.");
713-
}
714-
715-
public function valid()
716-
{
717-
throw new NotImplementedException("Query object is not iterable.");
718-
}
719-
720691
}

0 commit comments

Comments
 (0)