Skip to content

Commit 1ff0af7

Browse files
committed
refactor: move null check at the top of convertToDatabaseValue() method
1 parent 8c37551 commit 1ff0af7

File tree

1 file changed

+4
-4
lines changed
  • src/MartinGeorgiev/Doctrine/DBAL/Types

1 file changed

+4
-4
lines changed

src/MartinGeorgiev/Doctrine/DBAL/Types/Ltree.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
6565
{
6666
$this->assertPostgreSQLPlatform($platform);
6767

68+
if (null === $value) {
69+
return null;
70+
}
71+
6872
if (\is_string($value)) {
6973
try {
7074
$value = LtreeValueObject::fromString($value);
@@ -77,10 +81,6 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
7781
return (string) $value;
7882
}
7983

80-
if (null === $value) {
81-
return null;
82-
}
83-
8484
throw InvalidLtreeForPHPException::forInvalidType($value);
8585
}
8686

0 commit comments

Comments
 (0)