Skip to content

Commit

Permalink
Fix issue with DBAL version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Nov 29, 2023
1 parent c693716 commit 34fb6af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"require": {
"php": ">=7.4",
"giggsey/libphonenumber-for-php": "^8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/DBAL/Types/PhoneNumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 34fb6af

Please sign in to comment.