Skip to content

Commit 4ac1a6b

Browse files
Simplify
1 parent 92650ba commit 4ac1a6b

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

tests/Rules/Doctrine/ORM/EntityColumnRuleTest.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
2929
use function array_unshift;
3030
use function class_exists;
31+
use function sprintf;
3132
use function strpos;
3233
use const PHP_VERSION_ID;
3334

@@ -274,23 +275,16 @@ public function testSuperclass(?string $objectManagerLoader): void
274275

275276
$dbalVersion = InstalledVersions::getVersion('doctrine/dbal');
276277
$hasDbal4 = $dbalVersion !== null && strpos($dbalVersion, '4.') === 0;
277-
if ($hasDbal4) {
278-
$errors = [
279-
[
280-
'Property PHPStan\Rules\Doctrine\ORM\MyBrokenSuperclass::$five type mapping mismatch: database can contain string but property expects int.',
281-
17,
282-
],
283-
];
284-
} else {
285-
$errors = [
286-
[
287-
'Property PHPStan\Rules\Doctrine\ORM\MyBrokenSuperclass::$five type mapping mismatch: database can contain resource but property expects int.',
288-
17,
289-
],
290-
];
291-
}
292278

293-
$this->analyse([__DIR__ . '/data/MyBrokenSuperclass.php'], $errors);
279+
$this->analyse([__DIR__ . '/data/MyBrokenSuperclass.php'], [
280+
[
281+
sprintf(
282+
'Property PHPStan\Rules\Doctrine\ORM\MyBrokenSuperclass::$five type mapping mismatch: database can contain %s but property expects int.',
283+
$hasDbal4 ? 'string' : 'resource',
284+
),
285+
17,
286+
],
287+
]);
294288
}
295289

296290
/**

0 commit comments

Comments
 (0)