From 34fb6afb5454e5db1ade1767a384925088e3fcea Mon Sep 17 00:00:00 2001 From: jmsche Date: Wed, 29 Nov 2023 15:07:04 +0100 Subject: [PATCH] Fix issue with DBAL version detection --- composer.json | 1 - src/Doctrine/DBAL/Types/PhoneNumberType.php | 2 +- tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 993bcc1f..413e7aac 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,6 @@ "config": { "sort-packages": true }, - "minimum-stability": "dev", "require": { "php": ">=7.4", "giggsey/libphonenumber-for-php": "^8.0", diff --git a/src/Doctrine/DBAL/Types/PhoneNumberType.php b/src/Doctrine/DBAL/Types/PhoneNumberType.php index f3759db0..5f3d5336 100644 --- a/src/Doctrine/DBAL/Types/PhoneNumberType.php +++ b/src/Doctrine/DBAL/Types/PhoneNumberType.php @@ -38,7 +38,7 @@ public function getName(): string public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { // DBAL < 4 - if (method_exists($platform, 'getVarcharTypeDeclarationSQL')) { + if (method_exists(AbstractPlatform::class, 'getVarcharTypeDeclarationSQL')) { return $platform->getVarcharTypeDeclarationSQL(['length' => $fieldDeclaration['length'] ?? 35]); } diff --git a/tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php b/tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php index 2d249f59..4a45779d 100644 --- a/tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php +++ b/tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php @@ -50,7 +50,7 @@ public static function setUpBeforeClass(): void protected function setUp(): void { $this->platform = $this->prophesize(AbstractPlatform::class); - if (method_exists($this->platform, 'getVarcharTypeDeclarationSQL')) { + if (method_exists(AbstractPlatform::class, 'getVarcharTypeDeclarationSQL')) { // DBAL < 4 $this->platform->getVarcharTypeDeclarationSQL()->willReturn('DUMMYVARCHAR()'); } else { @@ -74,7 +74,7 @@ public function testGetName() public function testGetSQLDeclaration() { - if (method_exists($this->platform, 'getVarcharTypeDeclarationSQL')) { + if (method_exists(AbstractPlatform::class, 'getVarcharTypeDeclarationSQL')) { // DBAL < 4 $this->platform->getVarcharTypeDeclarationSQL(['length' => 35])->willReturn('DUMMYVARCHAR()'); } else {