Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 1, 2024
1 parent 00439d5 commit 7414a7d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Type/Doctrine/DBAL/PDOResultRowCountReturnTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace PHPStan\Type\Doctrine\DBAL;

use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use PHPStan\Testing\TypeInferenceTestCase;

class PDOResultRowCountReturnTypeTest extends TypeInferenceTestCase
Expand All @@ -10,7 +12,12 @@ class PDOResultRowCountReturnTypeTest extends TypeInferenceTestCase
/** @return iterable<mixed> */
public function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/pdo-result-row-count.php');
$versionParser = new VersionParser();
if (InstalledVersions::satisfies($versionParser, 'doctrine/dbal', '<3')) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/pdo-result-row-count-dbal-2.php');
} else {
yield from $this->gatherAssertTypes(__DIR__ . '/data/pdo-result-row-count.php');
}
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/Type/Doctrine/DBAL/data/pdo-result-row-count-dbal-2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace PDOResultRowCountDbal2;

use Doctrine\DBAL\Result;
use Doctrine\DBAL\Driver\Result as DriverResult;
use function PHPStan\Testing\assertType;

function (Result $r): void {
assertType('int|string', $r->rowCount());
};

function (DriverResult $r): void {
assertType('int|string', $r->rowCount());
};

0 comments on commit 7414a7d

Please sign in to comment.