Skip to content

Commit a9db60d

Browse files
committed
Fix test
1 parent 66c248d commit a9db60d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

tests/Type/Doctrine/DBAL/MysqliResultRowCountReturnTypeTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace PHPStan\Type\Doctrine\DBAL;
44

5+
use Composer\InstalledVersions;
6+
use Composer\Semver\VersionParser;
57
use PHPStan\Testing\TypeInferenceTestCase;
68

79
class MysqliResultRowCountReturnTypeTest extends TypeInferenceTestCase
@@ -10,7 +12,11 @@ class MysqliResultRowCountReturnTypeTest extends TypeInferenceTestCase
1012
/** @return iterable<mixed> */
1113
public function dataFileAsserts(): iterable
1214
{
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/mysqli-result-row-count.php');
15+
if (InstalledVersions::satisfies(new VersionParser(), 'doctrine/dbal', '>=4.0')) {
16+
yield from $this->gatherAssertTypes(__DIR__ . '/data/mysqli-result-row-count.php');
17+
} else {
18+
yield from $this->gatherAssertTypes(__DIR__ . '/data/mysqli-result-row-count-dbal-3.php');
19+
}
1420
}
1521

1622
/**
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace MysqliResultRowCountDbal3;
4+
5+
use Doctrine\DBAL\Result;
6+
use Doctrine\DBAL\Driver\Result as DriverResult;
7+
use function PHPStan\Testing\assertType;
8+
9+
function (Result $r): void {
10+
assertType('int', $r->rowCount());
11+
};
12+
13+
function (DriverResult $r): void {
14+
assertType('int', $r->rowCount());
15+
};

0 commit comments

Comments
 (0)