Fix bug in DummyResult

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-08-13 21:23:55 +01:00
parent 0ac564169f
commit 72c689be02
2 changed files with 11 additions and 21 deletions

View File

@ -31565,16 +31565,6 @@ parameters:
count: 1
path: test/classes/Stubs/DbiDummy.php
-
message: "#^Only booleans are allowed in a negated boolean, array\\<int, array\\<int, string\\|null\\>\\>\\|null given\\.$#"
count: 10
path: test/classes/Stubs/DummyResult.php
-
message: "#^Only booleans are allowed in a negated boolean, array\\<int, string\\> given\\.$#"
count: 1
path: test/classes/Stubs/DummyResult.php
-
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
count: 1

View File

@ -69,7 +69,7 @@ class DummyResult implements ResultInterface
*/
public function getIterator(): Generator
{
if (! $this->result) {
if ($this->result === null) {
return;
}
@ -86,12 +86,12 @@ class DummyResult implements ResultInterface
*/
public function fetchAssoc(): array
{
if (! $this->result) {
if ($this->result === null) {
return [];
}
$row = $this->result[$this->pos++] ?? [];
if (! $this->columns) {
if ($this->columns === []) {
return $row;
}
@ -111,7 +111,7 @@ class DummyResult implements ResultInterface
*/
public function fetchRow(): array
{
if (! $this->result || $this->pos >= count($this->result)) {
if ($this->result === null || $this->pos >= count($this->result)) {
return [];
}
@ -144,7 +144,7 @@ class DummyResult implements ResultInterface
*/
public function fetchAllAssoc(): array
{
if (! $this->result) {
if ($this->result === null) {
return [];
}
@ -167,7 +167,7 @@ class DummyResult implements ResultInterface
*/
public function fetchAllColumn(): array
{
if (! $this->result) {
if ($this->result === null) {
return [];
}
@ -188,7 +188,7 @@ class DummyResult implements ResultInterface
*/
public function fetchAllKeyPair(): array
{
if (! $this->result) {
if ($this->result === null) {
return [];
}
@ -203,7 +203,7 @@ class DummyResult implements ResultInterface
*/
public function numFields(): int
{
if (! $this->result) {
if ($this->result === null) {
return 0;
}
@ -217,7 +217,7 @@ class DummyResult implements ResultInterface
*/
public function numRows(): int
{
if (! $this->result) {
if ($this->result === null) {
return 0;
}
@ -233,7 +233,7 @@ class DummyResult implements ResultInterface
*/
public function seek(int $offset): bool
{
if (! $this->result) {
if ($this->result === null) {
return false;
}
@ -270,7 +270,7 @@ class DummyResult implements ResultInterface
*/
public function getFieldNames(): array
{
if (! $this->result) {
if ($this->result === null) {
return [];
}